jesseward / plex-lastfm-scrobbler

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

Doesn't scrobble consistently #9

Closed telega closed 10 years ago

telega commented 10 years ago

When started the script successfully submits a few tracks then stops. After a while it will start submitting again, but it wont submit anything played in the interim. http://pastebin.com/73L5nkr8

jesseward commented 10 years ago

@telega thanks for your report.

Any chance you could add your corresponding Plex log to pastebin . From the plex-lastfm-scrobbler logs you have pasted, things appear "ok" . It is possible that I am missing a regex match to capture a played song in your logs.

I would also be interested in how the tracks were played there were missed (web interface, ios/android client) etc.

thanks!

telega commented 10 years ago

Hi, I did some more scrobbling and here are some logs:

Scrobbler: http://pastebin.com/2XbLvHwb PMS: http://pastebin.com/SVajuBu0

I thought it might be the Korean characters, but it happens with other songs as well.

The client is a macbook on mavericks, the server is Ubuntu. I just realized the server version is 9.8.18 which is a bit out of date so im going to try updating that to see if it fixes things.

cheers

jesseward commented 10 years ago

@telega i am betting on a unicode issue within the scrobbler app. One more request when you have a moment.

from your plex machine, please run the following command and send the output to pastebin. This will fetch the XML for '연애의 조건'

curl -o /tmp/51356.xml http://localhost:32400/library/metadata/51356
telega commented 10 years ago

sure here it is: http://pastebin.com/UuKpfmzS

jesseward commented 10 years ago

thanks. the plex_monitor thread is crashing due to a unicode handling issue. Will get this sorted out

Traceback (most recent call last):
  File "/usr/lib64/python2.6/threading.py", line 532, in __bootstrap_inner
    self.run()
  File "/usr/lib64/python2.6/threading.py", line 484, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/jesse/.virtualenv/plex_scrobble/lib/python2.6/site-packages/plex_scrobble/plex_monitor.py", line 130, in monitor_log
    a = lastfm.scrobble(metadata['artist'], metadata['track'])
  File "/home/jesse/.virtualenv/plex_scrobble/lib/python2.6/site-packages/plex_scrobble/lastfm.py", line 129, in scrobble
    artist=artist, track=track))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 2: ordinal not in range(128)
jesseward commented 10 years ago

try grabbing a tarball of the 1.0.1 release. It should handle unicode strings during log output now.

https://github.com/jesseward/plex-lastfm-scrobbler/archive/1.0.1.tar.gz

telega commented 10 years ago

Hey, I tried the 1.0.1 version. It works better now and successfully scrobbled the Korean track. I am still having trouble getting consistent scrobbling - i think it is a PMS issue because it looks like the server isn't always logging a 'got played' line.

I spoke too soon, or i wasn't reading the logs right. Here is another one that was logged but didn't scrobble.

Scrobble: http://pastebin.com/uTdkFCFD PMS: http://pastebin.com/c3X0qDKU XML: http://pastebin.com/UCqB1DKX

jesseward commented 10 years ago

I ran into a scenario this weekend. Mine happened after adding a new flac based album to plex media folders, then manually forcing an 'update library' action in the Audio section. Then playing the new(ish) album shortly after. Not at all sure if this has an effect or a step to reproduce, but in my case this is what led to the PMS not being able to identify when a song was played.

Aug 31, 2014 01:26:39 [0x7f79763bf700] DEBUG - Request: [10.0.0.7:59015] GET /:/timeline?key=%2Flibrary%2Fmetadata%2F40716&identifier=com.plexapp.plugins.library&time=221&state=playing&duration=0&ratingKey=40716&playQueueItemID=1906&X-Plex-Device=iPhone&X-Plex-Client-Platform=iOS&X-Plex-Device-Name=iPhone&X-Plex-Model=3%2C1&X-Plex-Platform=iOS&X-Plex-Client-Identifier=18989E31-BE0B-4718-981E-7CEFF1A75AD7&X-Plex-Product=Plex%2FiOS&X-Plex-Platform-Version=6.1.3&X-Plex-Version=3.4.2 (5 live)
Aug 31, 2014 01:26:39 [0x7f79763bf700] DEBUG -  * key => /library/metadata/40716
Aug 31, 2014 01:26:39 [0x7f79763bf700] DEBUG -  * identifier => com.plexapp.plugins.library
Aug 31, 2014 01:26:39 [0x7f79763bf700] DEBUG -  * time => 221
Aug 31, 2014 01:26:39 [0x7f79763bf700] DEBUG -  * state => playing
Aug 31, 2014 01:26:39 [0x7f79763bf700] DEBUG -  * duration => 0
Aug 31, 2014 01:26:39 [0x7f79763bf700] DEBUG -  * ratingKey => 40716
Aug 31, 2014 01:26:39 [0x7f79763bf700] DEBUG -  * playQueueItemID => 1906
Aug 31, 2014 01:26:39 [0x7f79763bf700] DEBUG -  * X-Plex-Device => iPhone
Aug 31, 2014 01:26:39 [0x7f79763bf700] DEBUG -  * X-Plex-Client-Platform => iOS
Aug 31, 2014 01:26:39 [0x7f79763bf700] DEBUG -  * X-Plex-Device-Name => iPhone
Aug 31, 2014 01:26:39 [0x7f79763bf700] DEBUG -  * X-Plex-Model => 3,1
Aug 31, 2014 01:26:39 [0x7f79763bf700] DEBUG -  * X-Plex-Platform => iOS
Aug 31, 2014 01:26:39 [0x7f79763bf700] DEBUG -  * X-Plex-Client-Identifier => 18989E31-BE0B-4718-981E-7CEFF1A75AD7
Aug 31, 2014 01:26:39 [0x7f79763bf700] DEBUG -  * X-Plex-Product => Plex/iOS
Aug 31, 2014 01:26:39 [0x7f79763bf700] DEBUG -  * X-Plex-Platform-Version => 6.1.3
Aug 31, 2014 01:26:39 [0x7f79763bf700] DEBUG -  * X-Plex-Version => 3.4.2
Aug 31, 2014 01:26:39 [0x7f79763bf700] INFO - Time value greater than duration

It seems as though Plex was unable to obtain the song duration for whatever reason ("duration => 0"). Once 40716 was played, it just moved on to 40717 without stating "got played by.."

Interestingly when i looked at the iOS client, i couldn't seek ahead and the length of the song was "00:00". I have since replayed the same album , start to finish without issue..

I am going to close this off as it is likely a PMS issue where it is not logging "played" tracks in the PMS log. Unfortunately this is the only way I can grab these details.

thanks for your help.

telega commented 10 years ago

More of a PMS issue but just in case anyone else has trouble with this: I looked at my library and as you say there were a lot of tracks with "00:00" for their duration. I fixed this by choosing the "Analyze" option in the music library, instead of the regular "Update Library." Now they have proper durations and seem to scrobble consistently with plex-lastfm-scrobbler. Thanks!