morpheus65535 / bazarr

Bazarr is a companion application to Sonarr and Radarr. It manages and downloads subtitles based on your requirements. You define your preferences by TV show or movie and Bazarr takes care of everything for you.
https://www.bazarr.media
GNU General Public License v3.0
2.67k stars 211 forks source link

Linux hosted Bazarr working with Windows hosted Radarr fails as a result of path separator issue between disparate environments #2555

Open LesKent opened 1 week ago

LesKent commented 1 week ago

Describe the bug I've had Windows based Radarr and Bazarr working for a long time with no issues. I'm in the process of migrating everything to Linux. I setup a new Bazarr server running under Linux to work with the existing Windows Radarr server. After getting it all configured it would synchronize with Radarr correctly but would not download any subtitles. Digging into the logs and database I was able to determine the issue is with how Windows uses '\' for the path separator and Linux using a '/'.

On Windows the path to the NAS media is : \\xxxx\movies On Linux the path to the NAS media is: /mnt/xxxx/movies

Path mapping configuration was setup in Bazarr to map Windows Radarr '\\xxxx\movies' to Linux Bazarr '/mnt/xxxx/movies" and this appeared to work correctly for scanning the disk and probing files.

An example key debug debug error, Bazarr would log during subtitle update process: bazarr.log.2024-06-25:2024-06-25 02:58:28|DEBUG |root |BAZARR no media with this path have been found in database: \\xxxx\movies\Embryo (1976)\Embryo (1976) - [WEBDL-720P][AAC 2.0][X264][imdbid=tt0074475].mkv

Yet the Path field in the table_movies table for this item has: '\\xxxx\movies\Embryo (1976)/Embryo (1976) - [WEBDL-720P][AAC 2.0][X264][imdbid=tt0074475].mkv'

Where the path separator between the directory and filename is a '/' failing to match the Windows path with the '\' separator.

Software (please complete the following information):

halali commented 1 week ago

This isn't an issue... use path mappings. If you will have other support question come to discord.

This channel is for issues only

LesKent commented 1 week ago

This isn't an issue... use path mappings. If you will have other support question come to discord.

This channel is for issues only

This is a bug. I spent many hours confirming this.

If you read my message I did path mappings correctly and the issue is the separator character stored in the database being converted by Bazarr to the POSIX separator character of the Bazarr hosted OS, that being '/' for the part in between final directory path (per movie media directory) and the title filename, which has nothing to do with path mappings which handles the media root directory mapping.

The error is because it is trying to lookup in the database a full path provided by Radarr, which uses Windows '\' separators against the database path field that is modified by Bazarr and stored with a single POSIX separator for the last part of the full path. As I stated the path mapping part works correctly for scanning the correct media directory to search for existing subtitles, both imbedded and external.

Th bottom line is the path field in the Bazarr database is storing the original Radarr Windows format path sent but Bazarr is changing only the final path separator to POSIX which is causing the lookup bug.

'\xxxx\movies\Embryo (1976)\Embryo (1976) - [WEBDL-720P][AAC 2.0][X264][imdbid=tt0074475].mkv' is not equal to '\xxxx\movies\Embryo (1976)/Embryo (1976) - [WEBDL-720P][AAC 2.0][X264][imdbid=tt0074475].mkv' the problem------------------^