From 279a3160534cad04c64c0d0b17f437c08ebb2703 Mon Sep 17 00:00:00 2001 From: kaliko Date: Sun, 9 Feb 2014 16:52:06 +0100 Subject: [PATCH] Converging webservices plugins --- sima/plugins/internal/echonest.py | 7 ++----- sima/plugins/internal/lastfm.py | 10 +++------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/sima/plugins/internal/echonest.py b/sima/plugins/internal/echonest.py index 4cd2f1d..a5c1ede 100644 --- a/sima/plugins/internal/echonest.py +++ b/sima/plugins/internal/echonest.py @@ -13,7 +13,7 @@ from hashlib import md5 # local import from ...lib.plugin import Plugin -from ...lib.simaecho import SimaEch, EchoError, EchoNotFound +from ...lib.simaecho import SimaEch, EchoError from ...lib.track import Track from ...lib.meta import Artist @@ -182,13 +182,10 @@ class EchoNest(Plugin): try: # TODO: let's propagate Artist type [as_art.append(str(art)) for art in as_artists] - except EchoNotFound as err: - self.log.warning(err) except EchoError as err: self.log.warning('EchoNest: {0}'.format(err)) if as_art: - self.log.debug('Fetched {0} artist(s) from echonest'.format( - len(as_art))) + self.log.debug('Fetched {0} artist(s)'.format(len(as_art))) self.log.debug('x-ratelimit-remaining: {}'.format(SimaEch.ratelimit)) return as_art diff --git a/sima/plugins/internal/lastfm.py b/sima/plugins/internal/lastfm.py index 0cb3532..9ca859f 100644 --- a/sima/plugins/internal/lastfm.py +++ b/sima/plugins/internal/lastfm.py @@ -13,7 +13,7 @@ from hashlib import md5 # local import from ...lib.plugin import Plugin -from ...lib.simafm import SimaFM, WSHTTPError, WSNotFound, WSError +from ...lib.simafm import SimaFM, WSError from ...lib.track import Track from ...lib.meta import Artist @@ -186,14 +186,10 @@ class Lastfm(Plugin): try: # TODO: let's propagate Artist type [as_art.append((str(a), m)) for a, m in as_artists] - except WSHTTPError as err: - self.log.warning('last.fm http error: %s' % err) - except WSNotFound as err: - self.log.warning("last.fm: %s" % err) except WSError as err: - self.log.warning('last.fm module error: %s' % err) + self.log.warning('Last.fm: {0}'.format(err)) if as_art: - self.log.debug('Fetched %d artist(s) from last.fm' % len(as_art)) + self.log.debug('Fetched {0} artist(s)'.format(len(as_art))) return as_art def get_recursive_similar_artist(self): -- 2.39.5