2008-07-16 18:36:42 +05:30
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2008-08-25 17:14:48 +05:30
|
|
|
__author__ = "Abhinav Sarkar <abhinav@abhinavsarkar.net>"
|
2008-07-16 18:36:42 +05:30
|
|
|
__version__ = "0.1"
|
|
|
|
__license__ = "GNU Lesser General Public License"
|
|
|
|
|
|
|
|
from album import Album
|
|
|
|
from artist import Artist
|
2008-08-18 18:49:41 +05:30
|
|
|
from base import LastfmBase
|
|
|
|
from error import LastfmError
|
2008-07-16 18:36:42 +05:30
|
|
|
from event import Event
|
|
|
|
from geo import Location, Country
|
|
|
|
from group import Group
|
|
|
|
from playlist import Playlist
|
|
|
|
from tag import Tag
|
|
|
|
from track import Track
|
|
|
|
from user import User
|
2008-08-27 19:03:00 +05:30
|
|
|
from weeklychart import WeeklyAlbumChart, WeeklyArtistChart, WeeklyTrackChart
|
2008-07-16 18:36:42 +05:30
|
|
|
|
2008-07-17 16:51:01 +05:30
|
|
|
class Registry(object):
|
2008-07-16 18:36:42 +05:30
|
|
|
"""The registry to contain all the entities"""
|
|
|
|
keys = [Album, Artist, Event, Location, Country, Group,
|
2008-08-27 19:03:00 +05:30
|
|
|
Playlist, Tag, Track, User, WeeklyAlbumChart, WeeklyArtistChart, WeeklyTrackChart]
|
2008-07-16 18:36:42 +05:30
|
|
|
|
|
|
|
def get(self, name):
|
|
|
|
if name not in Registry.keys:
|
|
|
|
raise LastfmError("Key does not correspond to a valid class")
|
|
|
|
else:
|
|
|
|
try:
|
|
|
|
vals = LastfmBase.registry[name].values()
|
|
|
|
vals.sort()
|
|
|
|
return vals
|
|
|
|
except KeyError:
|
|
|
|
return []
|
|
|
|
|
2008-07-17 16:51:01 +05:30
|
|
|
def __repr__(self):
|
|
|
|
return "<lastfm.Registry>"
|