From 0d055183bc816d9819e70f13352d32a483f6dc37 Mon Sep 17 00:00:00 2001 From: Abhinav Sarkar Date: Thu, 10 Jul 2008 16:55:05 +0000 Subject: [PATCH] added new classes --- lastfm/group.py | 42 +++++++++++++++++++++++++++++++ lastfm/playlist.py | 15 +++++++++++ lastfm/tasteometer.py | 41 ++++++++++++++++++++++++++++++ lastfm/track.py | 58 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 156 insertions(+) create mode 100644 lastfm/group.py create mode 100644 lastfm/playlist.py create mode 100644 lastfm/tasteometer.py create mode 100644 lastfm/track.py diff --git a/lastfm/group.py b/lastfm/group.py new file mode 100644 index 0000000..0edf7ff --- /dev/null +++ b/lastfm/group.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python + +__author__ = "Abhinav Sarkar" +__version__ = "0.1" +__license__ = "GNU Lesser General Public License" + +class Group(object): + """A class representing a group on last.fm.""" + def __init__(self, + api, + name = None): + self.__api = api + self.__name = name + + def getName(self): + return self.__name + + name = property(getName, None, None, "Name's Docstring") + + def getWeeklyChartList(self): + pass + + def getWeeklyAlbumChart(self, + start = None, + end = None): + pass + + weeklyAlbumChart = property(getWeeklyAlbumChart, None, None, "Docstring") + + def getWeeklyArtistChart(self, + start = None, + end = None): + pass + + weeklyArtistChart = property(getWeeklyArtistChart, None, None, "Docstring") + + def getWeeklyTrackChart(self, + start = None, + end = None): + pass + + weeklyTrackChart = property(getWeeklyTrackChart, None, None, "Docstring") \ No newline at end of file diff --git a/lastfm/playlist.py b/lastfm/playlist.py new file mode 100644 index 0000000..9278a61 --- /dev/null +++ b/lastfm/playlist.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +__author__ = "Abhinav Sarkar" +__version__ = "0.1" +__license__ = "GNU Lesser General Public License" + +class Playlist(str): + """A class representing an XPSF playlist.""" + def __init__(self, xpsfData): + self = xpsfData + + @staticmethod + def fetch(api, playlistUrl): + params = {'method': 'playlist.fetch'} + return Playlist(api.fetchData(params, parse = False)) \ No newline at end of file diff --git a/lastfm/tasteometer.py b/lastfm/tasteometer.py new file mode 100644 index 0000000..51715de --- /dev/null +++ b/lastfm/tasteometer.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +__author__ = "Abhinav Sarkar" +__version__ = "0.1" +__license__ = "GNU Lesser General Public License" + +class Tasteometer(object): + """A class representing a tasteometer.""" + def __init__(self, + score = None, + matches = None, + artists = None): + self.__score = score + self.__matches = matches + self.__artists = artists + + def getScore(self): + return self.__score + + def getMatches(self): + return self.__matches + + def getArtists(self): + return self.__artists + + score = property(getScore, None, None, "Score's Docstring") + + matches = property(getMatches, None, None, "Matches's Docstring") + + artists = property(getArtists, None, None, "Artists's Docstring") + + @staticmethod + def compare(api, + type1, type2, + value1, value2, + limit = None): + pass + +from artist import Artist +from error import LastfmError + \ No newline at end of file diff --git a/lastfm/track.py b/lastfm/track.py new file mode 100644 index 0000000..3c5e4ce --- /dev/null +++ b/lastfm/track.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python + +__author__ = "Abhinav Sarkar" +__version__ = "0.1" +__license__ = "GNU Lesser General Public License" + +class Track(object): + """A class representing a track.""" + def __init__(self, + name = None, + mbid = None, + url = None, + streamable = None, + artist = None, + image = None, + match = None): + self.__name = name + self.__mbid = mbid + self.__url = url + self.__streamable = streamable + self.__artist = artist + self.__image = image + self.__match = match + + def getName(self): + return self.__name + + def getMbid(self): + return self.__mbid + + def getUrl(self): + return self.__url + + def getStreamable(self): + return self.__streamable + + def getArtist(self): + return self.__artist + + def getImage(self): + return self.__image + + def getMatch(self): + return self.__match + + name = property(getName, None, None, "Name's Docstring") + + mbid = property(getMbid, None, None, "Mbid's Docstring") + + url = property(getUrl, None, None, "Url's Docstring") + + streamable = property(getStreamable, None, None, "Streamable's Docstring") + + artist = property(getArtist, None, None, "Artist's Docstring") + + image = property(getImage, None, None, "Image's Docstring") + + match = property(getMatch, None, None, "Match's Docstring") \ No newline at end of file