jesseward / plex-lastfm-scrobbler

Scrobble played audio items Last.FM from the Plex Media Server application.
MIT License
92 stars 13 forks source link

Scrobbles no album information #19

Closed ndejay closed 9 years ago

ndejay commented 9 years ago

First off I'd like to thank you for this wonderful piece of software. Everything works fine except that no album information is scrobbled. The (FLAC) album tags appear both to be readable by most of my other music players and also by Plex, so I don't really know why this happens.

plex_scrobble.log

2014-10-12 11:53:24,260 [19051] [plex_scrobble.plex_monitor parse_line] [INFO] Found played song and extracted library id '212' from plex log
2014-10-12 11:53:24,261 [19051] [plex_scrobble.plex_monitor fetch_metadata] [INFO] Fetching library metadata from http://localhost:32400/library/metadata/212
2014-10-12 11:53:24,274 [19051] [plex_scrobble.lastfm scrobble] [INFO] submitting Arcade Fire - Une Année sans lumière to last.fm.

Do not hesitate to let me know if I omitted any important details.

Thanks in advance.

jesseward commented 9 years ago

hi @ndejay thanks for the report. Please confirm, is the issue that the above scrobble "Arcade Fire - Une Année sans lumière", did not appear on your last.fm account? Or is there other data that may be missing.

ndejay commented 9 years ago

The tracks themselves are scrobbling, but without the album tags! Here's another case of the same problem:

http://www.last.fm/user/next__/library/music/The+Cure

You will see that the Disintegration album was only scrobbled 12 times (when looking at the tracks, it is clear they have been much more than that.) My guess is that these tracks are being scrobbled without any (with blank) album information.

Hope this helps.

EDIT: I should probably mention that I am listening to FLACs (not MP3s) but they are properly tagged in a way that most player recognizes. Thanks.

jesseward commented 9 years ago

@ndejay thanks for the detailed report. At the moment this is by design. Scrobbling occurs in the following block of code. https://github.com/jesseward/plex-lastfm-scrobbler/blob/master/plex_scrobble/lastfm.py#L131-L135 . I am only passing the artist and track name currently.

I have marked this request as an enhancement and will add the optional album name at some point soon.

For my reference, last.fm track.scrobble API details found @ http://www.last.fm/api/show/track.scrobble

ndejay commented 9 years ago

Yep and it appears that https://github.com/jesseward/plex-lastfm-scrobbler/blob/master/plex_scrobble/plex_monitor.py#L67-80 contains the lines for fetching metadata.

Should I just modify the code myself and send you a pull request?

Either way, looking forward to the enhancement!

EDIT: Nevermind, it's a bit more complicated that I thought it'd be, I'll just wait patiently :)

jesseward commented 9 years ago

hi @ndejay , if you're bored and up for the task, please do feel free to make the changes ;-)

Earlier today, I checked the XML containing metadata that is returned from PMS and verified album name is returned.

In the fetch_metadata method that you have outlined, adding something such as the code below and then extending the dictionary that is returned (return {'track': song, 'artist': artist, 'album': album}) should sort things out.

album = track.get('parentTitle')
if not album:
    album = None

Along with the updates to call signature in scrobble() method.

Unfortunately I don't have tests written for the scrobble functionality yet ,s o i was hesitant to modify code and commit changes without the ability to test (at work currently...)

jesseward commented 9 years ago

hi @ndejay i have added the changes and confirmed with a pair of scrobbles. Let me know how things look from your side. If they're ok, please feel free to close out this issue.

seanfilidis commented 9 years ago

Stupid question: How do I implement this update? Do I have to redownload the whole thing and go through the installation procedure again?

jesseward commented 9 years ago

hi @seanfilidis . You're correct , you will want to download the zip archive and run through the install process again.

You may wish to back up your config file, to ensure you keep a working version .

Download at https://github.com/jesseward/plex-lastfm-scrobbler/archive/master.zip

ndejay commented 9 years ago

@jesseward It works perfectly! Thank you so much for the speedy implementation of this feature.

@seanfilidis I simply went through the installation procedure again though reauthorizing the client wasn't necessary as long as you don't delete your ~/.config/plex-lastfm-scrobbler/session file.