Skip to content

Instantly share code, notes, and snippets.

@pale2hall
Created February 16, 2015 23:32
Show Gist options
  • Save pale2hall/cb542f213a08b08ad011 to your computer and use it in GitHub Desktop.
Save pale2hall/cb542f213a08b08ad011 to your computer and use it in GitHub Desktop.
Post Last.FM Recent Tracks Scrobbled to Hall.com's integration API
#pip install feedparser
#pip install python_hall
from python_hall import Hall
import time
import feedparser
lastfmUsername = "pale2hall" # your last.fm Username
timeDelay = 60 #don't be a jerk. Keep this relatively high; Your songs aren't that short!
h = Hall('f011-----YOUR-HALL-TOKEN-----5f56') # from https://hall.com/docs/integrations/generic/
h.add_image('http://i.imgur.com/aF61IE9.gif')
lastTrack = ""
while True:
feed = feedparser.parse( "http://ws.audioscrobbler.com/2.0/user/" + lastfmUsername + "/recenttracks.rss" )
track = feed.entries[0]['title']
if track != lastTrack:
lastTrack = feed.entries[0]['title']
lastURL = feed.entries[0]['link']
h.send(title=lastTrack, message='Scrobbled by <a href="http://www.last.fm/user/' + lastfmUsername + '">' + lastfmUsername + '</a>. Check out this artist\'s page on <a href="' + lastURL + '">Last.FM</a>.')
time.sleep(timeDelay)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment