music-assistant / hass-music-assistant

Turn your Home Assistant instance into a jukebox, hassle free streaming of your favorite media to Home Assistant media players.
Apache License 2.0
1.24k stars 44 forks source link

Filesystem provider parse_album errors out #708

Closed jmtatsch closed 2 years ago

jmtatsch commented 2 years ago

What version of Music Assistant has the issue?

2022.7.0

The problem

filesystem provider errors out likely due to spaces in the filename (not in the parent folder name) as it seems

How to reproduce

create path structure as indicated in the below logs and sync

Relevant log output

2022-07-23 11:46:19 ERROR (MainThread) [music_assistant.music.file] Error processing /mnt/music/Kabah/La Vuelta Al Mundo/02 Florecitas.mp3 - not enough values to unpack (expected 2, got 1)
File "/usr/local/lib/python3.10/site-packages/music_assistant/music_providers/filesystem.py", line 234, in sync_library
File "/usr/local/lib/python3.10/site-packages/music_assistant/music_providers/filesystem.py", line 501, in _parse_track
File "/usr/local/lib/python3.10/site-packages/music_assistant/music_providers/filesystem.py", line 738, in _parse_album
2022-07-23 11:46:20 ERROR (MainThread) [music_assistant.music.file] Error processing /mnt/music/Kabah/La Vuelta Al Mundo/03 El Complot.mp3 - not enough values to unpack (expected 2, got 1)
File "/usr/local/lib/python3.10/site-packages/music_assistant/music_providers/filesystem.py", line 234, in sync_library
File "/usr/local/lib/python3.10/site-packages/music_assistant/music_providers/filesystem.py", line 501, in _parse_track
File "/usr/local/lib/python3.10/site-packages/music_assistant/music_providers/filesystem.py", line 738, in _parse_album

Additional information

music mounted via nfs from synology

What version of Home Assistant Core are your running

2022.7.6

What type of installation are you running?

Home Assistant Supervised

On what type of hardware are you running?

Linux

marcelveldt commented 2 years ago

This is a real edgecase. So you have no ID3 tags in your files and then it falls back to parsing the artist and title from the filename except in that case it kind of expects a filename like this "artist - title.mp3"

I will fix the bad error so it ignores these files. I strongly suggest you to either use proper ID3 tags on your files or rename them to have the common/standard filename of "artist - album".

jmtatsch commented 2 years ago

Can we perhaps get a fallback parsing option for artist/album/title.mp3 pattern as this is the default iTunes library structure that a lot of people have?

OzGav commented 2 years ago

I will leave it up to Marcel to answer your question but I would like to emphasise the actual answer is all of the tracks need to be properly tagged to get the most of MA and to minimise unexpected behaviour. Musicbrainz Picard is free and easy to use so I strongly recommend you use that to solve this issue.

marcelveldt commented 2 years ago

The album and artist structure is used for additional metadata not to be used as primary source for the details. That's where ID3 tags are invented for.

Yes that structure is fully supported but still requires you to have proper ID3 tags, I'm not going to deviate from that.

erkr commented 2 years ago

Marked as enhancement to prevent the bad error

marcelveldt commented 2 years ago

I've just released patch version 2022.7.1 which should fix this issue. If you still experience any issues after updating to 2022.7.1 please let us know, thanks!

antonyslater commented 1 year ago

I have the same issue, unfortunately the latest update doesn't seem to solve the issue for me...

Trouble is my files do all have ID3 Tags and for some reason it is falling back on this process to gather the information. My files do not have the name of the artist in the file name, just the track number then the track name (01 Welcome to the Jungle.flac) so will always fail when it gets to this point, my point is it should never even need to try and gather the data in this way for my files.

The error I see in the error log (single entry) changes every time I refresh the log as if it is reusing the same entry for each file it now ignores, error description is always the same but the track with the issue changes every time. I have dip sample checked "erroneous" files and confirm they do all have valid ID3 tags. At the moment it means Instead of over 14000 music files I have less than 1000

My Error Log Entry (One of them) Log Details (ERROR) Logger: music_assistant.music.file Source: /usr/local/lib/python3.10/site-packages/music_assistant/music_providers/filesystem.py:266 First occurred: 07:58:06 (9670 occurrences) Last logged: 08:13:59

Error processing /media/Diskstation/Music/Eminem/The Eminem Show/18 'Till I Collapse feat. Nate Dogg.flac - not enough values to unpack (expected 2, got 1) Error processing /media/Diskstation/Music/Eminem/The Eminem Show/03 Business.flac - not enough values to unpack (expected 2, got 1) Error processing /media/Diskstation/Music/Eminem/The Eminem Show/16 When The Music Stops feat. D12.flac - not enough values to unpack (expected 2, got 1) Error processing /media/Diskstation/Music/Eminem/The Eminem Show/17 Say What You Say feat. Dr. Dre.flac - not enough values to unpack (expected 2, got 1) Error processing /media/Diskstation/Music/Eminem/The Eminem Show/07 Soldier.flac - not enough values to unpack (expected 2, got 1) Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/music_assistant/music_providers/filesystem.py", line 251, in sync_library track = await self._parse_track(entry.path) File "/usr/local/lib/python3.10/site-packages/music_assistant/music_providers/filesystem.py", line 520, in _parse_track track.album = await self._parse_album( File "/usr/local/lib/python3.10/site-packages/music_assistant/music_providers/filesystem.py", line 760, in _parse_album filename, ext = _path.path.rsplit(os.sep, 1)[-1].split(".", 1) ValueError: not enough values to unpack (expected 2, got 1)

marcelveldt commented 1 year ago

@antonyslater do not comment on an already closed issue please. Please open your own issue if you have any issues. That will keep our minds sane, thank you! That said, I did find the issue you reported above. Fixed in 2022.7.2 !

antonyslater commented 1 year ago

@antonyslater do not comment on an already closed issue please. Please open your own issue if you have any issues. That will keep our minds sane, thank you! That said, I did find the issue you reported above. Fixed in 2022.7.2 !

My apologies, it was only because it was the exact same issue I was seeing. Will try 2022.7.2 and if I still have issues will log a fresh issue.