Cloudbox / autoscan

Autoscan replaces the default Plex and Emby behaviour for picking up changes on the file system.
MIT License
611 stars 53 forks source link

Windows Support #111

Closed zaraki1311 closed 2 years ago

zaraki1311 commented 3 years ago

The addition of "/" to all library paths from PLEX if they do not end with a "/" (#102) does not work for PLEX servers running on Windows machines,

This is currently an issue in my setup. I have my "arrs" installed in Docker containers with say "/tv/" as the path. My PLEX server is installed on a Windows machine with the TV folder as "T:\tv".

When Autoscan returns the libraries it is showing TV as having a path of "T:\tv/".

In the triggers I have setup a rewrite of:

from: /tv
to: T:\tv

In the Targets I have:

from: /
to: \

Say a request comes in for /tv/Show/Season 1/Show - s01e01.mkv the triggers will rename it to T:\\tv/Show/Season 1/Show - s01e01.mkv This would work if this was the path used for PLEX but it is not. The path used is the one generated from the targets. which is changed to T:\\tv\\Show\\Season 1\\Show - s01e01.mkv which does not match the section path of T:\\tv/ If I do not change the / for \ then the path is wrong for plex.

a proposed solution would be to add a few extra checks and a ELSE IF.

//Add trailing forwardslash if there is none for Unix file system.
if len(libPath ) > 0 && !strings.Contains(libPath , ":\\\\") && libPath[len(libPath)-1] != '/' {
    libPath += "/"
}

//Add trailing backslash if there is none for Windows file system.  
else if len(libPath ) > 0 && strings.Contains(libPath , ":\\\\") && libPath[len(libPath)-1] != '\\\\' {
    libPath += "\\\\"
}
m-rots commented 3 years ago

Hi,

Autoscan does not officially support Windows (although WSL2 is supported). This mainly comes from the fact that we could not land on a solid API design for targets and triggers to be either windows- or unix-based (and to then rewrite the paths accordingly).

While your suggestion makes a lot of sense, I think there are other parts of Autoscan which are not Windows-compatible as well. Think of a scenario where triggers are running on UNIX (Docker) while the Plex server is running on Windows (non-Docker). With that in mind, I will not commit your suggested change as I either want to fully support Windows with Autoscan or not at all. Not some 50/50 support.

Until we fully support Windows, I suggest you to fork the project in the meanwhile.

TheRealBix commented 10 months ago

I'd be interested by this as my PMS also is on windows, if you changed your mind :p