Friday, October 4, 2013

Scroble with python / scroble.py

#!/usr/bin/env python
"""
usage 
python scroble.py <artist> <song> <timestamp>
"""
 
import sys
import time
import pylast
 
API_KEY = "api-key";
API_SECRET = "api-secret"
USERNAME = "lastfm-username"
PASSWORD = "lastfm-password"
 
 
 
 
def main(): 
  artist = sys.argv[1] 
  title = sys.argv[2]
  song_started = sys.argv[3]
  network = pylast.LastFMNetwork(api_key = API_KEY, api_secret = API_SECRET, username = USERNAME, password_hash = pylast.md5(PASSWORD))
  network.scrobble(artist = artist, title = title, timestamp = song_started)
 
if __name__ == "__main__":
  main()

#https://gist.github.com/hasantayyar/6826107

No comments: