RandomNinjaAtk / docker-lidarr-extended

lidarr-extended :: Lidarr application packaged with multiple scripts to provide additional functionality
GNU General Public License v3.0
275 stars 24 forks source link

[Bug]: MetadataPostProcess fails #228

Closed jsaddiction closed 1 year ago

jsaddiction commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Upon track retag call MetadataPostProcess.bash
  2. ERROR /some/path/to/artist not found within "."

Expected behavior post processing doing it's magic

Log Data 2023-04-26 11:41:08 :: MetadataPostProcess :: 1.0.015 :: Processing :: . :: Start 2023-04-26 11:41:08 :: MetadataPostProcess :: 1.0.015 :: Processing :: . :: ERROR :: /var/nfs/music/Aretha Franklin not found within "." :: Exiting...

Docker Info:

Additional context Did some troubleshooting with additional log entries. Seems on line 41 of MetadataPostProcess.bash where a curl command should return the track's path of the first entry of the artist, no result is found on every run of this script.

Once I get this figured out, is there a way to do this over an entire library?

RandomNinjaAtk commented 1 year ago

Did you check to see if the path exists?

There isn't a method to do this on the entire library at this time. Because some of its features will only work the first time the files are imported.

jsaddiction commented 1 year ago

It does and if I call the curl command as listed on line 41 I do get a result. Seems that Lidarr doesn't have any knowledge of tracks at the time the script is called.

I am recompiling a library using your scripts. I might have to start over?

RandomNinjaAtk commented 1 year ago

Maybe the script is running too quickly before the files have transferred? You could change the trigger to on track retag or rename to see if that helps. I honestly don't use that script, I use the BeetsPostProcessor script. So maybe there is an issue with it, but I would think it would have been reported earlier if there was an issue....

jsaddiction commented 1 year ago

I am using beets as well. Should this be disabled in the environment vars?

RandomNinjaAtk commented 1 year ago

If your using the beets script, you do not need to use the metadata script.

jsaddiction commented 1 year ago

Makes since. Looks like the MatadataPostProcess.bash script generates .lrc files where beets isn't. Do you know if Kodi / Jellyfin will process the embedded lyrics? Any other features that might be missing by skipping this script all together?

RandomNinjaAtk commented 1 year ago

Pretty sure the beets script also has the lyric features but you'll have to look through the code. Embedding isn't really viable option because it's unsupported... PR welcome for changes/improvements...

jsaddiction commented 1 year ago

I thought embedding was the default functionality. The log seems to show it.

ginjugg commented 1 year ago

I can confirm the issue how jsaddiction described it. Originally I had plex not running in a docker container and that it would have been an issue with the pathing. But I installed plex docker and still had this issue.

ginjugg commented 1 year ago

I tried changing the trigger in Lidarr. I set it to "On Track Retag" and tried retagging some Albums: Script seems to work:

2023-05-05 08:54:35 :: MetadataPostProcess :: 1.0.015 :: Tested Successfully 2023-05-05 08:54:37 :: MetadataPostProcess :: 1.0.015 :: Tested Successfully Error: writing output failed: Broken pipe 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: Start 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0110 - Feuer und Wasser.flac :: Getting Lyrics from embedded metadata 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0110 - Feuer und Wasser.flac :: Getting ARTIST_CREDIT from embedded metadata 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0110 - Feuer und Wasser.flac :: Lyrics not found... 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0110 - Feuer und Wasser.flac :: ARTIST_CREDIT not found... 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0109 - Te quiero puta!.flac :: Getting Lyrics from embedded metadata 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0109 - Te quiero puta!.flac :: Getting ARTIST_CREDIT from embedded metadata 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0109 - Te quiero puta!.flac :: Lyrics not found... 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0109 - Te quiero puta!.flac :: ARTIST_CREDIT not found... 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0104 - Spring.flac :: Getting Lyrics from embedded metadata 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0104 - Spring.flac :: Getting ARTIST_CREDIT from embedded metadata 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0104 - Spring.flac :: Lyrics not found... 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0104 - Spring.flac :: ARTIST_CREDIT not found... 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0101 - Benzin.flac :: Getting Lyrics from embedded metadata 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0101 - Benzin.flac :: Getting ARTIST_CREDIT from embedded metadata 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0101 - Benzin.flac :: Lyrics not found... 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0101 - Benzin.flac :: ARTIST_CREDIT not found... 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0105 - Wo bist du.flac :: Getting Lyrics from embedded metadata 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0105 - Wo bist du.flac :: Getting ARTIST_CREDIT from embedded metadata 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0105 - Wo bist du.flac :: Lyrics not found... 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0105 - Wo bist du.flac :: ARTIST_CREDIT not found... 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0111 - Ein Lied.flac :: Getting Lyrics from embedded metadata 2023-05-05 08:55:05 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0111 - Ein Lied.flac :: Getting ARTIST_CREDIT from embedded metadata 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0111 - Ein Lied.flac :: Lyrics not found... 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0111 - Ein Lied.flac :: ARTIST_CREDIT not found... 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0107 - Zerstören.flac :: Getting Lyrics from embedded metadata 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0107 - Zerstören.flac :: Getting ARTIST_CREDIT from embedded metadata 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0107 - Zerstören.flac :: Lyrics not found... 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0107 - Zerstören.flac :: ARTIST_CREDIT not found... 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0106 - Stirb nicht vor mir Don't Die Before I Do.flac :: Getting Lyrics from embedded metadata 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0106 - Stirb nicht vor mir Don't Die Before I Do.flac :: Getting ARTIST_CREDIT from embedded metadata 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0106 - Stirb nicht vor mir Don't Die Before I Do.flac :: Lyrics not found... 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0106 - Stirb nicht vor mir Don't Die Before I Do.flac :: ARTIST_CREDIT not found... 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0103 - Rosenrot.flac :: Getting Lyrics from embedded metadata 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0103 - Rosenrot.flac :: Getting ARTIST_CREDIT from embedded metadata 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0103 - Rosenrot.flac :: Lyrics not found... 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0103 - Rosenrot.flac :: ARTIST_CREDIT not found... 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0108 - Hilf mir.flac :: Getting Lyrics from embedded metadata 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0108 - Hilf mir.flac :: Getting ARTIST_CREDIT from embedded metadata 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0108 - Hilf mir.flac :: Lyrics not found... 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0108 - Hilf mir.flac :: ARTIST_CREDIT not found... 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0102 - Mann gegen Mann.flac :: Getting Lyrics from embedded metadata 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0102 - Mann gegen Mann.flac :: Getting ARTIST_CREDIT from embedded metadata 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0102 - Mann gegen Mann.flac :: Lyrics not found... 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: 0102 - Mann gegen Mann.flac :: ARTIST_CREDIT not found... 2023-05-05 08:55:06 :: MetadataPostProcess :: 1.0.015 :: Processing :: Rammstein - Album - 2005 - Rosenrot :: Finished in 0 minutes and 1 seconds! Error: writing output failed: Broken pipe

jsaddiction commented 1 year ago

@RandomNinjaAtk I am nearing completion of a python script that writes lyric files and tags tracks based on their type ["synced": ".lrc", "un-synced": ".txt"]. It sources these lyrics from ["embedded tags", "existing files", "hand full of web scrapers"]. It allows the user to select and prioritize these sources as well as define output methods like ["write files", "embed", "prefer synced"] etc. defining language seems to be challenging unless I include libraries for language detection (trying to keep the code base and requirements list small).

It seems that Tidal and Deezer both embed lyrics into the tracks tagging systems if available and my scripts utilize those as a source.

Beets does provide methods to collect lyrics but is limited to a few sources (one requires google developer account) and does not output .lrc or .txt files. It is possible to catch these lyrics in your script and write them to file however, I feel it would be better served with more granular control of lyrics behavior with modular web scraping sources.

I've developed this within a fork of this repo assuming I would just provide a pull request. However, I could extract and publish the python scripts in my own repo. This way means a pull request on your repo would only require small edits to integrate with yours and probably be much easier for you to evaluate the code.

The two different ways break down to who "owns" the code.

Which method do you prefer?

RandomNinjaAtk commented 1 year ago

@jsaddiction So this would be used for traditional sources? Because the other sources included in the scripts already come with lyrics.

This would be a post processing script of some sort? Added to Lidarr connect options?

jsaddiction commented 1 year ago

Essentially, I parse out everything available synced or not unless it's disabled via env vars:

Once everything is grabbed the list of options are sorted based on configured env vars and then optionally written to LRC TXT. The user can also opt in and overwrite the embedded lyric metadata.

I see it fitting nicely into the scripts directory and used in conjunction with the Audio.sh script which would handle calling it. My script will process either one single track or operate in batch mode based on the path you give it being either a file or a directory path.

MetadataPostProcess.bash seems to not function correctly and this script is more robust than what Beets, Tidal, Deezer can provide.

We could remove the parts in MetadataPostProcess.bash that pertain to lyrics if you think they will conflict (probably not).

jsaddiction commented 1 year ago

Further digging into the lyrics problem seems to be an issue with Lidarr itself. See Lidarr/Lidarr#484. This script does provide .lrc files if the downloading source Deezer or Tidal have them. Those lyrics appear to originate from MusixMatch. I am undergoing a significant change in the lyrics processing development phase in light of this info. I will post new, more relevant info when I am ready for deployment via pull request which will be in the form of a post processing script written in python. This way Lidarr doesn't have the chance to discard it during the import phase.