jesseward / plex-lastfm-scrobbler

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

Windows Install #16

Closed seanfilidis closed 9 years ago

seanfilidis commented 9 years ago

On Windows the installation procedure seemed to work, but I get the following errors when I try to run the application:

11d0062a-4716-11e4-82d5-04cf7f37f188

My config file looks like:

capture

Would love to get this working...

jesseward commented 9 years ago

@seanfilidis thanks for the report. the '\n' hints at a Unix newline character. I wonder if the ascii conversion is not happening.

Can you add your config file to this ticket or pastebin. or attempt to strip the unix '\n' from the file . I think notepadd++ will do this .dos2unix (unix2dos) http://waterlan.home.xs4all.nl/dos2unix.html

seanfilidis commented 9 years ago

Hi

So, I can't figure out how to attach a file other than an image anywhere in this thread. I already posted an image of my config file above, though.

I don't know what you mean about stripping the /n out. I don't see that anywhere in the config file. I'm not a developer, though, just a Plex user trying to get this to work on my windows box...

jesseward commented 9 years ago

hi @seanfilidis , try using the config file i have pasted to http://pastebin.com/LQB3vEDA . Please also provide the python version you're running (python -V) as well as the version of Windows. thanks

seanfilidis commented 9 years ago

I don't know what was different about the one you put on pastebin, but something worked. This time when I entered the command to start the app "python plex-scrobbler.py" I got the prompt to authenticate.

I followed the URL to last.fm and gave access to plex-scrobbler.

Now, however, when I try to start the application again, by typing "python plex-scrobbler.py" again, nothing happens. It gets stuck. And it's not scrobbilng =(

I checked the plex-scrobble.log file, and here is a screenshot of it: capture

My Pythone version is 2.7.8 by the way, and it's Windows 7 Ultimate

jesseward commented 9 years ago

@seanfilidis great news. This is progress ;-) Could you pass along your Plex Media Server log as well as your plex-scrobbler log. Make sure you have played at least 3 songs while plex-scrobbler is running.

Feel free to dump/copy paste the log files at http://pastebin.com

seanfilidis commented 9 years ago

The Plex Media Server Log is much to large for pastebin, so here is a dropbox link to it: https://dl.dropboxusercontent.com/u/3805259/Plex%20Media%20Server.log

Here is the pastebin for the plex_scrobble.log http://pastebin.com/2Za1nD6g

jesseward commented 9 years ago

thanks for this @seanfilidis , it looks like the timestamps on the two logs do not overlap, so it will be hard to determine what the problem is. The PMS logs in dropbox are from the 9th , whereas the PLS logs are from the 8th.

Ideally we try the following.

From your PMS log shared via dropbox, I can confirm that things "should" work

Oct 09, 2014 06:45:57:898 [1200] DEBUG - Library item 10771 'Money' got played by account 1!

The above log line is what PLS watches for (via this line of code in plex_monitor.py https://github.com/jesseward/plex-lastfm-scrobbler/blob/master/plex_scrobble/plex_monitor.py#L28) . When this log entry is encountered it performs a look-up against the API and then sends the metadata off to Last.FM for scrobble consideration.

seanfilidis commented 9 years ago

I will try this tomorrow. What is the command to shut down PLS?

jesseward commented 9 years ago

hi @seanfilidis great question and for Windows unfortunately things are not really documented. Thanks for being a beta tester . You're indirectly solving issue https://github.com/jesseward/plex-lastfm-scrobbler/issues/6 as well ;-)

On Linux and OSX, it is easy to simply background the process then kill as needed. With an MS Windows installation, you will need to launch a dos shell/cmd prompt and start the python script. If you had previously killed the dos prompt with the script running, it is safe to assume the process is already dead. To kill it from within the cmd/dos prompt you can issue ctrl+c to kill.

Note that i have created a follow up feature request https://github.com/jesseward/plex-lastfm-scrobbler/issues/17 that will help automate things.

seanfilidis commented 9 years ago

IT WORKS!

I shut down Plex Server, deleted the Plex Server log and the PLS log, and then started both up again. I was hoping just to get better log information, but to my surprise, I don't need to because it is scrobbling!

I think the reason it didn't work last time was because I didn't realize that the DOS prompt needs to remain open for the application to continue to run. I wonder if there is a way to keep it going in the background.

Thanks heaps for this!

seanfilidis commented 9 years ago

Added a batch script to the Windows Startup folder (just called it scrobble.bat) that contains:

python c:\Python27\scripts\plex-scrobble.py %*

That makes the script run on start up and keeps the DOS prompt window open.

seanfilidis commented 9 years ago

Looks like it has stopped working now. Worked most of the day, but at some point the scrobbles are no longer showing up in Last.fm, The DOS window is still open. I closed it and started it again, but still nothing. Weird. Plex Media Server log is still putting out lines that say ".... got played ... by account 1!" but last.fm isn't getting them.

jesseward commented 9 years ago

hey @seanfilidis great to hear that it is almost working and thanks a lot for the suggestion regarding the batch script for windows. If you're familiar with github pull process, feel free to submit a pull request and i will merge. If not I can add the script to the main repo and ensure you're given credits in the README.md file.

Regarding the current issue. If i understand this correctly, PMS is still happily playing songs and logging the "got played by" line item, but PLS it not detecting these plays, even after a restart. Feel free to pass along the PLS log.

What we should see in the PLS log is the following.

2014-10-09 23:50:20,652 [19164] [plex_scrobble.plex_monitor parse_line] [INFO] Found played song and extracted library id '26893' from plex log

The above is logged when it detects the "got played by.." line.

2014-10-09 23:50:20,653 [19164] [plex_scrobble.plex_monitor fetch_metadata] [INFO] Fetching library metadata from http://localhost:32400/library/metadata/26893

It then makes a request to the plex server to fetch metadata for song id .

2014-10-09 23:50:20,659 [19164] [plex_scrobble.lastfm scrobble] [INFO] submitting My Morning Jacket - Touch Me I'm Going To Scream Pt. 2 to last.fm.

If metadata is found, it makes the request to last.fm . Submitting the Artist and Track name.

seanfilidis commented 9 years ago

Hey. Here is a copy of the PLS log: http://pastebin.com/QHp7hym2

The last song to be registered by my Last.fm account was "Joe Bonamassa – Baby You Gotta Change Your Mind" at 13 Oct 6:23pm

I can see in the log that some kind of problem started at that point in time.

Also, within the DOS prompt window an error popped up, but since it doesn't have a timestamp, I can't say when it appeared (I always have the DOS window minimized). Here is a screenshot of the error:

knipsel

jesseward commented 9 years ago

thanks @seanfilidis the log is quite helpful . It looks like the last.fm site experienced service degredation at some point on the 13th and 14th. PLS will detect this and start caching scrobbles locally and retry at 60 minute intervals.

The problem appears to be with the following song, which has a few unicode characters, that i am not handling correctly it seems.

2014-10-14 16:08:50,742 [2664] [plex_scrobble.plex_monitor fetch_metadata] [INFO] Fetching library metadata
from http://localhost:32400/library/metadata/15828
2014-10-14 16:08:51,775 [2664] [plex_scrobble.lastfm scrobble] [INFO] submitting :50= ;L78 - ">9 45=L to
last.fm.
2014-10-14 16:08:52,706 [2664] [plex_scrobble.lastfm _do_lastfm_post] [ERROR] Unable to submit post data
http://ws.audioscrobbler.com/2.0/ - HTTP Error 503: Temp Unavailable

On your PMS machine, can you browse to the following URL http://localhost:32400/library/metadata/15828 and paste the XML output into pastebin.

jesseward commented 9 years ago

@seanfilidis , try the latest copy as well (at https://github.com/jesseward/plex-lastfm-scrobbler/archive/master.zip )

I revisited issue #9 . It looks like i missed the fix for the line of code which your error points to. I have applied the fix, it should now catch this case.

seanfilidis commented 9 years ago

Here is the XML output you asked for: http://pastebin.com/R0DBkkc0

jesseward commented 9 years ago

thanks @seanfilidis . The fix outlined above should capture this. Ensure you have downloaded the latest version and re-install.

seanfilidis commented 9 years ago

Again it has seemed to stop working. It scrobbled fine last night, but this morning it is not capturing anything. Here is the relevant part of the PLS log from the last song that was successfully scrobbled lastnight till now. http://pastebin.com/ByRGqx8k

Any clues?

seanfilidis commented 9 years ago

So what I've found is that it stops working after I put the server to sleep, and then wake it up. Even though the script seems to still be running in the DOS window, it doesn't scrobble anymore. I have tried shutting down the script an restarting it, but that doesn't get it going. I have to restart the server. So sleeping and waking somehow kills it...

seanfilidis commented 9 years ago

Update... I have since upgraded to a new machine with Windows 8.1 on it. Everything works smoothly except, just like on the last machine, it simply stops scrobbling after a while of playing music, for no apparent reason. It does not have to do with putting the computer to sleep as I previously thought (I know this because I never put this computer to sleep). The script simply stops working after a while, even through it still seems to be running in the command window. The only way to make it start scrobbling is to restart the machine. Right now I am looking at my last.fm profile, and it seems to have stopped scrobbling half way through a Van Morrison album yesterday. Nothing has scrobbled since then, even though I have played lots of music in the meantime. It seems totally random.

rwa66 commented 9 years ago

I am experiencing the same problem on my Windows 2008R2 Server. Out of the blue Plex Lastfm Scrobbler stops scrobbling. The only thing that gets it going is a complete restart of the machine. It looks like it happens at random. No album change, no exotic characters, nothing i can think of. I can share the log files, but I am afraid they don't give much more info then earlier posted logs. If I can help squash this one, please let me know. I would kill for a stable scrobbler for Plex on Windows. ;)

seanfilidis commented 9 years ago

I give up. It almost never works. Only for a little bit after restarting the machine. =(

jesseward commented 9 years ago

@seanfilidis thanks for you efforts. I will update the README with more verbiage surrounding support for windows. Unfortunately i do not have a windows based development machine, and don't have enough drive at the moment to hunt one down and focus testing on Windows.

If a windows developer wants to pick this up, please do feel free, pull requests are welcomed.