You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the default canonical tree whenever a genre is unmatched _get_depth(genre) will return None, which when combined with prefer_specific will try to sort this None against a bunch of ints. For example Tycho will return this list (note (None, chillout)):
Traceback (most recent call last):
File "/Users/wpaul/.asdf/installs/python/3.6.0/bin/beet", line 11, in <module>
load_entry_point('beets==1.4.3', 'console_scripts', 'beet')()
File "/Users/wpaul/.asdf/installs/python/3.6.0/lib/python3.6/site-packages/beets/ui/__init__.py", line 1209, in main
_raw_main(args)
File "/Users/wpaul/.asdf/installs/python/3.6.0/lib/python3.6/site-packages/beets/ui/__init__.py", line 1196, in _raw_main
subcommand.func(lib, suboptions, subargs)
File "/Users/wpaul/.asdf/installs/python/3.6.0/lib/python3.6/site-packages/beetsplug/lastgenre/__init__.py", line 380, in lastgenre_func
album.genre, src = self._get_genre(album)
File "/Users/wpaul/.asdf/installs/python/3.6.0/lib/python3.6/site-packages/beetsplug/lastgenre/__init__.py", line 322, in _get_genre
result = self.fetch_album_genre(obj)
File "/Users/wpaul/.asdf/installs/python/3.6.0/lib/python3.6/site-packages/beetsplug/lastgenre/__init__.py", line 273, in fetch_album_genre
u'album', LASTFM.get_album, obj.albumartist, obj.album
File "/Users/wpaul/.asdf/installs/python/3.6.0/lib/python3.6/site-packages/beetsplug/lastgenre/__init__.py", line 265, in _last_lookup
genre = self.fetch_genre(method(*args_replaced))
File "/Users/wpaul/.asdf/installs/python/3.6.0/lib/python3.6/site-packages/beetsplug/lastgenre/__init__.py", line 228, in fetch_genre
return self._resolve_genres(self._tags_for(lastfm_obj, min_weight))
File "/Users/wpaul/.asdf/installs/python/3.6.0/lib/python3.6/site-packages/beetsplug/lastgenre/__init__.py", line 213, in _resolve_genres
tags = self._sort_by_depth(tags)
File "/Users/wpaul/.asdf/installs/python/3.6.0/lib/python3.6/site-packages/beetsplug/lastgenre/__init__.py", line 178, in _sort_by_depth
depth_tag_pairs.sort(reverse=True)
TypeError: '<' not supported between instances of 'NoneType' and 'int'
Thanks for the report and the diagnosis! I agree with your assessment of where the crash comes from.
Since you already have a good handle here on what's going wrong, is there any chance I can convince you to open a pull request? One simple fix, for example, would be to compute that list of pairs as-is and then add a second line that uses a second list comprehension to drop the Nones.
Problem
When using the default canonical tree whenever a genre is unmatched
_get_depth(genre)
will returnNone
, which when combined withprefer_specific
will try to sort this None against a bunch of ints. For example Tycho will return this list (note(None, chillout)
):My quick fix was to call _get_depth in a guard:
Obviously we shouldn't be calling this twice without memoizing.
Setup
My configuration (output of
beet config
) is:The text was updated successfully, but these errors were encountered: