Skip to content

Instantly share code, notes, and snippets.

@jesopo
jesopo / scrobble.py
Last active March 24, 2016 17:17
Python3 Plex Media Server last.fm scrobbling script, requires BeautifulSoup4 and PyLast for Python3.
#!/usr/bin/env python3
import re, select, time, urllib.request
import bs4, pylast
FILE_LOG = "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs/Plex Media Server.log"
REGEX_STARTED = re.compile("reporting timeline state playing, progress of (\d+)/\d+ms", re.I)
REGEX_RATINGKEY = re.compile("metadataId=(\d+)", re.I)
URL_PLEX = "http://localhost:32400/status/sessions"
API_KEY = "627f33b81993f32254cd60d5736fcebd"