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 are wrong #2969

Closed
Flurrywinde opened this issue Jun 29, 2018 · 7 comments
Closed

Lyrics are wrong #2969

Flurrywinde opened this issue Jun 29, 2018 · 7 comments
Labels
needinfo We need more details or follow-up from the filer before this can be tagged "bug" or "feature."

Comments

@Flurrywinde
Copy link

Problem

I used all default values in my config file, and beets imported lyrics successfully. However, for Manowar's "Fast Taker", they were wrong, so I added the following to my config file (/home/kanon/.config/beets/config.yaml):

lyrics:
    google_API_key: [redacted]
    sources: google

The same wrong lyrics appeared, despite google's regular search turning up different, better lyrics. (The first result in the "beets custom search engine" is different from both of these.)

Is there a way to tell which source beet is getting the lyrics from?

Also, is there a way to select which google source is used?

Is there a list of sources? For example, I see "lyrics.com" and "lyricwiki" on beets.readthedocs.io.

Running this command in verbose (-vv) mode:

$ beet -vv  lyrics -fp manowar fast taker

Led to this problem:

user configuration: /home/kanon/.config/beets/config.yaml
data directory: /home/kanon/.config/beets
Sending event: pluginload
no config file found at /home/kanon/.beetsconfig
library database: /home/kanon/Music/musiclibrary.db
library directory: /home/kanon/Music
Sending event: library_opened
google lyrics backend error: accessNotConfigured
got lyrics from backend: fetch_lyricswiki
fetched lyrics: Manowar - Fast Taker
Sending event: write
Sending event: after_write
Sending event: database_change
[lyrics here]

I notice it says: "google lyrics backend error: accessNotConfigured". Here is how I set up my google api key:
opera snapshot_2018-06-29_002558_console developers google com

Is that correct? Why isn't it working?

Setup

  • OS: Ubuntu 16.04
  • Python version: Python 3.6.5 :: Anaconda, Inc.
  • beets version: beets version 1.3.8
  • Turning off plugins made problem go away (yes/no): no

My configuration (output of beet config) is:

directory: ~/Music

import:
    copy: no
lyrics:
    google_API_key: AIzaSyDELPsVTGyXRywPrXx[redacted]
    sources: google
    auto: yes
    fallback:
    google_engine_ID: 009217259823014548361:lndtuqkycfu
library: ~/Music/musiclibrary.db

plugins: fromfilename fetchart lyrics
fetchart:
    cautious: no
    maxwidth: 0
    auto: yes
    remote_priority: no
    google_search: no
    cover_names:
    - cover
    - front
    - art
    - album
    - folder
@sampsyo sampsyo added the needinfo We need more details or follow-up from the filer before this can be tagged "bug" or "feature." label Jun 29, 2018
@sampsyo
Copy link
Member

sampsyo commented Jun 29, 2018

That’s certainly strange! The verbose output says:

got lyrics from backend: fetch_lyricswiki

But that seems wrong, since you clearly only have the google source enabled, not lyricswiki. I don’t know why the plugin doesn’t seem to be respecting your configuration there.

I notice you seem to be on a pretty old version of beets (1.3.8). Have you tried using the most recent version?

@Flurrywinde
Copy link
Author

I installed via the Ubuntu repositories, so that's what version is there. I now installed via pip, and it's now version 1.4.7. I ran beet -vv lyrics -f -p manowar fast taker again and got:

user configuration: /home/kanon/.config/beets/config.yaml
data directory: /home/kanon/.config/beets
plugin paths: 
Sending event: pluginload
library database: /home/kanon/Music/musiclibrary.db
library directory: /home/kanon/Music
Sending event: library_opened
lyrics: failed to fetch: https://www.googleapis.com/customsearch/v1?key=AIzaSyDELPsVTGyXRywPrXxgVJBZySoKz1HLTSc&cx=009217259823014548361:lndtuqkycfu&q=Manowar%20Fast%20Taker (403)
lyrics: google backend returned no data
lyrics: lyrics not found: Manowar -  - Fast Taker
[current local lyrics output]

The verbose output is much more helpful now. :) The url told me how to fix things, and running the command again succeeded:

user configuration: /home/kanon/.config/beets/config.yaml
data directory: /home/kanon/.config/beets
plugin paths: 
Sending event: pluginload
library database: /home/kanon/Music/musiclibrary.db
library directory: /home/kanon/Music
Sending event: library_opened
lyrics: Bad triggers detected: ['Manowar']
lyrics: got lyrics from www.azlyrics.com
lyrics: got lyrics from backend: Google
lyrics: fetched lyrics: Manowar -  - Fast Taker
Sending event: write
Sending event: after_write
Sending event: database_change

What does "Bad triggers" mean?

The lyrics are still wrong, so two of my questions from above still apply:

  • Is there a way to select which google source is used?

  • Is there a list of sources? For example, I see "lyrics.com" and "lyricwiki" on beets.readthedocs.io.

And now a new question:

  • Is there a way to make it use the lyrics a regular google search returns at the top (i.e. it is not a link but a box with what look like official lyrics)?

@sampsyo
Copy link
Member

sampsyo commented Jun 29, 2018

Cool! I’m glad the sources issue has gone away in the current version.

I don’t know what the “bad trigger” thing is meant to indicate—it seems to be part of the heuristic that decides whether a page actually contains lyrics. I’ll have to rely on @Kraymer to clarify his intent there.

  • I’m not sure what you mean by “which google source.” Do you mean switching to your own “custom search engine” you create on Google’s servers? The docs describe how to do that, though, so I imagine you’re asking about something else.
  • Yep, see the list in the documentation for the “sources” config option: http://docs.beets.io/en/v1.4.7/plugins/lyrics.html
  • I don’t think it’s possible to get those lyrics from Google. They’re not part of any public API they offer, and Google is extremely draconian about preventing screen-scraping.

@stale
Copy link

stale bot commented Jul 12, 2020

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 12, 2020
@wisp3rwind
Copy link
Member

I don’t know what the “bad trigger” thing is meant to indicate—it seems to be part of the heuristic that decides whether a page actually contains lyrics. I’ll have to rely on @Kraymer to clarify his intent there.

In fact, it looks like this is due to a typo: The idea is to check whether the artist name occurs in the lyrics (which is unlikely, hence an indicator, that the plugin didn't scrape the actual lyrics). However, the typo means that the plugin never actually checks whether the artist name occurs in the text. The following patch should correct this. @Kraymer could you briefly check whether this is correct?

diff --git a/beetsplug/lyrics.py b/beetsplug/lyrics.py
index f53191d8..1291f2a5 100644
--- a/beetsplug/lyrics.py
+++ b/beetsplug/lyrics.py
@@ -552,7 +552,7 @@ class Google(Backend):
 
         bad_triggers = ['lyrics', 'copyright', 'property', 'links']
         if artist:
-            bad_triggers_occ += [artist]
+            bad_triggers += [artist]
 
         for item in bad_triggers:
             bad_triggers_occ += [item] * len(re.findall(r'\W%s\W' % item,

This bug is quite old, is was introduced in 117d16f.

@stale stale bot removed the stale label Jul 12, 2020
@Kraymer
Copy link
Contributor

Kraymer commented Jul 12, 2020

@wisp3rwind yes your fix seems correct

@wisp3rwind
Copy link
Member

Closing this issue, it appears that the original issue with the google source was already resolved. If this wasn't the case, feel free to re-open and add some details, @Flurrywinde.

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

4 participants