Commit 202a02d
authored
Skip stale artist paths during filesystem track parsing (#4191)
# What does this implement/fix?
Fixes library sync aborting on every track whose artist has a stale
folder path stored in the library.
When an artist folder on disk is renamed - typically from display-name
style (`Nina Simone`) to sort-name style (`Simone, Nina`) - the artist's
provider mapping in the library database keeps the old path in its `url`
field. `_parse_artist` trusted that stored path without verifying it
exists, so the artwork scan (`_get_local_images` -> `sorted_scandir`)
raised `FileNotFoundError`, which aborted sync processing for **every
track by that artist**, on **every sync**:
```
ERROR [music_assistant.Filesystem (local disk)] Error processing Simone, Nina/1987 Live At Ronnie Scott's [album; live] []/12. My Baby Just Cares for Me.mp3 - [Errno 2] No such file or directory: '/my-music/Nina Simone'
```
The stale path can never self-heal: `set_provider_mappings` only
overwrites `url` when the incoming value is non-None, so once a bad path
is stored it persists until the row is deleted. This surfaces as user
reports of "tracks with commas in the path fail to sync/analyze" because
sort-name folder layouts are exactly the rename pattern that triggers
it.
The fix verifies the resolved artist path exists before hunting for
`artist.nfo`/artwork in it, degrading to "no folder metadata" instead of
failing the track. This covers all sources of a stale path (stored
mapping url, the `artist_path` parameter from `get_artist`, and folder
matching).
Includes a regression test that reproduces the exact failure (stale
`url="Nina Simone"` with the folder on disk renamed to `Simone, Nina`)
plus a test confirming valid stored paths still resolve.
Note: the bug is present in `stable` (2.9.0) as well - the relevant code
is identical, so this may be a candidate for `backport-to-stable`.
**Related issue (if applicable):**
- n/a (reported via user logs)
## Types of changes
- [x] Bugfix (non-breaking change which fixes an issue) — `bugfix`
- [ ] New feature (non-breaking change which adds functionality) —
`new-feature`
- [ ] Enhancement to an existing feature — `enhancement`
- [ ] New music/player/metadata/plugin provider — `new-provider`
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected) — `breaking-change`
- [ ] Refactor (no behaviour change) — `refactor`
- [ ] Documentation only — `documentation`
- [ ] Maintenance / chore — `maintenance`
- [ ] CI / workflow change — `ci`
- [ ] Dependencies bump — `dependencies`
## Checklist
- [x] The code change is tested and works locally.
- [x] `pre-commit run --all-files` passes.
- [x] `pytest` passes, and tests have been added/updated under `tests/`
where applicable.
- [ ] For changes to shared models, the companion PR in
`music-assistant/models` is linked.
- [ ] For changes affecting the UI, the companion PR in
`music-assistant/frontend` is linked.
- [x] I have read and complied with the project's [AI
Policy](https://github.com/music-assistant/.github/blob/main/AI_POLICY.md)
for any AI-assisted contributions.
- [ ] I have raised a PR against the documentation repository targeting
the main or beta branch as appropriate.1 parent 49f57ad commit 202a02d
2 files changed
Lines changed: 121 additions & 1 deletion
File tree
- music_assistant/providers/filesystem_local
- tests/providers/filesystem
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1302 | 1302 | | |
1303 | 1303 | | |
1304 | 1304 | | |
1305 | | - | |
| 1305 | + | |
1306 | 1306 | | |
1307 | 1307 | | |
1308 | 1308 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
0 commit comments