emesene / emesene-supported-plugins

set of plugins supported by the emesene team
http://www.emesene.org
15 stars 11 forks source link

The music plugin fails when the 'Album' field in the id3tag is empty (Audacious) #40

Closed danielgomon closed 12 years ago

danielgomon commented 13 years ago

This happens when the "Album" field in the id3tag of the song is empty, the song doesn't change and the plugin doesn't work anymore until emesene is restarted. Can you make the music plugin skips the 'Album' field if the cover album as an avatar option is not set?

I'm on emesene git version in Ubuntu Lucid, here's the output:

$ /home/maloy/emesene/emesene/emesene [21:36:10 ERROR papyon.protocol.notification] Notification got error : 913 14 Traceback (most recent call last): File "/home/maloy/.config/emesene2/plugins/music/songretriever.py", line 138, in check_song song = self.get_current_song() File "/home/maloy/.config/emesene2/plugins/music/handler_audacious2.py", line 30, in get_current_song album = self.iface.SongTuple(song_position, "album") File "/usr/lib/pymodules/python2.6/dbus/proxies.py", line 140, in call **keywords) File "/usr/lib/pymodules/python2.6/dbus/connection.py", line 620, in call_blocking message, timeout) dbus.exceptions.DBusException: org.freedesktop.DBus.GLib.ErrorError: Method invoked for SongTuple returned FALSE but did not set error [21:36:26 WARNING papyon.p2p] Trying to publish an empty MSNObject

djthyrax commented 12 years ago

In handler_audacious2.py, get_current_song() should be something like this:

def get_current_song(self):
    '''Returns the current song in the correct format'''
    if self.is_playing():
        song_position = self.iface.Position()
        try:
            artist = self.iface.SongTuple(song_position, "artist")
        except: #find which exception to actually catch
            artist = ""
        try:
            album = self.iface.SongTuple(song_position, "album")
        except:
            album = ""
        try:
            title = self.iface.SongTuple(song_position, "title")
        except:
            title = ""    
        return songretriever.Song(artist, album, title)

Comments?

danielgomon commented 12 years ago

I've manually added this change, it works ok!

danielgomon commented 12 years ago

With the latest update, the music plugin doesn't work anymore. I'm in Ubuntu 10.04 with audacious 2.5.4.

danielgomon commented 12 years ago

It only works when I use the old handler_audacious2.py like this:

def __init__(self, main_window = None, 
             iface_name = 'org.atheme.audacious',
             iface_path = '/org/atheme/audacious'):
    DBusBase.DBusBase.__init__(self, main_window, iface_name, iface_path)

def is_playing(self):
    '''Returns True if a song is being played'''
    # Note: Can't use self.iface.Playing() because
    # returns True even if the song is paused
    if self.is_running():
        return self.iface.Status() == "playing"

    return False

def get_current_song(self):
    '''Returns the current song in the correct format'''
    if self.is_playing():
        song_position = self.iface.Position()
        try:
            artist = self.iface.SongTuple(song_position, "artist")
        except: #find which exception to actually catch
            artist = ""
        try:
         album = self.iface.SongTuple(song_position, "album")
        except:
            album = ""
        try:
            title = self.iface.SongTuple(song_position, "title")
        except:
            title = ""    
        return songretriever.Song(artist, album, title)
pepeleproso commented 12 years ago

The new method should work with audacious 2.5+