AudioMuse-AI icon indicating copy to clipboard operation
AudioMuse-AI copied to clipboard

[FEATURE] Provider migration - File Path mapping

Open take-a-CHANCE opened this issue 7 months ago • 12 comments

Is your feature request related to a problem? Please describe. When trying to migrate from one provider to another, if the same library is mapped on a new provider in a slightly different way (going from bare metal to docker, for example) it will fail to match even when expanding the search to match by title+artist

Describe the solution you'd like It would be great if we could say "hey in the existing file paths, replace part of it with this" ie: "/data/media/music/{{artist}}/{{album}} maps to /music/{{artist}}/{{album}}"

Describe alternatives you've considered I could probably re-map my data in navidrome or just pull in the fresh analysis I did when I was planning this migration manually but this would provide more flexibility going forward

Additional context Love that this feature was added!

take-a-CHANCE avatar Apr 21 '26 14:04 take-a-CHANCE

Hi and thanks for the feedback. The actual functionality can work:

  • for path: the more reliable, but path need to match.
  • for metadata: less reliable but overcome the path.

@rendyhd do you think is easy to implement something that strip away the root of the path for the match? Off course then from artist and above the must match otherwise it become difficult.

NeptuneHub avatar Apr 21 '26 15:04 NeptuneHub

I actually expect this example to match already. @take-a-CHANCE are you saying it doesn't auto-detect with this example? And you're using Real Path in Navidrome (default Navidrome setting makes up a path).

What happens with your example:

  • Source: /data/media/music/artist/album/track.mp3
  • Target: /music/artist/album/track.mp3

The tool has two ways to compare paths:

Method 1: "Path" match (the strict one): It strips off known root folders (like /data/, /music/, /media/music/) and compares what's left.

  • Source becomes: media/music/artist/album/track.mp3 (only /data/ gets stripped)
  • Target becomes: artist/album/track.mp3
  • These don't match

Method 2: "Tail" match (the fallback): It just looks at the last 3 folders/file of each path and compares those.

  • Source tail: artist/album/track.mp3
  • Target tail: artist/album/track.mp3
  • These match

Result: The song gets matched and migrated correctly. In the dry-run screen it shows up under "matched by path tail" instead of "matched by path". Both are real matches, the label is just telling you which method found it.

When it would fail: If the folder structure on either side doesn't have at least artist/album/filename as the final three pieces, the tail match can't work and you'd fall through to metadata matching (title/artist/album text).

rendyhd avatar Apr 21 '26 17:04 rendyhd

Going to do some more testing. Here are some real paths for files: Jellyfin (current configured media provider): /media/plex/music/Vance Joy/Nation of Two (2018)/01 - Call If You Need Me.flac Navidrome (via web UI info): /music/Vance Joy/Nation of Two (2018)/01 - Call If You Need Me.flac

Report real path is turned on Image and import UI confirms this: Image

Nothing is matching: Image Image

I decided to watch logs while clicking the buttons and I'm not sure if it's actually probing my navidrome server correctly or if I have a server config issue:

[INFO]-[21-04-2026 19-04-49]-API request: POST /api/migration/dry-run
[WARNING]-[21-04-2026 19-04-49]-Navidrome User or Password is not configured.
[ERROR]-[21-04-2026 19-04-49]-Navidrome credentials not configured. Cannot make API call.
[ERROR]-[21-04-2026 19-04-49]-Failed to fetch music folders from Navidrome or response format unexpected.
[WARNING]-[21-04-2026 19-04-49]-Folder filtering is active, but no matching folders were found on the server. Returning no songs.
[INFO]-[21-04-2026 19-04-49]-API request: GET /api/migration/session/3
[INFO]-[21-04-2026 19-04-49]-API request: GET /api/migration/matched-albums/3```

I just updated to 1.x yesterday, so still have env vars for my media server set. I'll go through and remove those from my docker compose to see if they're causing issues

take-a-CHANCE avatar Apr 21 '26 19:04 take-a-CHANCE

removed the env vars but still failing on "Navidrome credentials not configured. Cannot make API call." despite it passing auth to the server successfully (otherwise the player in Navidrome would not show up)

take-a-CHANCE avatar Apr 21 '26 19:04 take-a-CHANCE

Thanks for sharing! Looks like a bug indeed, if step 1 successfully authenticates to Navidrome, it's very weird step 3 doesn't anymore. Let me see if I can replicate. Any logs before that that say something?

edit: think I found it, the ones you shares already helped!

edit2: @take-a-CHANCE you have MUSIC_LIBRARIES set for you source provider?

rendyhd avatar Apr 21 '26 19:04 rendyhd

@rendyhd I do have those set for my Jellyfin library, just limiting it to "Music" and excluding some holiday music from being included in mixes

edit: I see that now in the warning for folder filtering being enabled, the library is called Music in both setups as a note

edit2: removed that configuration option in the settings, saved and now it matched the vast majority of my library :) Image

[INFO]-[21-04-2026 14-30-41]-API request: GET /api/migration/session/6
[INFO]-[21-04-2026 14-30-41]-API request: GET /api/migration/session/6
[INFO]-[21-04-2026 14-30-42]-API request: GET /api/migration/matched-albums/6
[INFO]-[21-04-2026 14-30-42]-Map JSON cache built: 9003 total items; cache sizes: {'100': 9003, '75': 6752, '50': 4501, '25': 2250}
[INFO]-[21-04-2026 14-30-42]-Background map JSON cache build finished.
[INFO]-[21-04-2026 14-30-51]-API request: POST /api/migration/dry-run

edit3:

the library is called Music in both setups as a note

This was not true, it was "Music Library" on navidrome

take-a-CHANCE avatar Apr 21 '26 19:04 take-a-CHANCE

That's great, thanks for confirming! Need to look into this one, there's a bug that we don't pass credentials to _get_target_music_folder_ids, but in general we pbb need to think about how we deal with Music Libraries and map those (I'll bet we'll come across examples where people name it differently).

rendyhd avatar Apr 21 '26 19:04 rendyhd

Went forward with the migration and it seems to have worked 👍 I edited my previous comment but the libraries were actually different names which may have caused the issue

take-a-CHANCE avatar Apr 21 '26 19:04 take-a-CHANCE

Happy it worked! The bug report is still valid, we need to fix matching libraries when they're filtered :)

rendyhd avatar Apr 21 '26 20:04 rendyhd

If anyone else have this issue, the actual workaround is:

  • remove the MUSIC_LIBRARY filter BEFORE doing the migration
  • add them back after the migration with the new Music Server library name

In the meantime @rendyhd is working on an implementation to have them directly "selectable" in the UI of the Migration page.

NeptuneHub avatar Apr 22 '26 10:04 NeptuneHub

we fixed this one @NeptuneHub

rendyhd avatar May 05 '26 20:05 rendyhd

Fix released in v1.1.1 that is actually building. I'm going to close this bug but in case any other issue please feel free to open a new one.

Thanks also @rendyhd for have developed it.

NeptuneHub avatar May 05 '26 21:05 NeptuneHub