plex-lastfm-scrobble - Scrobble Plex audio tracks to Last.fm
plex-lastfm-scrobbler -
https://github.com/jesseward/plex-lastfm-scrobbler
plex-lastfm-scrobbler provides a set of scripts that allow you to scrobble played audio items to Last.FM from the Plex Media Server application. plex-lastfm-scrobbler was built to run across platforms, while it has not yet been tested on Windows, it should work.
A few points
- Uses python standard library. Python is the only requirement to run this application
- Must be run on the Plex Media Server
- Parses Plex Media Server logs for the 'got played' string in the log file.
- Does not differentiate between clients. Meaning all media played, will be scrobbled while the script is running.
- Your plex-media-server logs must be set at DEBUG level (not VERBOSE)
Installation
Version 0.0.1
It is recommended (but not required) that you install this into a virtualenvironment.
virtualenv ~/.virtualenvs/plex-lastfm-scrobber
source ~/.virtualenvs/plex-lastfm-scrobber/bin/activate
Fetch and install the source from the github repo.
git clone git@github.com:jesseward/plex-lastfm-scrobbler.git cd plex-lastfm-scrobbler python setup.py install
You're done.
Configuration
The plex-lastfm-scrobbler configuration file (plex_scrobble.conf) is installed to ~/.config/plex-lastfm-scrobbler/ . The following configuration values are available.
If you're running Plex Media Server on a Linux based operating system, things should work out of the box.
# REQUIRED: mediaserver_url is the location of the http service exposed by Plex Media Server # the default values should be 'ok', assuming you're running the plex scrobble # script from the same server as your plex media server mediaserver_url = 'http://localhost:32400' # REQUIRED: mediaserver_log_location references the log file location of the plex media server # the default under /var/lib/... is the default install of plex media server on # a Linux system. You may wish to change this value to reference your OS install. mediaserver_log_location = '/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs/Plex Media Server.log' # REQUIRED: Where do you wish to write the plex-scrobble log file. log_file = /tmp/plex_scrobble.log
Running
If you installed plex-lastfm-scrobble to a virtual environment, enable the virtual env.
source ~/.virtualenvs/plex-lastfm-scrobber/bin/activate
run the application
$ plex-scrobble.py
On first run you will be prompted to authenticate and grant access to your Last.fm account. Visit the URL generated by plex-scrobble and follow the prompts to grant access to the application.
Example.
$ plex-scrobble.py == Requesting last.fm auth == Please accept authorization at http://www.last.fm/api/auth/?api_key=blunted_dummies-house-for-all-1991 Have you authorized me [y/N] : y Please relaunch plex-scrobble service.
Once this is complete, please re-start the service, listen to audio via Plex and watch as your music is scrobbled. You may wish to leave the service running in the background. On a POSIX system, wrap the script in the no-hangup utility.
$ nohup plex-scrobble.py &
Troubleshooting
- If you're experiencing authentication issues (appearing in plex_scrobble.log), remove the ~/.config/plex-lastfm-scrobbler/session file. This stores your Last.FM authentication token. There is no harm in removing/recreating this as many times as needed.
- Log an issue https://github.com/jesseward/plex-lastfm-scrobbler/issues/new
Contributing
Any feedback on the performance on a MS Windows installation would be appreciated. I do not have ability to test plex-lastfm-scrobbler on this platform. Please log an issue or a pull request with any fixes.
Comments
Thanks for working on this. Been dying for last.fm scrobbling for a long time!
Sadly I have no clue how I might try to install this on my Windows7 Plex server.
I downloaded and installed Python for Windows from python.org, then I downloaded your zip from github. I tried extracting it to my hard drive and running those commands in the DOS prompt, but it doesn't recognize the commands. Obviously I'm not doing it right. Any tips?
Thanks.
great job!
but to keep it updated, can you please ask the author of the Unsupported Appstore to implement this Plugin? Thank you! And keep on
PMS: Ubuntu Server, i7 4770T, 120GB SSD, 5x5 3TB HDD, DigitalDevices DVB-C
PMC: 4x Mac OS - 3x iOS - 2x Android (buggy) - 2x Ubuntu (not working) - 4x Samsung-SmartTV (not working) - 2x RasPlex
When I do the 'python setup.py install' I get the message "python is not recognised as an internal or external command operable program or batch file."
Thanks for your help.
EDIT: sorry I needed to restart for that to work.
Hello again,
I ran python plex-scrobble.py from the dos prompt but nothing happened, I didnt get the expected prompt to authenticate my last.fm account.
EDIT: Sorry, I have created an 'issue' using your github link.
It seems that (at least for me) I had to type:
Instead of
For it to work. I was getting a 'Permission denied (Publickey)' error. Got it working now with the first command.
hey thanks for this. Not sure how that crept in there. The README.md on github appears correct.
I have fixed a few bugs and added some features since this initial post. Latest version can be found @ https://github.com/jesseward/plex-lastfm-scrobbler
It will probably work MUCH better for most people if you clone using HTTPS instead of SSH/GIT:
Replace this:
With this:
Not everyone is a developer and has github SSH-keys
thanks. I have updated the docs and also fixed a bug with regards to unicode artist/song names.
Is there a user-friendly way to install this yet without any coding or developer knowledge?
Can you help me fix it?
thanks
@ seanfilidis: Yeah, in comparison to to the original config file it seems that you messed up the syntax of your entries...for example backslash instead of slash or using '' if necessary. That's probably why the script couldn't successfully parse your config. Sorry that I can't give you more specifics since I'm not used to Python or the used code itself.
@ s-jw: Thanks for your work! I was always looking for a server based solution to scrobble my music with Plex.
But I'm on a Synology NAS and have some trouble with the config file too. It doesn't matter what I enter for the location of the PMS log file (should be /volume1/Plex/Library/Application Support/Plex Media Server/Logs/Plex Media Server.log). The script always falls back to the Linux default path (/var/lib/plexmediaserver/...). I tried to alter your code a little bit but it still falls back to the default value. I am not really familiar with Linux or Python so maybe I am doing something more or less obvioulsy wrong. Any help would be appreciated.
The plex-lastfm-scrobble log always says:
Servers:
Clients:
Would there be any way to modify this script to support scrobbling to multiple last.fm users, based on source IP or username?
@ seanfilidis - will continue discussion within the github ticket -> https://github.com/jesseward/plex-lastfm-scrobbler/issues/16.
@b4th - i added some additional debug information, could you download and install a new build at https://github.com/jesseward/plex-lastfm-scrobbler/archive/master.zip and reinstall. Start it up and pass along the log output as you have done here. Please also dump your config in http://pastebin.com/ .
thanks for the bug reports ;-)
Thanks for the suggestion. I will determine if this is possible and track progress in https://github.com/jesseward/plex-lastfm-scrobbler/issues/18
Hey, thanks for the immediate reply! I just got time to try it out, sorry.
The config for the version you put on was working right off the box.
But after starting the script, nothing else seems to happen. I played some songs and checked if the "got played" entry was created correctly in the PMS log (it did).
Here are the entries for the last two sessions, since the first run mentioned a "Possible log file rotation":
config:
http://pastebin.com/rU3SCs0X (I only changed the log file path)
Servers:
Clients:
config looks good. I have posted an updated version that captures some unicode issues as well as enables additional logging data. Install from https://github.com/jesseward/plex-lastfm-scrobbler/archive/master.zip .
Please let it run , then your log output again. thanks!
Hey,
ok, I installed the new version and gave it a try.
But the log looks pretty identical to the previous one. And the scrobbling didn't seem to work either :-/
Should it also write all scrobbled songs in the log? I mean if it would be working here.
I just checked some other things, that I could think of.
Sorry, that it didn't bring up anything new :mellow:
Servers:
Clients:
Maybe this helps:
https://github.com/jesseward/plex-lastfm-scrobbler/issues/24
Hey, thanks for pointing to your bug report...I didn't realize that there should have been a new "-p option".
I was alreadey wondering why no new options showed up after the reinstall.
So it seems that I still downloaded the wrong/old version last time.
After doing the whole procedure again, it's working like a charm now ^_^
Servers:
Clients: