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

Fix: Improve accuracy of matching album in directory structure for local filesystem #1779

Merged
merged 3 commits into from
Nov 20, 2024

Conversation

skrobul
Copy link
Contributor

@skrobul skrobul commented Nov 17, 2024

Hi, this is another PR in my quest to fix the album art not loading correctly on my library. Here's a description of the changes from the first commit:

This code resolves a problem with some of the albums not being matched by other heuristics in the get_album_dir() method by taking slightly different approach. It emulates what humans do - mentally break down the name into logical chunks that represent an artist name, album name and
ignoring everything else.

The testing suite has been extended with a few examples of albums exhibiting problems with the way matching was done prior to this commit.

This code resolves a problem with some of the albums not being matched
by other heuristics in the get_album_dir() method by taking slightly
different approach. It emulates what humans do - mentally break down the
name into logical chunks that represent an artist name, album name and
ignoring everything else.

The testing suite has been extended with a few examples of albums
exhibiting problems with the way matching was done prior to this commit.
Fixes:

2024-11-17 10:48:20.315 ERROR (MainThread) [music_assistant] Error doing task: Task exception was never retrieved
Traceback (most recent call last):
  File "/home/skrobul/devel/music-assistant-server/music_assistant/providers/filesystem_local/__init__.py", line 1014, in _parse_album
    if images := await self._get_local_images(folder_path):
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/skrobul/devel/music-assistant-server/music_assistant/providers/filesystem_local/__init__.py", line 1032, in _get_local_images
    if item.name in ImageType:
       ^^^^^^^^^^^^^^^^^^^^^^
  File "/run/current-system/sw/lib/python3.11/enum.py", line 742, in __contains__
    raise TypeError(
TypeError: unsupported operand type(s) for 'in': 'str' and 'EnumType'
Copy link
Member

@marcelveldt marcelveldt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

@marcelveldt marcelveldt changed the title Improve accuracy of matching album to dirname Fix: Improve accuracy of matching album in directory structure for local filesystem Nov 20, 2024
@marcelveldt marcelveldt merged commit 324d360 into music-assistant:dev Nov 20, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants