Skip to content

Commit

Permalink
suppress more pylast errors (beetbox#349)
Browse files Browse the repository at this point in the history
  • Loading branch information
sampsyo committed Feb 27, 2012
1 parent 8fca659 commit 2d3c9d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion beetsplug/lastgenre/__init__.py
Expand Up @@ -40,14 +40,20 @@
DEFAULT_WHITELIST = os.path.join(os.path.dirname(__file__), 'genres.txt')
C14N_TREE = os.path.join(os.path.dirname(__file__), 'genres-tree.yaml')

PYLAST_EXCEPTIONS = (
pylast.WSError,
pylast.MalformedResponseError,
pylast.NetworkError,
)

def _tags_for(obj):
"""Given a pylast entity (album or track), returns a list of
tag names for that entity. Returns an empty list if the entity is
not found or another error occurs.
"""
try:
res = obj.get_top_tags()
except pylast.WSError, exc:
except PYLAST_EXCEPTIONS, exc:
log.debug(u'last.fm error: %s' % unicode(exc))
return []

Expand Down
2 changes: 2 additions & 0 deletions docs/changelog.rst
Expand Up @@ -46,6 +46,8 @@ lays the foundation for more features to come in the next couple of releases.
to monitor import progress, even when the import crashes.
* Duplicate track matches are no longer shown when autotagging singletons.
* The ``chroma`` plugin now logs errors when fingerprinting fails.
* The ``lastgenre`` plugin suppresses more errors when dealing with the Last.fm
API.
* Fix a bug in the ``rewrite`` plugin that broke the use of multiple rules for
a single field.
* Fix a crash with non-ASCII characters in bytestring metadata fields (e.g.,
Expand Down

0 comments on commit 2d3c9d9

Please sign in to comment.