Skip to content

fix(arrs): find a Sonarr episode by release name when its path matches no series - #1067

Open
firestaerter3 wants to merge 1 commit into
kipsilabs:mainfrom
firestaerter3:up/sonarr-parse-fallback
Open

firestaerter3 wants to merge 1 commit into
kipsilabs:mainfrom
firestaerter3:up/sonarr-parse-fallback

Conversation

@firestaerter3

Copy link
Copy Markdown
Contributor

Fixes #1066.

When the repair cannot find the series by the file's mount path, it now asks Sonarr to parse the release name (the release folder, or the file name when the file sits directly in a category folder). It only acts when the result is unambiguous:

  • the parsed episodes link to one episode file whose sceneName is this release: the normal repair runs on that file (blocklist, delete, search);
  • none of the parsed episodes has a file: they are searched through the failure breaker, and nothing is blocklisted or deleted.

Everything else keeps the current behaviour: Sonarr already uses another release, the file has no scene name, episodes of more than one series, or hasFile without a file id.

ParseContext is added to SonarrClient. The legacy (v3) adapter gets it from starr. The native (v5) adapter returns ErrParseUnsupported for now, because I could not confirm the v5 parse endpoint, so on v5 the fallback does nothing.

Tests: internal/arrs/scanner/sonarr_parse_fallback_test.go covers the release-name rules and each decision. go vet ./internal/... ./cmd/... and go test ./internal/arrs/... pass. On the 26 files from the issue it would repair 9 and search 8; the other 9 are left alone (7 where Sonarr uses another release, 2 with no scene name).

…s no series

When a repair cannot find the series by the file's mount path, ask Sonarr to
parse the release name (the release folder, or the file name when it sits
directly in a category folder) and act only when the answer is unambiguous:

- the parsed episodes link to one episode file whose sceneName is this
  release: the normal repair runs on that file (blocklist, delete, search);
- none of the parsed episodes has a file: search them through the failure
  breaker; nothing is blocklisted or deleted.

Anything else (Sonarr already uses another release, the file has no scene
name, episodes of more than one series, hasFile without a file id) keeps the
old behaviour. Sonarr stores the path of its own library entry, which is often
a symlink into the mount, so the path lookup alone misses these files and the
broken file was left in place with nothing searched.

ParseContext is added to SonarrClient. The legacy (v3) adapter gets it from
starr; the native (v5) adapter returns ErrParseUnsupported for now, so on v5
the fallback does nothing and the old behaviour stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

Sonarr repair gives up on files when the library is symlinked into the mount ("No series found in Sonarr matching file path")

1 participant