Page 1 of 5 123 ... LastLast
Results 1 to 10 of 43

Thread: Conky Miscellaneous Python Scripts

  1. #1
    Join Date
    Feb 2008
    Location
    52°38'41.6"N/1°19'43.6"E
    Beans
    Hidden!

    Conky Miscellaneous Python Scripts

    ArchLinux : Package support is present in the AUR. All my packages can be seen here: http://aur.archlinux.org/packages.php?SeB=m&K=kaivalagi

    Ubuntu/Debian : All the script packages have now been copied into the Conky Companions PPA. Any package updates will be provided by the team through this new ppa. The ppa can be found here: https://launchpad.net/~conky-companions/+archive/ppa. To use this ppa first delete the old ppa files using this:
    Code:
    sudo rm /etc/apt/sources.list.d/m-buck* && sudo rm /etc/apt/sources.list.d/conkyhardcore*
    Then follow the modified first post instructions for the scripts


    Intro

    This is a collection is very simple scripts to do various conky orientated things.

    The scripts present are:
    • conkyText - provides formatted output from a delimited text file
    • conkyLatLong - provides latitude/longtitude co-ordinates based on your IP address
    • conkyDateDiff - provides a difference in time between now/a date to another date
    • conkyDaysDiff - provides a difference in days between now/a date to another date
    • conkySlideshow - provides a locally stored image on each call based on an input file of image URLs


    There is a README with the install, I suggest you give it atleast a quick once over! It can be found in the installation folder, normally following the path of /usr/share/conkymisc/

    Basic Install

    Method 1: Using apt

    1) Add the repository to your OS install:
    Code:
    sudo add-apt-repository ppa:conky-companions/ppa
    * Note if you are running 9.10 or below then refer to the PPA link at the end of this post for help on installing from the ppa, good guidance can be found on the launchpad site

    2) Now that is done simply run the following to update your repo cache and install the scripts:

    Code:
    sudo apt-get update && sudo apt-get install conkymisc
    Method 2: Using deb file

    Run the .deb file available at the Conky Companions PPA site here: https://launchpad.net/~conky-compani.../ppa/+packages

    Warning, this will not ensure you are kept up-to-date. Only method 1 will do that

    Method 3: Using tar.gz file

    Extract all the contents of the tar.gz file to an appropriate folder, and edit the various /usr/bin calling scripts (e.g. conkyText) to point to the correct location where th epython scripts have been placed (e.g conkyText.py). The tar.gz file is available at the Conky Companions PPA site here: https://launchpad.net/~conky-compani.../ppa/+packages

    Unless you are using a non-Debian based OS I don't suggest this. Users of Debian/Ubuntu flavour OS's should ideally use method 1.

    Again will will not receive updates using this method. ONLY method 1 can do this for you

    All further details on setup are orientated around the deb package based install, so may differ from what you choose your setup to be, if done using the tarball.


    Usage Help

    For each command you can get the current help options at any time by running (change the command as necessary):
    Code:
    conkyText -h
    or
    Code:
    conkyText --help
    conkyText Help (conkyText --help)
    Code:
    Usage: conkyText [options]
    Options:
      -h, --help            show this help message and exit
      -t FILE, --template=FILE
                            location of the template file to define the layout of
                            output
      -f FILE, --textfile=FILE
                            location of the text file to output.
      -d FILE, --delimiter=FILE
                            default:[;]Specify the delimiter to use when splitting
                            out a line of text into formatted segments
      -v, --verbose         Request verbose output, not a good idea when running
                            through conky!
      --errorlogfile=FILE   If a filepath is set, the script appends errors to the
                            filepath.
      --infologfile=FILE    If a filepath is set, the script appends info to the
                            filepath.
    conkySlideshow Help (conkySlideshow --help)
    Code:
    Usage: conkySlideshow.py [options]
    
    Options:
      -h, --help            show this help message and exit
      -t FILE, --template=FILE
                            location of the template file to define the layout of
                            output, the placeholders are [imagename], [imageurl],
                            [imagepath], [imagewidth], [imageheight]
      -l FILE, --imagelist=FILE
                            location of the text file providing the image list
                            data, strict format required of NAME;URL on each line.
      -i FILE, --index=FILE
                            [default: /tmp/conkySlideshow.idx] Location of the
                            temp index file used to store the last image index
                            used
      -o FILE, --output=FILE
                            [default: /tmp/conkySlideshow.jpg] Location of the
                            file used for output
      -x NUMBER, --maxwidth=NUMBER
                            [default: 0] Output images maximum width, if zero has
                            no effect, maxwidth overrides maxheight if both are
                            set
      -y NUMBER, --maxheight=NUMBER
                            [default: 0] Output images maximum height, if zero has
                            no effect, maxwidth overrides maxheight if both are
                            set
      -r, --random          Request a random image from the list rather than the
                            next in the series
      -c NUMBER, --connectiontimeout=NUMBER
                            [default: 10]
      -v, --verbose         Request verbose output, not a good idea when running
                            through conky!
      --errorlogfile=FILE   If a filepath is set, the script appends errors to the
                            filepath.
      --infologfile=FILE    If a filepath is set, the script appends info to the
                            filepath.
    conkyLatLong Help (conkyLatLong --help)
    Code:
    Usage: conkyLatLong [options]
    Options:
      -h, --help            show this help message and exit
      -l, --longitudeonly   Force the script output Longitude only
      -L, --latitudeonly    Force the script output Latitude only
      -i, --imperial        Force the script to output in Degrees / Minutes and
                            Seconds. If not set the script outputs in the standard
                            metric decimal fashion
      -c NUMBER, --connectiontimeout=NUMBER
                            [default: 10]
      -v, --verbose         Request verbose output, not a good idea when running
                            through conky!
      -V, --version         Displays the version of the script.
      --errorlogfile=FILE   If a filepath is set, the script appends errors to the
                            filepath.
      --infologfile=FILE    If a filepath is set, the script appends info to the
                            filepath.
    conkyDateDiff Help (conkyDateDiff --help)
    Code:
    Usage: conkyDateDiff <startdate> [<enddate>]
      If no end date given it is assumed to be today.
    
      examples:
    
        $ conkyDateDiff 20080105 20091225
        1 year, 11 months, 20 days
    conkyDaysDiff Help (conkyDaysDiff --help)
    Code:
    Usage: conkyDaysDiff <startdate> [<enddate>]
      If no end date given it is assumed to be today.
    
      examples:
    
        $ conkyDaysDiff 20080105 20091225
        720

    Development History

    Development history going forwards can be seen here https://code.launchpad.net/~conky-companions/+junk/conkymisc
    All packages available from me can be found here: https://launchpad.net/~conky-companions/+archive/ppa
    Last edited by kaivalagi; February 25th, 2011 at 07:08 PM.

  2. #2
    Join Date
    Feb 2010
    Beans
    Hidden!

    Re: Conky Miscellaneous Python Scripts

    Well I'll be a monkey's uncle - no, scratch that ...

    Well I'll be. I'll have to subscribe to this thread, I use all fours of them

  3. #3
    Join Date
    Apr 2007
    Beans
    195

    Re: Conky Miscellaneous Python Scripts

    Hey kaivalagi! Yet another bunch of great scripts for conky!

    Question though. Would it be possible to code switches to limit the data output? Right now I'm using Grep/Awk to grab Latitude separate from Longitude. Could another release of the conkyLatLong script include a switch to do that for me/the user?

    And, also, a switch to go to a decimal format rather than minutes/seconds would be nice too. I only ask because there's a place in my Conky for the data, but it's narrower than the space it takes for the way the script currently displays the output. I used this to grab only one output at a time.

    Code:
    Lat: ${execi 30 conkyLatLong | grep 'N' | awk '{print $1}'}
    Long:${execi 30 conkyLatLong | grep 'W' | awk '{print $3}'}
    I was kinda hoping some future release might have this an alternative:

    Code:
    conkyLatLong -Lat
    conkyLatLong -Long
    conkyLatLong -u (For switching units.)
    Just to simplify the code in the Conky. Just an idea!

  4. #4
    Join Date
    Feb 2008
    Location
    52°38'41.6"N/1°19'43.6"E
    Beans
    Hidden!

    Re: Conky Miscellaneous Python Scripts

    I can't sleep so I'm taking a look now...I'm building in an options parser like used with the bigger scripts to give the abilities needed. It shouldn't take long as it's pretty much a cut and paste exercise from other scripts.

    edit: Okay, find attached v1.01 of the Lat Long script, here are the options:

    Code:
    Usage: conkyLatLong [options]
    Options:
      -h, --help            show this help message and exit
      -l, --longitudeonly   Force the script output Longitude only
      -L, --latitudeonly    Force the script output Latitude only
      -i, --imperial        Force the script to output in Degrees / Minutes and
                            Seconds. If not set the script outputs in the standard
                            metric decimal fashion
      -c NUMBER, --connectiontimeout=NUMBER
                            [default: 10]
      -v, --verbose         Request verbose output, not a good idea when running
                            through conky!
      -V, --version         Displays the version of the script.
      --errorlogfile=FILE   If a filepath is set, the script appends errors to the
                            filepath.
      --infologfile=FILE    If a filepath is set, the script appends info to the
                            filepath.
    An example of commands and their output:
    Code:
    ]$ conkyLatLong
    52.6280 / 1.3030
    ]$ conkyLatLong -i   <-- as before
    52°37"40.8'N / 1°18"10.8'E
    ]$ conkyLatLong -l
    1.3030
    ]$ conkyLatLong -L
    52.6280
    ]$ conkyLatLong -l -i
    1°18"10.8'E
    ]$ conkyLatLong -L -i
    52°37"40.8'N
    Get back to me once you've had a play with it to let me know iof all is well for a release or not

    Cheers
    Attached Files Attached Files
    Last edited by kaivalagi; February 10th, 2011 at 02:46 AM.

  5. #5
    Join Date
    Apr 2007
    Beans
    195

    Re: Conky Miscellaneous Python Scripts

    I'm just going to shortcut it all... It works perfectly without a flaw I can find. Do you need proof or is that good enough for you?

    ...And WOW that was fast! Thank You! My code thanks you too!

  6. #6
    Join Date
    Feb 2008
    Location
    52°38'41.6"N/1°19'43.6"E
    Beans
    Hidden!

    Re: Conky Miscellaneous Python Scripts

    It works for me too so it's going into a new conkyMisc package soon

  7. #7
    Join Date
    Feb 2008
    Location
    52°38'41.6"N/1°19'43.6"E
    Beans
    Hidden!

    Re: Conky Miscellaneous Python Scripts

    UPDATE

    Updates as follows:
    • Updated conkyLatLong to have arguments for long only, lat only and imperial / metric output as well as the standard logging and verbose functions
    • Amended usr/bin scripts to bring in line with other scripts


    Package changes can be seen here: https://launchpad.net/~conky-compani...source.changes

    The apt packages should be available soon

  8. #8
    Join Date
    Oct 2010
    Location
    Sweden
    Beans
    821
    Distro
    Ubuntu 16.04 Xenial Xerus

    Unhappy Re: Conky Miscellaneous Python Scripts

    I have the latitude and longitude script installed and it was working until this morning. I noticed nothing was being displayed in my conky so I tried the command from the terminal and received this:

    Code:
    $ conkyLatLong
    ERROR: writeOutput error:HTTP Error 500: Internal Server Error
    Any ideas on what is going wrong or how to fix it? I haven't changed anything.
    I'm guessing that this is an error with the website used to fetch the coordinates. I'm not sure though and the first thought my newbie mind had was that Internal Server Error meant something wrong on my end.
    Last edited by GrouchyGaijin; February 17th, 2011 at 11:10 AM.
    Thank you,
    GG -----------
    GUI we don't need no stinking GUI: A collection of Bash scripts
    Mutt (email), cmus (music),Google Calendar and Google Tasks cli

  9. #9
    Join Date
    Feb 2010
    Beans
    Hidden!

    Re: Conky Miscellaneous Python Scripts

    Quote Originally Posted by GrouchyGaijin View Post
    I have the latitude and longitude script installed and it was working until this morning. I noticed nothing was being displayed in my conky so I tried the command from the terminal and received this:

    Code:
    $ conkyLatLong
    ERROR: writeOutput error:HTTP Error 500: Internal Server Error
    Any ideas on what is going wrong or how to fix it? I haven't changed anything.
    I'm guessing that this is an error with the website used to fetch the coordinates. I'm not sure though and the first thought my newbie mind had was that Internal Server Error meant something wrong on my end.
    Interesting, I have the same problem:

    Code:
      08:34 ~
             $ conky -c ~/Conky/LatLong
    Conky: forked to background, pid is 7796
    
      08:34 ~
             $ 
    Conky: desktop window (1ad) is root window
    Conky: window type - override
    Conky: drawing to created window (0x2e00001)
    Conky: drawing to double buffer
    ERROR: writeOutput error:HTTP Error 500: Internal Server Error
    conky -c ~/Conky/LatLong
    Conky: forked to background, pid is 8117
    So I reverted to my older version of conkyLatLong
    Code:
    conky -c ~/Conky/LatLong
    Conky: forked to background, pid is 8117
    
      08:36 ~
             $ 
    Conky: desktop window (1ad) is root window
    Conky: window type - override
    Conky: drawing to created window (0x3000001)
    Conky: drawing to double buffer
    Traceback (most recent call last):
      File "/home/sector11/Conky/scripts/conkyLatLong.py", line 37, in <module>
        usock = urllib2.urlopen(url)
      File "/usr/lib/python2.6/urllib2.py", line 126, in urlopen
        return _opener.open(url, data, timeout)
      File "/usr/lib/python2.6/urllib2.py", line 397, in open
        response = meth(req, response)
      File "/usr/lib/python2.6/urllib2.py", line 510, in http_response
        'http', request, response, code, msg, hdrs)
      File "/usr/lib/python2.6/urllib2.py", line 435, in error
        return self._call_chain(*args)
      File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain
        result = func(*args)
      File "/usr/lib/python2.6/urllib2.py", line 518, in http_error_default
        raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
    urllib2.HTTPError: HTTP Error 500: Internal Server Error
             $
    I installed a "localhost" yesterday I wonder if that could be the problem:

    Code:
    http://localhost/
    It works!
    This is the default web page for this server.
    The web server software is running but no content has been added, yet.

  10. #10
    Join Date
    Oct 2010
    Location
    Sweden
    Beans
    821
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Conky Miscellaneous Python Scripts

    Quote Originally Posted by Sector11 View Post
    $[/CODE]

    I installed a "localhost" yesterday I wonder if that could be the problem:

    Code:
    http://localhost/
    Do you mean that your conky latitude and longitude now works?
    I really don't understand the last part of your reply.

    When I type
    Code:
    http://localhost/
    I also get

    "It works!

    This is the default web page for this server.

    The web server software is running but no content has been added, yet."
    Thank you,
    GG -----------
    GUI we don't need no stinking GUI: A collection of Bash scripts
    Mutt (email), cmus (music),Google Calendar and Google Tasks cli

Page 1 of 5 123 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •