ShokoAnime / ShokoServer

Repository for Shoko Server.
http://shokoanime.com/shoko-server/
MIT License
376 stars 74 forks source link

The 'Sync Plex Watch Status' Command Is Not Functioning on Certain Setups #1086

Open natyusha opened 10 months ago

natyusha commented 10 months ago

Thanks to Cazarr recently adding some extra logging in the daily it seems to be confirmed why the Sync Plex Watch Status command is failing to function on certain setups.

VERSION INFORMATION

Server Version: Latest Daily

Desktop Version: Latest Daily

LOG FILE

2023-08-24 14:03:52 Info  | Processing episode Infiltrators of 009-1
2023-08-24 14:03:52 Trace | Episode not found in Shoko, skipping - M:\Anime\009-1\009-1 - 01.mkv (M:\Anime\009-1\009-1 - 01.mkv)

DESCRIPTION

When running the Sync Plex Watch Status command the entire Plex library is scanned but no watched states make it back to ShokoServer (the episodes are not found). The log excerpt above coupled with the screenshot below (which shows the expected paths) should demonstrate what is going wrong. The file paths need to be converted from their local M:\Anime\009-1\009-1 - 01.mkv paths back into their server /anime/009-1/009-1 - 01.mkv paths for ShokoServer to be able to find the files.

ShokoDesktop_2023-08-24_17-46-27

STEPS TO REPRODUCE

The above example has Plex installed on Windows alongside ShokoDesktop while ShokoServer is running in a docker container on unRAID.

Cazzar commented 10 months ago

The main problem right now is trying to find a way to properly map the file to the right place.

natyusha commented 8 months ago

Couldn't this be resolved by comparing the parent foldername + filename instead of the full path like in the Plex agent?

var linPath = (@"/anime/009-1/009-1 - 01.mkv");
var linDir = Path.GetFileName(Path.GetDirectoryName(linPath));
var linFil = Path.GetFileName(linPath);
var linPar = Path.Combine(linDir, linFil);
Console.WriteLine(linPar);

Console Output: 009-1/009-1 - 01.mkv
ElementalCrisis commented 6 months ago

@Cazzar please correct me if I'm wrong but syncing does work for the following cases.

The issue seems to be when Shoko and Plex are on different systems with different OS?

Cazzar commented 6 months ago

@natyusha that will not work, as it is not the issue at all. The issue itself is the mismatch of the path separator character when plex and shoko are on differing OS systems.

The issue is a low priority ultimately