epoupon / lms

Lightweight Music Server. Access your self-hosted music using a web interface.
http://lms-demo.poupon.dev
GNU General Public License v3.0
1.08k stars 60 forks source link

Crashing during Scan #496

Closed epoupon closed 1 month ago

epoupon commented 2 months ago

Discussed in https://github.com/epoupon/lms/discussions/495

Originally posted by **Bigmack3000** July 14, 2024 I don't know if this is the right place to ask, but can someone help with why LMS keeps crashing during scanning? These are the errors that pop up: terminate called after throwing an instance of 'Wt::Dbo::NoUniqueResultException' and what(): Query: resultValue(): more than one result any ideas? I have the logs, if it would help to post them
epoupon commented 2 months ago

@bigmack3000 there is a logic error somewhere in lms, this is an issue that must be fixed. Logs in debug mode would help (see https://github.com/epoupon/lms/blob/4cb6689e75d5510ae50adde6214acd13105f8c5b/conf/lms.conf#L14) Showing the last queries would help too (see https://github.com/epoupon/lms/blob/4cb6689e75d5510ae50adde6214acd13105f8c5b/conf/lms.conf#L16), note queries are not output in the log file but on stdout.

Can you remember what triggered this crash? Was it crashing just after a lms update? The second time you scaned maybe? After adding some songs?

Bigmack3000 commented 2 months ago

Hey, I just installed this on my synology today. This was during my first scan. It was a large libary, over 200k songs, so I don't know if that was part of the issue. I've included the logs here. If there's a specific way to get debugging logs, I can scan it again to get those as well. LMS (2).csv

epoupon commented 2 months ago

Thanks! I am not sure debug logs would help, I think showing queries is the way to go. You have to copy/paste the default lms.conf file, and edit the db-show-queries entry to put it to true. Then you can paste the file in the mounted volume (where lms stores the db) and run the image with the path of the file as first parameter (something like /var/lms/lms.conf)

Bigmack3000 commented 2 months ago

any ideas on how i get to those files on a synology?

Bigmack3000 commented 2 months ago

I've been talking to synology help for a bit now. I'm sorry, I cannot figure out on my own how to access these files. And they couldn't find that directory either.

epoupon commented 2 months ago

Ok I will make a test image for you, but you will have to wait for a week. I will keep you updated!

Bigmack3000 commented 2 months ago

ok great. Thanks!

Bigmack3000 commented 1 month ago

i followed the steps here: https://drfrankenstein.co.uk/category/plex-7-2/

to properly set up a restricted user for docker containers. I'm still having the same error pop up when scanning my library. I was able to finally find the conf file, but it is "read only" because of the restricted docker usr the container runs under.

epoupon commented 1 month ago

Don't worry, I will craft you a docker image soon. Do you know the arch of your nas? (What is the model?)

Bigmack3000 commented 1 month ago

the nas is a DS1618+. Synology says the package arch is Denverton.

epoupon commented 1 month ago

Can you please test with epoupon/lms:7befa739 and paste the output?

Bigmack3000 commented 1 month ago

Hey I'm getting the same error messages. I'm trying to post the logs here, but it's over the size limit. One scan created a log that's 600+pages. the previous logs were just a few pages.

Bigmack3000 commented 1 month ago

lms1.csv.zip

i zipped the file and included it here.

epoupon commented 1 month ago

Thanks! Unfortunately, this is not enough for me to understand :( Can you please test again with epoupon/lms:27eae19b ? No need to put everything, you can stop a few hundred lines below the terminate called after throwing an instance of 'Wt::Dbo::NoUniqueResultException' line

Bigmack3000 commented 1 month ago

Ok. the error hit again on that one. attached is an excerpt from the log. lms log excerpt.pdf

epoupon commented 1 month ago

Ok thanks, now I see the problem. This is because you have many genres in one single value, separated with ; I will make a patch to fix this, because lms should handle this without crashing, but you may workaround this issue by specifying ; separator in the tags here: image in image

Bigmack3000 commented 1 month ago

that fixed it! thank you!

Bigmack3000 commented 1 month ago

ok, so all of the songs are scanning now. My next question would be, why are a lot of albums missing artwork if I know they have it?

epoupon commented 1 month ago

Are the image embedded into audio files? Is there an external cover image?

Bigmack3000 commented 1 month ago

That seems to be it. Every file has an album cover embedded in it through picard. But the database is shared with emby, which seperetly downloaded pictures and stored them in the album folders for most albums. LMS seems to be defaulting to the downloaded pictures and then ignoring the embedded ones. Because a lot of albums are displaying a "back of cd" photo instead of the cover. Is there a away to have lms only read embedded covers?

epoupon commented 1 month ago

Lms reads both embedded and external covers. Can you please send me a file so that I test on my side? You can mail @ tmp49-tmp49@yahoo.com

Bigmack3000 commented 1 month ago

files sent. Thanks!

epoupon commented 1 month ago

Ah, this is aiff files. Indeed embedded images are not detected for this file format: will see to fix this. For the back.jpg file, this is because for now LMS picks extern files before fallbacking to embedded covers, will change this to make it configurable, and have a better default behavior.

BTW, your tagger puts multi valued tags using ; separator. If you use picard, you should better switch to v2.4 for Id3 tags image

Bigmack3000 commented 1 month ago

Ok, thanks. I'll update my picard. What should be used to separate tags?

Getting images out of aiff files would be great, like emby. Also having embedded images as the default.

Were you able to look at the other files i had attached? About multi artists bot showing up under songs in symfonium?

Thanks!

epoupon commented 1 month ago

Ok, thanks. I'll update my picard. What should be used to separate tags?

You don't need to specify a separator, as id3 v2.4 supports multi-valued tags

Were you able to look at the other files i had attached? About multi artists bot showing up under songs in symfonium?

I don't see something particular in these files, except you should also tick this: image

Bigmack3000 commented 1 month ago

So, when the files are loaded into symfonium through emby, the multi artist tags are displayed properly, like this:

Screenshot_20240724_192439

But when they're loaded through LMS, I'm not getting the secondary artists to show up:

Screenshot_20240724_192636

The files are tagged properly. I'm not sure what setting to change to get it.

Also, entire categories, like record labels, come up empty:

Screenshot_20240724_192716

Bigmack3000 commented 1 month ago

It's interesting because it is reading the multi artist tags from LMS:

Screenshot_20240724_224109

It just isn't displaying them with the songs. The way it does for other providers.

Tolriq commented 1 month ago

LMS does not support record labels yet.

The artist displayed under the songs is the display artist value that LMS returns, if you mix single value and multi value then it gives this.

@epoupon can explain how he generate the field

Bigmack3000 commented 1 month ago

LMS does not support record labels yet.

oh, ok. I saw the "Record Labels" option in Symfonium and went off that.

For the multi-artists, here's the tags for the song above:

Screen Shot 2024-07-25 at 3 19 19 AM

So I'm guessing Emby reads the "Artists" tag for display purposes, and LMS is only reading the "Artist" tag?

epoupon commented 1 month ago

Oh, I forgot to add the record label, will add this.

@Bigmack3000 looks like I don't have the album you show, can you please send it to me so that I can have a look?

Bigmack3000 commented 1 month ago

Ok, I've emailed the album over.

epoupon commented 1 month ago

Ok, LMS first tries to get the artists in the ARTISTS tag. Here this tag contains multiple values, separated by ;. By default LMS does not try to split, you either have to retag using id3 v2.4 or manually split LMS side here: image

Then it considers the "nice" display artist string is set in the ARTIST tag. Here for some reason you just have "Kendrick Lamar".

Using picard on your album, I get this for the artist tag: "Kendrick Lamar ft. Bilal, Anna Wise, & Snoop Dogg" And that displays like this in LMS: image

Bigmack3000 commented 1 month ago

I do have that option set up in LMS:

Screen Shot 2024-07-26 at 10 47 08 AM

And you can see above when it's read through emby that all of the artists are visible under each song in Symfonium.
LMS is reading the extra artists, I would just love for it to display them the same way.

epoupon commented 1 month ago

Yes, it solves the split issue, but not the "display artist" issue:

Then it considers the "nice" display artist string is set in the ARTIST tag. Here for some reason you just have "Kendrick Lamar".

Did you tag with picard?

Bigmack3000 commented 1 month ago

yea everything in my library was tagged with picard.

Does LMS read the "artists" tag as well for display?

epoupon commented 1 month ago

yea everything in my library was tagged with picard.

Does LMS read the "artists" tag as well for display?

No since it expects it to be a multi-valued tag, containing all track artists, but with no join strings

epoupon commented 1 month ago

But I still wonder why I don't get the same tags as you. Even on the web interface of the release: https://musicbrainz.org/release/88ab7a5c-fd27-421e-85f0-f107ed86a43f , the 4rth track's title is "Institutionalized", not "Institutionalized feat. etc."

I don't find any relevant option in picard to get the same result as you

Bigmack3000 commented 1 month ago

There's a plugin for picard that puts feat artists in the track title. But the song title itself should have no effect on the artists being displayed underneath, right? The artists tag itself is tagged properly, no? It has the track artist and the featured artists all listed, and they match the order of the mbid artist tags.

I think if LMS just displayed the artists tag it would fix the problem

epoupon commented 1 month ago

Ah, maybe this plugin also keeps a single artist in the artist tag then? Not sure to understand the benefit of this plugin (why repeating the artists in the title, since it is already properly encoded in the artist and artists tag? (see my last screenshot using a vanilla picard)

Anyway, it would fix the display artist problem for this plugin, but unfortunately it would break all the other use cases.

Bigmack3000 commented 1 month ago

Sorry, I'm getting a little confused. I'm referring to these two tags:

Screenshot_20240727_120202_Chrome

I use the plug in because i just like having the feat artists listed in the song title. But the song title should have no affect on anything else. However, if i didn't use the plugin, the artist tag would read "Kendrick Lamar fts. Xyz" and that xyz would change for every artist.

Most apps (like emby) would then unfortunately treat every variation as a new artist because the artist tag was different for all of them. The way i do it. "Kendrick Lamarr" is a uniform artist tag. Then the "artists" tag lists kendrick lamarr and everyone featured on the song

Then the mbid artist tag lists all the mbids connecting to everyone in the artist tag.

Putting every feat artist in the regular "artist" tag ends up breaking a lot of other apps.

LMS, i think, is already reading the "artists" tag because if i click more options to a song, I can go to any of the feat artist pages.

It would just help immensely if LMS could have the option display the "artists" tag under a song title. So i could see everyone in it without clicking more options.

epoupon commented 1 month ago

I use the plug in because i just like having the feat artists listed in the song title. But the song title should have no affect on anything else. However, if i didn't use the plugin, the artist tag would read "Kendrick Lamar fts. Xyz" and that xyz would change for every artist.

Does the plugin affect the artist tag or did you chose to erase the artist tag yourself? You are right, LMS already parses artists using the artists tags, it also already extracts the corresponding mbids in the music brainz artist id tag.

Now, as picard puts a string with "nice" joins on the artist tag, LMS uses it to display this: image

Basically, what you want is an option to ignore this artist tag and always reconstruct the artist display name from the list in the artists tag. This could be added, but this will not likely be the default behavior.

Bigmack3000 commented 1 month ago

Does the plugin affect the artist tag or did you chose to erase the artist tag yourself? You are right, LMS already parses artists using the artists tags, it also already extracts the corresponding mbids in the music brainz artist id tag.

If an artist has feat or ft in it, the plugin moves everything after that to the song title so the artist tag is uniform throughout. If its "&" "/" or anything like that, everything stays as is.

Basically, what you want is an option to ignore this artist tag and always reconstruct the artist display name from the list in the artists tag. This could be added, but this will not likely be the default behavior.

It sounds like that would solve the issue. I guess when there's an "artists" tag, the artist tag becomes redundant. But i think it organizes it well.