Skip to content

Instantly share code, notes, and snippets.

@fanzeyi
Created March 12, 2011 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fanzeyi/867217 to your computer and use it in GitHub Desktop.
Save fanzeyi/867217 to your computer and use it in GitHub Desktop.

使用说明


首先要安装pylast库。

$ easy_install pylast

然后填写里面的用户名密码即可~

#!/usr/bin/python
# -*- coding: utf-8 -*-
''' Add Love Track via Deadbeef'''
import os
import pylast
API_KEY = "API_KEY"
API_SECRET = "API_SECRET"
USERNAME = "username"
PASSWORD = "password"
def main():
'''Main Function'''
deadbeef = os.popen("deadbeef --nowplaying \"%a-%t\"")
info = deadbeef.readline()
artist, track = info.split('-')
password_hash = pylast.md5("PASSWORD")
network = pylast.LastFMNetwork(api_key = API_KEY, api_secret =
API_SECRET, username = USERNAME, password_hash = password_hash)
last = network.get_track(artist, track)
last.love()
if __name__ == '__main__':
exit(main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment