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

lyrics: Incorrect disabling of Genius backend #2911

Closed
rachmadaniHaryono opened this issue May 2, 2018 · 2 comments
Closed

lyrics: Incorrect disabling of Genius backend #2911

rachmadaniHaryono opened this issue May 2, 2018 · 2 comments
Labels
bug bugs that are confirmed and actionable

Comments

@rachmadaniHaryono
Copy link
Contributor

Problem

i try debugging beets and meet an error on lyric plugin.

installing bs4 will fix the error but unfortunately i can't reproduce the error after that, even with new virtualenv

Running this command in verbose (-vv) mode:

$ # before install bs4 package
$ beet import -s ./Windows版「シュタインズ・ゲート\(STEINS\;GATE\)」OP.m4a
$ # (error here, see below)
$ # after installing bs4 package
$ beet -vv import -s ./Windows版「シュタインズ・ゲート\(STEINS\;GATE\)」OP.m4a

Led to this problem:

(Pdb++) n
Traceback (most recent call last):
  File "/home/q/envs/beets/bin/beet", line 11, in <module>
    sys.exit(main())
  File "/home/q/envs/beets/lib/python3.6/site-packages/beets/ui/__init__.py", line 1257, in main
    _raw_main(args)
  File "/home/q/envs/beets/lib/python3.6/site-packages/beets/ui/__init__.py", line 1239, in _raw_main
    subcommands, plugins, lib = _setup(options, lib)
  File "/home/q/envs/beets/lib/python3.6/site-packages/beets/ui/__init__.py", line 1130, in _setup
    plugins = _load_plugins(config)
  File "/home/q/envs/beets/lib/python3.6/site-packages/beets/ui/__init__.py", line 1116, in _load_plugins
    plugins.send("pluginload")
  File "/home/q/envs/beets/lib/python3.6/site-packages/beets/plugins.py", line 475, in send
    for handler in event_handlers()[event]:
  File "/home/q/envs/beets/lib/python3.6/site-packages/beets/plugins.py", line 458, in event_handlers
    for plugin in find_plugins():
  File "/home/q/envs/beets/lib/python3.6/site-packages/beets/plugins.py", line 304, in find_plugins
    _instances[cls] = cls()
  File "/home/q/envs/beets/lib/python3.6/site-packages/beetsplug/lyrics.py", line 682, in __init__
    sources.remove('google')
ValueError: list.remove(x): x not in list

Here's a link to the music files that trigger the bug (if relevant):

https://www.youtube.com/watch?v=tiCNSLJ8Ihc

Setup

  • OS: ubuntu 18.04
  • Python version: 3.6.5
  • beets version: beets version 1.4.6 (0712076)
  • Turning off plugins made problem go away (yes/no): yes

My configuration (output of beet config) is:

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

plugins: inline convert web fromfilename play fetchart lyrics lastgenre
convert:
    dest:
    pretend: no
    threads: 2
    format: mp3
    formats:
        aac:
            command: ffmpeg -i $source -y -vn -acodec aac -aq 1 $dest
            extension: m4a
        alac:
            command: ffmpeg -i $source -y -vn -acodec alac $dest
            extension: m4a
        flac: ffmpeg -i $source -y -vn -acodec flac $dest
        mp3: ffmpeg -i $source -y -vn -aq 2 $dest
        opus: ffmpeg -i $source -y -vn -acodec libopus -ab 96k $dest
        ogg: ffmpeg -i $source -y -vn -acodec libvorbis -aq 3 $dest
        wma: ffmpeg -i $source -y -vn -acodec wmav2 -vn $dest
    max_bitrate: 500
    auto: no
    tmpdir:
    quiet: no
    embed: yes

    paths: {}
    no_convert: ''
    never_convert_lossy_files: no
    copy_album_art: no
    album_art_maxwidth: 0
web:
    host: 127.0.0.1
    port: 8337
    cors: ''
    reverse_proxy: no
    include_paths: no
fetchart:
    auto: yes
    minwidth: 0
    maxwidth: 0
    enforce_ratio: no
    cautious: no
    cover_names:
    - cover
    - front
    - art
    - album
    - folder
    sources:
    - filesystem
    - coverart
    - itunes
    - amazon
    - albumart
    google_key: REDACTED
    google_engine: 001442825323518660753:hrh5ch1gjzm
    fanarttv_key: REDACTED
    store_source: no
play:
    command:
    use_folders: no
    relative_to:
    raw: no
    warning_threshold: 100
pathfields: {}
item_fields: {}
album_fields: {}
lastgenre:
    whitelist: yes
    min_weight: 10
    count: 1
    fallback:
    canonical: no
    source: album
    force: yes
    auto: yes
    separator: ', '
    prefer_specific: no
@rachmadaniHaryono
Copy link
Contributor Author

rachmadaniHaryono commented May 2, 2018

diff --git a/beetsplug/lyrics.py b/beetsplug/lyrics.py
index d9db8ea..54bdd5f 100644
--- a/beetsplug/lyrics.py
+++ b/beetsplug/lyrics.py
@@ -679,7 +679,8 @@ class LyricsPlugin(plugins.BeetsPlugin):
                 u'The Genius backend requires BeautifulSoup, which is not '
                 u'installed, so the source is disabled.'
             )
-            sources.remove('google')
+            if 'google' in sources:
+                sources.remove('google')

         self.config['bing_lang_from'] = [
             x.lower() for x in self.config['bing_lang_from'].as_str_seq()]

will skip it (not quite sure on side effect)

@sampsyo
Copy link
Member

sampsyo commented May 3, 2018

Thanks! I think that line should be sources.remove('genius') instead. Can you please open a pull request?

@sampsyo sampsyo added the bug bugs that are confirmed and actionable label May 3, 2018
@sampsyo sampsyo changed the title wrong error on lyric plugin lyrics: Incorrect disabling of Genius backend May 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs that are confirmed and actionable
Projects
None yet
Development

No branches or pull requests

2 participants