2008-07-17 22:17:32 +05:30
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2008-08-25 17:14:48 +05:30
|
|
|
__author__ = "Abhinav Sarkar <abhinav@abhinavsarkar.net>"
|
2008-09-02 22:06:16 +05:30
|
|
|
__version__ = "0.2"
|
2008-07-17 22:17:32 +05:30
|
|
|
__license__ = "GNU Lesser General Public License"
|
2009-03-17 20:51:40 +05:30
|
|
|
__package__ = "lastfm"
|
2008-07-17 22:17:32 +05:30
|
|
|
|
2009-04-18 10:41:22 +05:30
|
|
|
from lastfm.base import LastfmBase
|
|
|
|
from lastfm.mixin import mixin
|
|
|
|
|
|
|
|
@mixin("property_adder")
|
|
|
|
class Stats(LastfmBase):
|
2008-07-17 22:17:32 +05:30
|
|
|
"""A class representing the stats of an artist."""
|
2009-04-18 10:41:22 +05:30
|
|
|
|
|
|
|
class Meta(object):
|
|
|
|
properties = ["listeners", "playcount",
|
|
|
|
"tagcount", "count", "match", "rank",
|
|
|
|
"weight", "attendance", "reviews"]
|
|
|
|
|
|
|
|
def __init__(self, subject, **kwargs):
|
2008-12-30 19:21:04 +05:30
|
|
|
self._subject = subject
|
2009-04-18 10:41:22 +05:30
|
|
|
super(Stats, self).init(**kwargs)
|
2008-07-17 22:17:32 +05:30
|
|
|
|
2008-07-31 16:04:46 +05:30
|
|
|
@property
|
|
|
|
def subject(self):
|
|
|
|
"""subject of the stats"""
|
2008-12-30 19:21:04 +05:30
|
|
|
return self._subject
|
2008-07-17 22:17:32 +05:30
|
|
|
|
|
|
|
def __repr__(self):
|
2009-01-03 21:18:44 +05:30
|
|
|
if hasattr(self._subject, 'name'):
|
|
|
|
return "<lastfm.Stats: for '%s'>" % self._subject.name
|
|
|
|
else:
|
|
|
|
return "<lastfm.Stats: for '%s'>" % self._subject
|
2008-07-17 22:17:32 +05:30
|
|
|
|