I just noticed that ogg files that were submitted through the audioscrobbler plugin were always reported as being 'too short' by last.fm. Looks like song.length is a float for oggs, and it seems that last.fm can't handle those. Since I ripped my entire collection of cd's to ogg, I decided to fiddle with this, and changing lines 100-102 in scrobbler.py to:
def submit(self, song): self.sendInfo(song.artist, song.title, song.album, int(song.length), song.lastplayed[-1])
seems to work. All done by intuition, I haven't actually looked at the AS protocol, or at what the song.length of mp3s (which did and do work) returns, so if someone's gonna check this in I guess they should take a little care. I'll have a more detailed look when I get a little time myself, I just thought I'd mail this for the benefit of anyone else with oggs using the audioscrobbler plugin.
Also: Just started using pytone yesterday, but it already ranks highly in my ever growing list of players. (right now I'm switching back and forth between it and quodlibet, which is also pretty cool)
cheers,
Hi Eric,
On 13.12.06, fred/eric wrote:
I just noticed that ogg files that were submitted through the audioscrobbler plugin were always reported as being 'too short' by last.fm. Looks like song.length is a float for oggs, and it seems that last.fm can't handle those. Since I ripped my entire collection of cd's to ogg, I decided to fiddle with this, and changing lines 100-102 in scrobbler.py to:
def submit(self, song): self.sendInfo(song.artist, song.title, song.album, int(song.length), song.lastplayed[-1])
seems to work. All done by intuition, I haven't actually looked at the AS protocol, or at what the song.length of mp3s (which did and do work) returns, so if someone's gonna check this in I guess they should take a little care. I'll have a more detailed look when I get a little time myself, I just thought I'd mail this for the benefit of anyone else with oggs using the audioscrobbler plugin.
I'd even prefer song.length always being an integer and applied a corresponding patch to the currently active branch of the repository.
Also: Just started using pytone yesterday, but it already ranks highly in my ever growing list of players. (right now I'm switching back and forth between it and quodlibet, which is also pretty cool)
Yes, quodlibet is also a nice piece of software, with a different focus though.
Thanks for the feedback,
Jörg
All done by intuition, I haven't actually looked at the AS protocol,
I have now, because the datetime submitted also does strange things. Turns out the plugin is submitting the float representation that time.time() returns, whereas the AS protocol expects a "YYYY-MM-DD hh:mm:ss" type of string so I modified scrobbler.py again:
at the top added:
from time import localtime, strftime
and line 101 and up now becomes:
def submit(self, song): tstr = strftime( ("%Y-%m-%d %H:%M:%S", localtime(song.lastplayed[-1])) self.sendInfo( song.artist, song.title, song.album, int(song.length), tstr)
I think this is correct, but I'll have to wait a little while to see for sure, since last.fm got a bit confused after the previous erroneous submissions, so it now thinks I'm trying to submit tracks earlier than those I've already submitted. ;)
I'd even prefer song.length always being an integer and applied a corresponding patch to the currently active branch of the repository.
Yes, that may be a good idea, I haven't looked at all of the code, but I can't imagine anything depending on having the time of oggs being a float ;).
Also: Just started using pytone yesterday, but it already ranks highly in my ever growing list of players. (right now I'm switching back and forth between it and quodlibet, which is also pretty cool)
Yes, quodlibet is also a nice piece of software, with a different focus though.
Very true, and both fit my needs at different times, so I think I will keep using both.
I have now, because the datetime submitted also does strange things. Turns out the plugin is submitting the float representation that time.time() returns, whereas the AS protocol expects a "YYYY-MM-DD hh:mm:ss" type of string so I modified scrobbler.py again:
at the top added:
from time import localtime, strftime
and line 101 and up now becomes:
def submit(self, song): tstr = strftime( ("%Y-%m-%d %H:%M:%S", localtime(song.lastplayed[-1])) self.sendInfo( song.artist, song.title, song.album, int(song.length), tstr)
Ok, *please* ignore my last message, this was obviously untrue: the submission already did the float to strftime thing, so the strange times were caused by something else. Maybe last.fm has trouble with timezones or something. (Also my fix above has a parenthesis too many, I really should test first and then mail the list, which is what I'll do now...)
Maybe last.fm has trouble with timezones or something.
Yes, that appears to be the case. I've checked quodlibet's plugin which has always submitted the correct time for me, and that uses time.gmtime() instead of time.localtime(). I've changed that in scrobbler.py.