Skip to content

[Feature] Media server path mapping can hold only one pair, so separately mounted libraries cannot all be mapped #223

Closed

Description

@azuretek

Summary

Let a media server's path mapping hold more than one from:to pair, so a server that mounts each library under its own root can be mapped for all of them.

What problem does this feature solve?

Since 1.16.0 (#219) Sublarr asks Plex for a partial scan of the folder that got the new subtitle, in the library whose root contains it. That only works when the mapped path starts with one of Plex's library roots. When it does not, the subtitle ends in a full scan of every library of that type.

The media server path_mapping field takes exactly one from:to pair (MediaServer.apply_path_mapping in backend/mediaserver/base.py). That covers a server that sees the whole media tree under one other prefix, but not one that mounts each library separately, which is a common Docker layout:

Library Sublarr sees Plex sees
TV /media/tv /data/tv
Movies /media/movies /data/films

Either pair can be entered, never both, so one library always misses. A single broader pair cannot help when the library folder names differ between the two containers, as they do here (movies against films), or only in case.

There is also no way to enter two today: a second pair after a separator is not parsed, it becomes part of to_path. With /media/tv:/data/tv;/media/movies:/data/films, a TV episode maps to /data/tv;/media/movies:/data/films/Show/..., which no library contains.

On an install with this layout running 1.16.0, mapping the TV root makes TV subtitles a partial scan of one season folder, and every movie subtitle still ends in a full scan of the movie library, because the movie root cannot be mapped as well.

What do you propose?

Accept several pairs separated by ;, the separator SUBLARR_PATH_MAPPING already uses for the *arr connections, and apply the pair whose from_path is the longest prefix of the file path:

/media/tv:/data/tv;/media/movies:/data/films
  • A single pair behaves exactly as it does now, so existing configs are unchanged.
  • Longest prefix wins, so /media:/data;/media/anime:/anime maps anime to /anime in either order.
  • Spaces around a pair and a trailing ; are ignored.
  • It lives in apply_path_mapping, so Plex, Jellyfin, Kodi and Shoko all get it, and the field help text and UI strings say how to enter several.

I have a patch with tests ready and will open a PR linked to this issue.

Alternatives considered

  • Mount the media in Sublarr at Plex's paths. That breaks the paths Sonarr and Radarr send in webhooks, which Sublarr resolves without mapping when it shares their mounts. The *arr side and the media server side then disagree instead.
  • One media server entry per library, each with its own mapping. refresh_all notifies every enabled entry, so the entry whose mapping misses falls back to a full scan on every subtitle, which is the cost this is trying to remove.
  • Reuse = as the pair separator to match SUBLARR_PATH_MAPPING. That changes the meaning of every existing media server mapping, which all use :. Keeping : within a pair and borrowing only the ; list separator keeps every current config valid.

Activity

  1. Abrechen2 commented on Oct 24, 2026

    @Abrechen2
    Owner

    Shipped in 1.17.0 — thanks for the issue and the patch (#224), which went in as is.

    The media server path mapping now takes several from:to pairs separated by ;, and the longest matching from wins. A single pair works as before. The release also adds a related fix: a pair matches whole folders only, so /media/movies:/data/films no longer rewrites /media/movies-4k/... too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions