Page 54 of 58 FirstFirst ... 4445253545556 ... LastLast
Results 531 to 540 of 572

Thread: Conky Rhythmbox Python Script

  1. #531
    Join Date
    Feb 2008
    Location
    5238'41.6"N/119'43.6"E
    Beans
    Hidden!

    Re: Conky Rhythmbox Python Script

    Quote Originally Posted by Neon612 View Post
    I feel like I've just been hit over the head. The fix is so simple (I hope it works for more than russian characters, I can't test it).

    Simply change:
    Code:
    location = props["location"]
    to
    Code:
    location = props["location"].encode('utf-8')
    Even better still, put this (in red) near the top of the python file after the imports and forget the encode calls as they should be the default functionality (should be!):

    Code:
    import urllib
    import subprocess
    
    reload(sys)
    sys.setdefaultencoding('utf-8')
    
    try:
        import dbus
        DBUS_AVAIL = True
    Atleast in theory it should work with the existing coverart code if RB provides a path in the first place (doesn't for me)....I haven't tried it though as I can't so please let me know how it turns out! Just add the red to an unchanged .py file....
    Last edited by kaivalagi; May 31st, 2011 at 11:49 PM.

  2. #532
    Join Date
    Feb 2008
    Beans
    145
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Conky Rhythmbox Python Script

    Quote Originally Posted by kaivalagi View Post
    Even better still, put this (in red) near the top of the python file after the imports and forget the encode calls as they should be the default functionality (should be!):

    Code:
    import urllib
    import subprocess
    
    reload(sys)
    sys.setdefaultencoding('utf-8')
    
    try:
        import dbus
        DBUS_AVAIL = True
    Atleast in theory it should work....I haven't tried it though so please let me know how it turns out!
    Just tried it and no dice. The location encode is still needed.

  3. #533
    Join Date
    Feb 2008
    Location
    5238'41.6"N/119'43.6"E
    Beans
    Hidden!

    Re: Conky Rhythmbox Python Script

    Quote Originally Posted by Neon612 View Post
    Just tried it and no dice. The location encode is still needed.
    Darn it....well an encode('utf-8') on the end of the coverart path code (pre your changes) should mean the cover art paths comes through okay and are useable I would hope...I would prefer no id3 tag stuff unless if it's in addition if cover art isn't coming from the dbus provided properties

    edit: attached original py with amendments for unicode string prep (still using file linking though), can you run it using '--datatype=CA --verbose' with one of those Russian songs playing? I really wish I could get the song coverart to come through for me with RB....this is torture!
    Attached Files Attached Files
    Last edited by kaivalagi; June 1st, 2011 at 12:04 AM.

  4. #534
    Join Date
    Feb 2008
    Beans
    145
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Conky Rhythmbox Python Script

    Code:
    darin@computer-2:~/Desktop$ python conkyRhythmbox.py --datatype=CA --verbose
    *** INITIAL OPTIONS:
        datatype: CA
        template: None
        ratingchar: *
        nounknownoutput: False
        secondsoutput: False
        maxlength: 0
        verbose: True
        errorlogfile: None
        infologfile: None
    INFO: Calling dbus interface for music data
    INFO: Setting up dbus interface
    INFO: Calling dbus interface for music data
    INFO: Preparing output for datatype:CA
    INFO: Linking coverart from /home/darin/.cache/rhythmbox/covers/Виа Гра - Попытка №5.jpg to /tmp/cover
    Traceback (most recent call last):
      File "conkyRhythmbox.py", line 232, in getOutputData
        self.getShellCommandOutput(linkcmd)
      File "conkyRhythmbox.py", line 483, in getShellCommandOutput
        self.logger.info("Running shell command '%s'"%shell_command)
    AttributeError: RhythmboxInfo instance has no attribute 'logger'
    ERROR: Unknown error when calling getOutputData:RhythmboxInfo instance has no attribute 'logger'
    What is this 'logger' its looking for?
    Last edited by Neon612; June 2nd, 2011 at 12:27 AM.

  5. #535
    Join Date
    Feb 2008
    Location
    5238'41.6"N/119'43.6"E
    Beans
    Hidden!

    Re: Conky Rhythmbox Python Script

    Quote Originally Posted by Neon612 View Post
    Code:
    darin@computer-2:~/Desktop$ python conkyRhythmbox.py --datatype=CA --verbose
    *** INITIAL OPTIONS:
        datatype: CA
        template: None
        ratingchar: *
        nounknownoutput: False
        secondsoutput: False
        maxlength: 0
        verbose: True
        errorlogfile: None
        infologfile: None
    INFO: Calling dbus interface for music data
    INFO: Setting up dbus interface
    INFO: Calling dbus interface for music data
    INFO: Preparing output for datatype:CA
    INFO: Linking coverart from /home/darin/.cache/rhythmbox/covers/’иа “€а - Ÿоп‹‚ка „–5.jpg to /tmp/cover
    Traceback (most recent call last):
      File "conkyRhythmbox.py", line 232, in getOutputData
        self.getShellCommandOutput(linkcmd)
      File "conkyRhythmbox.py", line 483, in getShellCommandOutput
        self.logger.info("Running shell command '%s'"%shell_command)
    AttributeError: RhythmboxInfo instance has no attribute 'logger'
    ERROR: Unknown error when calling getOutputData:RhythmboxInfo instance has no attribute 'logger'
    What is this 'logger' its looking for?
    My bad, I copy and pasted code and didn't update something....

    Change any "self.logger.info" to be "self.logInfo"

    There should only be one entry

    Although, this means there was an error and looking at the path it ain't good:

    /home/darin/.cache/rhythmbox/covers/’иа “€а - Ÿоп‹‚ка „–5.jpg

    edit: to top it all, the Rhythmbox version I now have wont play ball as they've changed the dbus interface quite considerably....I have v2.90.1

  6. #536
    Join Date
    Sep 2010
    Location
    Aotearoa
    Beans
    59

    Re: Conky Rhythmbox Python Script

    Probably of no help, but I would suggest sticking an echo command after getting the information from dbus so that you can tell where the script is going wrong.

    I don't know whether you have to use slightly different commands when dealing with unicode in python.
    Here's a link that might help http://docs.python.org/library/functions.html#unicode
    "I don't have a problem with someone using their talents to become successful, I just don't think the highest calling is success." - Richard Stallman
    sudo apt-get mail
    package not found

  7. #537
    Join Date
    Feb 2008
    Beans
    145
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Conky Rhythmbox Python Script

    I've attached an updated script using the one from page 50 (51?). Its still using linking, well heres the verbose output:
    Code:
    darin@computer-2:~/Desktop$ python untitled\ folder/conkyRhythmbox.py --datatype=CA --verbose
    *** INITIAL OPTIONS:
    	datatype: CA
    	template: None
    	ratingchar: *
    	nounknownoutput: False
    	secondsoutput: False
    	maxlength: 0
    	verbose: True
    	errorlogfile: None
    	infologfile: None
    INFO: Calling dbus interface for music data
    INFO: Setting up dbus interface
    INFO: Calling dbus interface for music data
    INFO: Preparing output for datatype:CA
    INFO: Linking coverart from /home/darin/.cache/rhythmbox/covers/Виа Гра - Стоп! Снято!.jpg to /tmp/cover
    INFO: Running shell command 'ln -sf "/home/darin/.cache/rhythmbox/covers/Виа Гра - Стоп! Снято!.jpg" "/tmp/cover"'
    /tmp/cover
    Attached Files Attached Files

  8. #538
    Join Date
    Sep 2010
    Location
    Aotearoa
    Beans
    59

    Re: Conky Rhythmbox Python Script

    Quote Originally Posted by Neon612 View Post
    I've attached an updated script using the one from page 50 (51?). Its still using linking, well heres the verbose output:
    Code:
    darin@computer-2:~/Desktop$ python untitled\ folder/conkyRhythmbox.py --datatype=CA --verbose
    *** INITIAL OPTIONS:
        datatype: CA
        template: None
        ratingchar: *
        nounknownoutput: False
        secondsoutput: False
        maxlength: 0
        verbose: True
        errorlogfile: None
        infologfile: None
    INFO: Calling dbus interface for music data
    INFO: Setting up dbus interface
    INFO: Calling dbus interface for music data
    INFO: Preparing output for datatype:CA
    INFO: Linking coverart from /home/darin/.cache/rhythmbox/covers/Виа Гра - Стоп! Снято!.jpg to /tmp/cover
    INFO: Running shell command 'ln -sf "/home/darin/.cache/rhythmbox/covers/Виа Гра - Стоп! Снято!.jpg" "/tmp/cover"'
    /tmp/cover
    If that script doesn't use unicode and can only handle Russian characters then you might have some problems. It wasn't just Russian that we had problems with there was stuff like this http://www.jamendo.com/en/artist/Artist_%28245%29

    how do the scripts such as conky clementine do it, do they provide more information over dbus than rhythmbox.

    I also think there was an update somewhere that broke support for the coverart part of the conkyrhythmbox script.
    "I don't have a problem with someone using their talents to become successful, I just don't think the highest calling is success." - Richard Stallman
    sudo apt-get mail
    package not found

  9. #539
    Join Date
    Feb 2008
    Beans
    145
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Conky Rhythmbox Python Script

    Quote Originally Posted by vehemoth View Post
    If that script doesn't use unicode and can only handle Russian characters then you might have some problems. It wasn't just Russian that we had problems with there was stuff like this http://www.jamendo.com/en/artist/Artist_%28245%29

    how do the scripts such as conky clementine do it, do they provide more information over dbus than rhythmbox.

    I also think there was an update somewhere that broke support for the coverart part of the conkyrhythmbox script.

    I know for certain it will work with russian letters. Someone else will have to test the others.

    As to the coverart part, if the characters will display the coverart should as well.

  10. #540
    Join Date
    Mar 2011
    Location
    VietNam
    Beans
    46

    Re: Conky Rhythmbox Python Script

    Hi all,

    kaivalagi this script print this in python >= 2.7:

    conkyRhythmbox.py", line 45
    self.parser.add_option("-t", "--template", dest="template", type="string", metavar="FILE", help=u"define a template file to generate output in one call. A displayable item in the file is in the form [--datatype=TI]. The following are possible options within each item: --datatype,--ratingchar. Note that the short forms of the options are not currently supported! None of these options are applicable at command line when using templates.")

    I think that optparse module is deprecated, more info in:
    http://docs.python.org/library/optparse.html

    I don't a python programmer.

    Thanks for the great script !!!

Page 54 of 58 FirstFirst ... 4445253545556 ... 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
  •