This commit is contained in:
Abhinav Sarkar 2008-07-10 16:53:43 +00:00
parent c04282b261
commit 2ddd3f320b
6 changed files with 60 additions and 8 deletions

View File

@ -126,6 +126,5 @@ from datetime import datetime
import time
from error import LastfmError
from api import Api
from tag import Tag
from artist import Artist

View File

@ -149,6 +149,27 @@ class Api(object):
def getGroup(self, name):
return Group(self, name)
def fetchPlaylist(self, playlistUrl):
return Playlist(self, playlistUrl)
def getTag(self, name):
return Tag(self, name)
def getGlobalTopTags(self):
return Tag.getTopTags(self)
def searchTag(self,
tag,
limit = None,
page = None):
return Tag.search(self, tag, limit, page)
def compareTaste(self,
type1, type2,
value1, value2,
limit = None):
return Tasteometer(self, type1, type2, value1, value2, limit)
def _fetchUrl(self,
url,
@ -197,14 +218,17 @@ class Api(object):
# Always return the latest version
return url_data
def fetchData(self, params):
def fetchData(self, params, parse = True):
params.update({'api_key': self.__apiKey})
xml = self._fetchUrl(Api.API_ROOT_URL, params)
data = ElementTree.XML(xml)
if data.get('status') != "ok":
raise LastfmError("Error code: %s (%s)" % (data.find("error").get('code'), data.findtext('error')))
return data
if parse:
return data
else:
return xml
import urllib
import urllib2
@ -225,6 +249,8 @@ from artist import Artist
from event import Event
from geo import Location, Country
from group import Group
#from tag import Tag
from playlist import Playlist
from tag import Tag
from tasteometer import Tasteometer
#from track import Track
#from user import User

View File

@ -220,5 +220,4 @@ import time
import types
from error import LastfmError
from api import Api
from tag import Tag

View File

@ -148,6 +148,5 @@ class Event(object):
from datetime import datetime
import time
from api import Api
from artist import Artist
from geo import Venue, Location, Country

View File

@ -150,4 +150,7 @@ class Country(object):
None, None, "Docstring")
def __eq__(self, other):
return self.name == other.name
return self.name == other.name
from artist import Artist
from track import Track

View File

@ -23,4 +23,30 @@ class Tag(object):
name = property(getName, None, None, "Name's Docstring")
url = property(getUrl, None, None, "Url's Docstring")
def getSimilar(self):
pass
def getTopAlbums(self):
pass
def getTopArtists(self):
pass
def getTopTracks(self):
pass
@staticmethod
def getTopTags(api):
pass
@staticmethod
def search(api,
tag,
limit = None,
page = None):
pass
from album import Album
from artist import Artist
from track import Track