jacquesh / foo_openlyrics

An open-source lyric display panel for foobar2000
MIT License
403 stars 24 forks source link

Locally-available lyrics are not found once search-avoidance kicks in for a given track #247

Closed Bulborb69 closed 8 months ago

Bulborb69 commented 1 year ago

As the title says, all of my MP3s that start with comment language code in their LYRICS or UNSYNCEDLYRICS tag are invisible to OpenLyrics.

Steps to reproduce

  1. Add eng|| to the front of the lyrics in either the UNSYNCEDLYRICS or LYRICS tags
  2. Load song
  3. Unseen by OpenLyrics

Expected behavior

The lyrics to be visible

Versions

Sorry if my formatting is all weird or anything, I just signed up for github just for this! :p

jacquesh commented 1 year ago

@Bulborb69 I can't reproduce this. Do you mean that you prepend "eng||" to the lyrics text and then openlyrics fails to load those lyrics?

e.g to try this out I modified some unsynced lyrics to be:

eng||
first line of lyrics
second line of lyrics
etc

and that worked as expected. Can you please provide a complete example of lyrics that don't work for you?

Bulborb69 commented 1 year ago

So sorry I didn't see this! I don't add the "eng||" myself, I use the program Mp3tag v3.21, which automatically prepends it to the UNSYNCEDLYRICS tag, and will not let me delete it afterwards. Perhaps the language code has nothing to do with this, and there's some incompatibility with the Mp3tag program thats beyond my understanding?

To more faithfully reproduce:

  1. Install Mp3Tag and run it,
  2. drag any .mp3 file into it
  3. right click the mp3 in the program
  4. select add field (the paper with the star)
  5. type in either UNSYNCEDLYRICS or LYRICS (should autofill) in the field section
  6. type in gibberish or whatever in the value section and hit ok twice
  7. open the mp3 in foobar
  8. lyrics don't appear!

If you use Mp3tag to look at the tags created by OpenLyrics, you'll see that they lack "eng||" and load perfectly everytime. I appreciate you taking the time to look at this and sorry again for the wait!

jacquesh commented 11 months ago

I followed your instructions, inserting lyrics into UNSYNCEDLYRICS. It worked fine.

Are you sure you have metadata tags configured as (possibly the first) source? Can you please post your debug log output (as recommended by the bugfix issue template you used).

Zapeth commented 11 months ago

I dont know if its the same issue, but I'm also experiencing issues with LYRICS tags for certain files.

I tested around a bit and it doesn't seem to be caused by special characters, but rather dependent on the overall size of the metadata?

If I remove or add a character to any meta tag (eg artist or title) in the foobar properties panel and replay the file, the lyrics are displayed. However reverting that change in the panel and replaying the file make the lyrics not load again, so it seems to be some boundary size issue?

Tested with plugin v1.6, the debug log doesn't list anything apart from "Opening \<file>", or do I have to explicitly set more verbose logging somewhere?

edit: Correction, it seems to be only affected by "artist", "title" and "album" tags, changing any other tag has no effect. Substituting the values with random letters also doesn't reproduce it, so I guess its not size related.

In my case this is an example that triggers the issue (all these tags need to be set like that): artist=Arctic Monkeys, title=Star Treatment, album=Tranquility Base Hotel + Casino

edit2: Found the debug logging option for the plugin, the only message from the plugin that appears in the error case is Skipped search because it's expected to fail anyway and was not specifically requested

edit3: Now the same file works after trying around a bit more, not sure why these checks are necessary that way, but there's definitely some weirdness going on at https://github.com/jacquesh/foo_openlyrics/blob/69bbf8948b56c3745ab931301f761bf4c94bf959/src/metadb_index_search_avoidance.cpp#L100-L103

jacquesh commented 11 months ago

@Zapeth the code you linked exists to avoid unnecessary searches for tracks that do not have lyrics available (e.g instrumental tracks), it should not be affected by the contents of any tags on the track. If that track previously did not have lyrics available (or its tags were wrong, causing it to not match any search results) for long enough, then it would have been flagged as not having lyrics and no searches would have been carried out on that track unless you explicitly requested them (at least until some lyrics were found, at which point it resets).

It is entirely possible that this is the same issue that @Bulborb69 was running into. This is why the issue template requests debug logs. I should probably make this a hard requirement for new issues.

Zapeth commented 11 months ago

If that track previously did not have lyrics available (or its tags were wrong, causing it to not match any search results) for long enough, then it would have been flagged as not having lyrics and no searches would have been carried out on that track unless you explicitly requested them (at least until some lyrics were found, at which point it resets).

The lyrics were always available as a tag, but for some reason only showed up when I edited any of the artist/track/album tags (I could even display them with the "Show lyrics" option, they just wouldn't load in the "OpenLyrics Panel"). I can only guess that a timestamp change led to them being suddenly displayed when testing again some time later.

In any case, I think the code should take into account lyrics that are guaranteed to be available (ie stored with the file as metadata) and override/skip these checks if they exist and are listed as higher priority in the plugin settings.

jacquesh commented 11 months ago

In any case, I think the code should take into account lyrics that are guaranteed to be available (ie stored with the file as metadata) and override/skip these checks if they exist and are listed as higher priority in the plugin settings.

It does, or rather...it should...there may well still be a bug here! It'll only start avoiding searches if it fails completely to find lyrics after sufficient time and searches. If you have tags enabled as a source (regardless of where in the list it is) and there are lyrics in the tags, then it should find them from the get-go. Or are you suggesting that it should search local sources (tags/files) even when it's already been flagged for search avoidance? That might not be a bad idea to be honest...

If anybody has a way to reproduce this then I'm all ears, but without that (or at the very least without debug logs showing this issue) it's tough to find a solution.

Zapeth commented 11 months ago

Or are you suggesting that it should search local sources (tags/files) even when it's already been flagged for search avoidance? That might not be a bad idea to be honest...

I think thats what happened in my case. I converted my flac files to opus, adding lyrics tags in the process. However I had already played the flac files at an earlier point with the plugin, so they probably got marked as "no lyrics" in the metadb and it didn't recognize the converted files with the added lyrics as new.

Also I just checked the "Search lyrics" option with a file that didn't display lyrics and can confirm that they are now displayed in the OpenLyrics Panel as well (after replaying the file).

Bulborb69 commented 11 months ago

Well here's another problem for you: I was trying to figure out how to enable the debug log, and saw a checkbox hiding, and ended up being right. I'm on a 4K monitor, could that be it?

In other news, ever since I updated to Foobar 2.0, every song I open with lyrics already created by a different program just open with "." as you can see. Hopefully this debug log helps!

EDIT: For the record, I reset all settings to default before taking these screenshots, except for changing the save method to "save to tag"

foobar
jacquesh commented 11 months ago

@Bulborb69 the hiding checkbox is #228. For the loading-as-dot issue, that sounds a lot like #271, feel free to add more info there. In particular it would be helpful if you could upload a file there that reproduces it (either the text file that it loads from, if you can reproduce the same issue when loading from text file, or some dummy audio file that has the tags that don't load).

Bulborb69 commented 11 months ago

I think I fixed it?

I don't load lyrics from text files, only ones embedded in the tags. I was trying to make a dummy example file and getting no progress (the lyrics were loading as intended!). I was doing some troubleshooting and realized that when I placed an mp3 that wasn't loading lyrics properly anywhere else, the lyrics loaded! I guessed that anything in my database predating me installing the plugin wasn't playing. I got rid of the metadb.sqlite and database.dat files, along with the library-v2.0 folder for good measure. I'm not exactly sure which of these specifically was the culprit, but ever since my library rebuilt, everything has been working smoothly 100%.

I still have the old files and folder, if you'd like to examine them.

jacquesh commented 11 months ago

Oh ok, that's...good I guess? Unfortunate that we don't have any clue why it works but it's a start! >_<

Yeah if you're happy to send me the old files/folder (and if possible, the new ones too, for comparison) then I'll take a look and see if I can figure it out from that.

Bulborb69 commented 11 months ago

The .zip I made ended up being 50 MB so I put it on dropbox, if that's okay.

https://www.dropbox.com/scl/fi/vlus2rbrjcpmhvg3vxrj9/foobar2000-v2-files.zip?rlkey=348qu2wcyqk1wtrfhxvvubxt9&dl=0

The database.dat file was excluded because I don't think foobar uses it anymore!

mayonezo commented 10 months ago

@Bulborb69 thank you so much! Rebuilding the databases fixed it for me, too!

I think I fixed it?

I don't load lyrics from text files, only ones embedded in the tags. I was trying to make a dummy example file and getting no progress (the lyrics were loading as intended!). I was doing some troubleshooting and realized that when I placed an mp3 that wasn't loading lyrics properly anywhere else, the lyrics loaded! I guessed that anything in my database predating me installing the plugin wasn't playing. I got rid of the metadb.sqlite and database.dat files, along with the library-v2.0 folder for good measure. I'm not exactly sure which of these specifically was the culprit, but ever since my library rebuilt, everything has been working smoothly 100%.

I still have the old files and folder, if you'd like to examine them.

jacquesh commented 9 months ago

I'm pushing this back since we have a workaround (request a lyrics search). I suspect (with no real evidence but its conceivable) that "lyrics loading just a dot" issue is related to the issue of it skipping a search even for local sources once it's failed enough. I should make the search avoidance only prevent remote searches (since the main point was to avoid spamming web servers with requests that will never succeed, which obviously is irrelevant for local sources). I changed the issue title accordingly.