X-Git-Url: https://git.kaliko.me/?a=blobdiff_plain;f=sima%2Flib%2Fsimaecho.py;h=393d723f62e216d7a6027d02c33a363b5f9a2d40;hb=251934a89e7796fb21bb223c4ae04d757082a89b;hp=cfae27c675530b086a322c61b08fe85cbae7b945;hpb=75611a590e62f82a6f2651ac176ff619052eaa89;p=mpd-sima.git diff --git a/sima/lib/simaecho.py b/sima/lib/simaecho.py index cfae27c..393d723 100644 --- a/sima/lib/simaecho.py +++ b/sima/lib/simaecho.py @@ -50,6 +50,10 @@ class SimaEch: root_url = 'http://{host}/api/{version}'.format(**ECH) name = 'EchoNest' cache = False + """HTTP cache to use, in memory or persitent. + + :param BaseCache cache: Set a cache, defaults to `False`. + """ stats = {'etag':0, 'ccontrol':0, 'minrl':120, @@ -94,8 +98,11 @@ class SimaEch: # return a sorted list of 2-tuple to have consistent cache return sorted(payload.items(), key=lambda param: param[0]) - def get_similar(self, artist=None): + def get_similar(self, artist): """Fetch similar artists + + :param sima.lib.meta.Artist artist: `Artist` to fetch similar artists from + :returns: generator of :class:`sima.lib.meta.Artist` """ payload = self._forge_payload(artist) # Construct URL @@ -106,8 +113,11 @@ class SimaEch: mbid = get_mbid(art) yield Artist(mbid=mbid, name=art.get('name')) - def get_toptrack(self, artist=None): + def get_toptrack(self, artist): """Fetch artist top tracks + + :param sima.lib.meta.Artist artist: `Artist` to fetch top tracks from + :returns: generator of :class:`sima.lib.track.Track` """ payload = self._forge_payload(artist, top=True) # Construct URL