Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lastgenre fails during a full library run #2525

Closed
yacoob opened this issue Apr 22, 2017 · 7 comments
Closed

lastgenre fails during a full library run #2525

yacoob opened this issue Apr 22, 2017 · 7 comments
Labels
needinfo We need more details or follow-up from the filer before this can be tagged "bug" or "feature."

Comments

@yacoob
Copy link
Contributor

yacoob commented Apr 22, 2017

Simple run of beet lastgenre seems to fail before any genre is being fetched.

$ beet -vv lastgenre
user configuration: /home/yacoob/.config/beets/config.yaml
data directory: /home/yacoob/.config/beets
plugin paths:
Sending event: pluginload
inline: adding item field multidisc
lyrics: Disabling google source: no API key configured.
library database: /home/yacoob/.beetsdb
library directory: /mnt/lcl/geofront/worek/beets
Sending event: library_opened
Traceback (most recent call last):
  File "/home/yacoob/bin/beet", line 9, in <module>
    load_entry_point('beets==1.4.3', 'console_scripts', 'beet')()
  File "/home/yacoob/.venvs/beets/lib/python3.4/site-packages/beets/ui/__init__.py", line 1209, in main
    _raw_main(args)
  File "/home/yacoob/.venvs/beets/lib/python3.4/site-packages/beets/ui/__init__.py", line 1196, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/home/yacoob/.venvs/beets/lib/python3.4/site-packages/beetsplug/lastgenre/__init__.py", line 379, in lastgenre_func
    album.genre, src = self._get_genre(album)
  File "/home/yacoob/.venvs/beets/lib/python3.4/site-packages/beetsplug/lastgenre/__init__.py", line 321, in _get_genre
    result = self.fetch_album_genre(obj)
  File "/home/yacoob/.venvs/beets/lib/python3.4/site-packages/beetsplug/lastgenre/__init__.py", line 272, in fetch_album_genre
    u'album', LASTFM.get_album, obj.albumartist, obj.album
  File "/home/yacoob/.venvs/beets/lib/python3.4/site-packages/beetsplug/lastgenre/__init__.py", line 264, in _last_lookup
    genre = self.fetch_genre(method(*args_replaced))
  File "/home/yacoob/.venvs/beets/lib/python3.4/site-packages/beetsplug/lastgenre/__init__.py", line 227, in fetch_genre
    return self._resolve_genres(self._tags_for(lastfm_obj, min_weight))
  File "/home/yacoob/.venvs/beets/lib/python3.4/site-packages/beetsplug/lastgenre/__init__.py", line 212, in _resolve_genres
    tags = self._sort_by_depth(tags)
  File "/home/yacoob/.venvs/beets/lib/python3.4/site-packages/beetsplug/lastgenre/__init__.py", line 177, in _sort_by_depth
    depth_tag_pairs.sort(reverse=True)
TypeError: unorderable types: NoneType() < int()

I believe the plugin has been otherwise working during importing of files, as I see genres set in the library, and they're different from what the files came with. An attempt to fetch genres for the whole library, however, fails as described above.

Setup

  • OS: Debian 8.7, running on top of 3.16.0-4-amd64 Finally started to get somewhere :-) #1 SMP Debian 3.16.39-1 (2016-12-30) x86_64 GNU/Linux
  • Python version: 3.4.2
  • beets version: 1.4.3
  • Turning off plugins made problem go away (yes/no): no, it fails the same way with plugins: lastgenre alone.

My configuration (output of beet config) is:

lyrics:
    bing_lang_from: []
    google_engine_ID: REDACTED
    force: no
    genius_api_key: REDACTED
    bing_client_secret: REDACTED
    bing_lang_to:
    sources:
    - google
    - lyricwiki
    - lyrics.com
    - musixmatch
    google_API_key: REDACTED
    auto: yes
    fallback:

import:
    copy: yes
    write: yes
    resume: yes
    languages: en
library: ~/.beetsdb
directory: /mnt/lcl/geofront/worek/beets
metasync:
    source: itunes
    itunes:
        library: /home/yacoob/workarea/itunes.xml
lastgenre:
    prefer_specific: yes
    canonical: yes
    separator: ', '
    source: album
    whitelist: yes
    min_weight: 10
    count: 1
    auto: yes
    force: yes
    fallback:
per_disc_numbering: yes
original_date: yes
chroma:
    auto: no
id3v23: yes

plugins: mbsync fetchart metasync duplicates missing scrub embedart lyrics lastgenre discogs web info inline
fetchart:
    cautious: yes
    cover_names: front covert art
    fanarttv_key: REDACTED
    enforce_ratio: no
    google_engine: 001442825323518660753:hrh5ch1gjzm
    sources:
    - filesystem
    - coverart
    - itunes
    - amazon
    - albumart
    minwidth: 0
    auto: yes
    maxwidth: 0
    google_key: REDACTED
    store_source: no

paths:
    default: $albumartist/$album%aunique{}/%if{$multidisc,$disc-}$track $title
    comp: Compilations/$album%aunique{}/%if{$multidisc,$disc-}$track $title
item_fields:
    multidisc: 1 if disctotal > 1 else 0

match:
    strong_rec_thresh: 0.1
    preferred:
        countries: [US, GB|UK]
        media: [CD, Digital Media|File]
        original_year: yes
discogs:
    tokenfile: discogs_token.json
    apikey: REDACTED
    apisecret: REDACTED
    source_weight: 0.5
missing:
    count: no
    total: no
embedart:
    ifempty: no
    remove_art_file: no
    auto: yes
    maxwidth: 0
    compare_threshold: 0
    source: itunes
    itunes:
        library: /home/yacoob/workarea/itunes.xml
lastgenre:
    prefer_specific: yes
    canonical: yes
    separator: ', '
    source: album
    whitelist: yes
    min_weight: 10
    count: 1
    auto: yes
    force: yes
    fallback:
per_disc_numbering: yes
original_date: yes
chroma:
    auto: no
id3v23: yes

plugins: mbsync fetchart metasync duplicates missing scrub embedart lyrics lastgenre discogs web info inline
fetchart:
    cautious: yes
    cover_names: front covert art
    fanarttv_key: REDACTED
    enforce_ratio: no
    google_engine: 001442825323518660753:hrh5ch1gjzm
    sources:
    - filesystem
    - coverart
    - itunes
    - amazon
    - albumart
    minwidth: 0
    auto: yes
    maxwidth: 0
    google_key: REDACTED
    store_source: no

paths:
    default: $albumartist/$album%aunique{}/%if{$multidisc,$disc-}$track $title
    comp: Compilations/$album%aunique{}/%if{$multidisc,$disc-}$track $title
item_fields:
    multidisc: 1 if disctotal > 1 else 0

match:
    strong_rec_thresh: 0.1
    preferred:
        countries: [US, GB|UK]
        media: [CD, Digital Media|File]
        original_year: yes
discogs:
    tokenfile: discogs_token.json
    apikey: REDACTED
    apisecret: REDACTED
    source_weight: 0.5
missing:
    count: no
    total: no
embedart:
    ifempty: no
    remove_art_file: no
    auto: yes
    maxwidth: 0
    compare_threshold: 0
scrub:
    auto: yes
pathfields: {}
album_fields: {}
duplicates:
    keys: []
    copy: ''
    move: ''
    checksum: ''
    count: no
    path: no
    delete: no
    full: no
    album: no
    strict: no
    tag: ''
    merge: no
    format: ''
    tiebreak: {}
web:
    cors: ''
    host: 127.0.0.1
    port: 8337

Please tell me if you need any more information from me.

@yacoob
Copy link
Contributor Author

yacoob commented Apr 22, 2017

Correction: this particular failure (exact stack trace) appears now during import as well. This probably means that the problem has been triggered by some db change, as I haven't updated beets in the meantime.

@sampsyo sampsyo added the needinfo We need more details or follow-up from the filer before this can be tagged "bug" or "feature." label Apr 23, 2017
@sampsyo
Copy link
Member

sampsyo commented Apr 23, 2017

Yikes; looks like trouble. To help narrow this down, would you mind trying this out while disabling some of your lastgenre config options (e.g., prefer_specific and fallback)? That might help us understand whether a specific option is causing the crash.

@yacoob
Copy link
Contributor Author

yacoob commented Apr 23, 2017

Your intuition was correct: this failure only happens if I set canonical: true. And come to think of it, I did switch that option on last night, just didn't connect the dots straight away.

@sampsyo
Copy link
Member

sampsyo commented Apr 23, 2017

OK, that helps! I can't reproduce the crash here just with canonical though—if I can ask you to do a little more investigation, is there any chance you can check whether the problem arises from a conflict between that and one other option?

@yacoob
Copy link
Contributor Author

yacoob commented Apr 23, 2017

I've fiddled with prefer_specific as this is the only other option I have enabled in my config.

With

prefer_specific: yes
canonical: yes

beets crashes as above

With

prefer_specific: no
canonical: yes

Setting canonical: no stops the crashes, regardless of value of prefer_specific.

@yacoob
Copy link
Contributor Author

yacoob commented Apr 23, 2017

Hmm, is this a subcase of #2459 ?

@sampsyo
Copy link
Member

sampsyo commented Apr 24, 2017

Hmm; yes! The traceback does seem to indicate the same root bug here. The additional evidence here will certainly be useful; thank you!

@sampsyo sampsyo closed this as completed Apr 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needinfo We need more details or follow-up from the filer before this can be tagged "bug" or "feature."
Projects
None yet
Development

No branches or pull requests

2 participants