JakeWharton / plex-orphaned-files

Find files in your Plex libraries which are not indexed
Apache License 2.0
117 stars 6 forks source link

Doesn't seem to work well with Windows #16

Open Sammaye opened 2 years ago

Sammaye commented 2 years ago

I run using docker like so:

PS C:\Users\x> docker run -v X:\Films:/mnt/films jakewharton/plex-orphaned-files:1 exec plex-orphaned-files --base-url https://x:32400/ --token x--folder-mapping /mnt/films:/media/films Films
Exception in thread "main" java.nio.file.NoSuchFileException: X:\Films
        at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
        at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
        at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:144)
        at sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99)
        at java.nio.file.Files.readAttributes(Files.java:1737)
        at java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:219)
        at java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)
        at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322)
        at java.nio.file.FileTreeIterator.<init>(FileTreeIterator.java:72)
        at java.nio.file.Files.walk(Files.java:3574)
        at java.nio.file.Files.walk(Files.java:3625)
        at com.jakewharton.plex.OrphanedFiles.find(orphanedFiles.kt:50)
        at com.jakewharton.plex.OrphanedFiles$find$1.invokeSuspend(orphanedFiles.kt)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
        at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:84)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
        at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
        at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
        at com.jakewharton.plex.OrphanedFilesCommand.run(main.kt:109)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:171)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:16)
        at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:395)
        at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:392)
        at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:410)
        at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:435)
        at com.jakewharton.plex.Main.main(main.kt:125)

So I change to:

PS C:\Users\x> docker run -v X:\Films:/mnt/films jakewharton/plex-orphaned-files:1 exec plex-orphaned-files --base-url https://x:32400/ --token x--folder-mapping X:\Films:/mnt/films Films
Exception in thread "main" java.nio.file.NoSuchFileException: \Films:/mnt/films:\Films
        at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
        at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
        at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:144)
        at sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99)
        at java.nio.file.Files.readAttributes(Files.java:1737)
        at java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:219)
        at java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)
        at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322)
        at java.nio.file.FileTreeIterator.<init>(FileTreeIterator.java:72)
        at java.nio.file.Files.walk(Files.java:3574)
        at java.nio.file.Files.walk(Files.java:3625)
        at com.jakewharton.plex.OrphanedFiles.find(orphanedFiles.kt:50)
        at com.jakewharton.plex.OrphanedFiles$find$1.invokeSuspend(orphanedFiles.kt)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
        at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:84)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
        at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
        at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
        at com.jakewharton.plex.OrphanedFilesCommand.run(main.kt:109)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:171)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:16)
        at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:395)
        at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:392)
        at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:410)
        at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:435)
        at com.jakewharton.plex.Main.main(main.kt:125)

I think this doesn't transcode X: very well in Windows paths, is there a way to fix this?

Sammaye commented 2 years ago

A seemingly quick fix to this would be to change the separator character so something that cannot be confused as a windows path separator or use regex look ahead to not split if succeeded by \

JakeWharton commented 2 years ago

Yeah I'm curious how Docker is doing this. I wonder if they're taking the last colon rather than the first to split the argument. I will look this week.