mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-04-28 14:01:04 -05:00
LastFM: begin migrating 'lastfm' to API version 2 (still very broken right now)
This commit is contained in:
parent
c0d4b55633
commit
c8823ab66f
18
plugin.py
18
plugin.py
@ -108,14 +108,24 @@ class LastFM(callbacks.Plugin):
|
||||
"config plugins.lastfm.apikey and reload the plugin. "
|
||||
"You can sign up for an API Key using "
|
||||
"http://www.last.fm/api/account/create", Raise=True)
|
||||
|
||||
method = method.lower()
|
||||
knownMethods = {'friends': 'user.getFriends',
|
||||
'neighbours': 'user.getNeighbours',
|
||||
'profile': 'user.getInfo',
|
||||
'recenttracks': 'user.getRecentTracks',
|
||||
'tags': 'user.getTopTags',
|
||||
'topalbums': 'user.getTopAlbums',
|
||||
'topartists': 'user.getTopArtists',
|
||||
'toptracks': 'user.getTopTracks'}
|
||||
if method not in knownMethods:
|
||||
irc.error("Unsupported method '%s'" % method, Raise=True)
|
||||
id = (optionalId or self.db.getId(msg.nick) or msg.nick)
|
||||
channel = msg.args[0]
|
||||
maxResults = self.registryValue("maxResults", channel)
|
||||
method = method.lower()
|
||||
|
||||
url = "%s/%s/%s.txt" % (self.APIURL_1_0, id, method)
|
||||
# url = "%sapi_key=%s&method=%s&user=%s" % (self.APIURL_2_0, self.apiKey, method, id)
|
||||
# url = "%s/%s/%s.txt" % (self.APIURL_1_0, id, method)
|
||||
url = "%sapi_key=%s&method=%s&user=%s" % (self.APIURL_2_0,
|
||||
self.apiKey, knownMethods[method], id)
|
||||
try:
|
||||
f = utils.web.getUrlFd(url)
|
||||
except utils.web.Error:
|
||||
|
Loading…
x
Reference in New Issue
Block a user