Skip to content

Sonarr: anime root folder is always discarded because the override check compares against the anime directory instead of the default #3410

Description

@Raffa2001

Summary

With activeAnimeDirectory configured, anime requests are still added to Sonarr
using the default root folder. The anime directory is selected correctly and
then immediately overwritten by the request's own rootFolder, which the UI
stores as the server's default directory.

The equivalent Radarr branch in the same file does not have this problem — it
compares the override against the default directory. The Sonarr branch compares
it against the already-resolved value.

Where

server/subscriber/MediaRequestSubscriber.ts (current develop).

Sonarr, ~line 598:

let rootFolder =
  isAnime && sonarrSettings.activeAnimeDirectory
    ? sonarrSettings.activeAnimeDirectory     // -> /data/media/anime
    : sonarrSettings.activeDirectory;
...
if (
  entity.rootFolder &&
  entity.rootFolder !== '' &&
  entity.rootFolder !== rootFolder            // <-- compares to the RESOLVED value
) {
  rootFolder = entity.rootFolder;             // -> back to /data/media/tv
}

Radarr, ~line 249, for contrast:

if (
  entity.rootFolder &&
  entity.rootFolder !== '' &&
  entity.rootFolder !== radarrSettings.activeDirectory   // <-- compares to the DEFAULT
) {

For anime the two are different by definition, so a stored rootFolder that is
merely the default is treated as a deliberate override and always wins. The
anime directory can therefore never take effect for a request that carries one.

Observed

Sonarr server settings:

activeDirectory /data/media/tv
activeAnimeDirectory /data/media/anime
activeProfileId 7
activeAnimeProfileId 4

Request row in the database:

id=57  type=tv  rootFolder='/data/media/tv'  profileId=4

What was sent to Sonarr (from the debug log):

rootFolderPath    '/data/media/tv'      <-- default, not the anime directory
qualityProfileId  4                     <-- anime profile, correctly applied
seriesType        'anime'               <-- detected as anime

So anime detection works and the anime profile is applied; only the
directory is lost. Two consecutive anime requests reproduced it, and both had
to be moved by hand in Sonarr afterwards.

Version: v3.4.1 (latest release at the time of writing). The logic above is
unchanged in develop; commit 93c0b6a (decouple anime root folder routing from seriesType) touches the selection but not the override comparison.

Suggested fix

Make the Sonarr branch match the Radarr one:

-          entity.rootFolder !== rootFolder
+          entity.rootFolder !== sonarrSettings.activeDirectory

An explicit override that genuinely differs from the default still wins; one
that merely echoes the default no longer defeats the anime directory.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions