Comment 4 for bug 568125

Revision history for this message
Jasper A. Visser (jasper-a-visser) wrote :

Yes, the exact command I executed is:
exaile --set-rating=4
It doesn't change the rating of the current track.

When I look at xldbus.py, line 106-114, I see this relevant part:

    modify_commands = (
           'SetRating',
           )

    for command in modify_commands:
        value = getattr(options, command)
        if value:
            iface.SetTrackAttr(command[4:].lower(), value)
            comm = True

If I place "print command[4:].lower()" right after "value = ...", it prints: "ating", not "rating". I'm no Python expert (in fact, this is the first time I look at Python code), but as far as I can tell Python strings are zero-based.

And when I look at lines 226-232 of the same file, I see:
        def SetTrackAttr(self, attr, value):
        """
            Sets rating of a track
        """
        try:
            set_attr = getattr(self.exaile.player.current, attr)
            set_attr(value)
        except AttributeError:
            pass
        except TypeError:
            pass

Hence, it's trying to obtain a handle on a function named "ating" (or "rating", if the first problem is fixed) for the class Track. It can't find that handle, and it will raise an AttributeError. If I catch this error, it tells me:
Traceback (most recent call last):
  File "/usr/local/lib/exaile/xl/xldbus.py", line 231, in SetTrackAttr
    set_attr = getattr(self.exaile.player.current, attr)
AttributeError: 'Track' object has no attribute 'rating'

In the class Track, I do find a method called "set_rating", which seems to be the intended target.