mirror of
https://github.com/beetbox/beets.git
synced 2026-01-09 09:22:55 +01:00
Isolate bugs in pylast
Should fix crashes like this: http://hastebin.com/nizusukuli.log
This commit is contained in:
parent
736eab412c
commit
f6df14a798
2 changed files with 15 additions and 7 deletions
|
|
@ -26,6 +26,7 @@ https://gist.github.com/1241307
|
|||
import pylast
|
||||
import os
|
||||
import yaml
|
||||
import traceback
|
||||
|
||||
from beets import plugins
|
||||
from beets import ui
|
||||
|
|
@ -391,17 +392,22 @@ class LastGenrePlugin(plugins.BeetsPlugin):
|
|||
|
||||
If `min_weight` is specified, tags are filtered by weight.
|
||||
"""
|
||||
# Work around an inconsistency in pylast where
|
||||
# Album.get_top_tags() does not return TopItem instances.
|
||||
# https://code.google.com/p/pylast/issues/detail?id=85
|
||||
if isinstance(obj, pylast.Album):
|
||||
obj = super(pylast.Album, obj)
|
||||
|
||||
try:
|
||||
# Work around an inconsistency in pylast where
|
||||
# Album.get_top_tags() does not return TopItem instances.
|
||||
# https://code.google.com/p/pylast/issues/detail?id=85
|
||||
if isinstance(obj, pylast.Album):
|
||||
res = super(pylast.Album, obj).get_top_tags()
|
||||
else:
|
||||
res = obj.get_top_tags()
|
||||
res = obj.get_top_tags()
|
||||
except PYLAST_EXCEPTIONS as exc:
|
||||
self._log.debug(u'last.fm error: {0}', exc)
|
||||
return []
|
||||
except Exception as exc:
|
||||
# Isolate bugs in pylast.
|
||||
self._log.debug(traceback.format_exc())
|
||||
self._log.error('error in pylast library: {0}', exc)
|
||||
return []
|
||||
|
||||
# Filter by weight (optionally).
|
||||
if min_weight:
|
||||
|
|
|
|||
|
|
@ -123,6 +123,8 @@ Fixes:
|
|||
Unicode filenames. :bug:`1297`
|
||||
* :doc:`/plugins/discogs`: Handle and log more kinds of communication
|
||||
errors. :bug:`1299` :bug:`1305`
|
||||
* :doc:`/plugins/lastgenre`: Bugs in the `pylast` library can no longer crash
|
||||
beets.
|
||||
|
||||
For developers:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue