stokkes / plex_rcs

Plex rclone cache scanner
27 stars 6 forks source link

Scanned directory 'None' not found in Plex library #2

Open RDx55 opened 6 years ago

RDx55 commented 6 years ago

I'm not sure what I'm doing wrong, but im running this on centos 7 outside a docker.

When I look at the printout of plex_rcs I see the following error.

Scanned directory 'None' not found in Plex library Detected new file: 2018/06/02 19:23:39 INFO : tv/How to Get Away with Murder/Season 04/How to Get Away with Murder - S04E14 - The Day Before He Died.mkv: received cache expiry notification

The rclone cache is mount to /media

with subfolders tv movies

What can i do to fix the None directory issue.

RDx55 commented 6 years ago

I addressed this issue. If anyone else comes across this on Centos 7 and is using the rclone direct log instead of the syslogs.

Edit line 73 f = re.sub(r"^(.*rclone\[[0-9]+\]: )([^:]*)(:.*)$",r'\2', line)

replace it with

                        files = re.search(r": (.*)\:", line)
                        f = files.group(1)

And on config.yml set the following

PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR: "/var/lib/plexmediaserver/Library/Application Support"

zhdenny commented 5 years ago

I'm also running into this issue but have Plex in a Docker Container (the official one). I also noticed the PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR for the official Plex Docker is actually "/config/Library/Application Support".....so I went ahead and tried that too.

But I'm using vfs cache and I think your Code Edit suggestion is outdated for me. Any help?

Starting to monitor /var/log/syslog with pattern for rclone vfs
Detected directory cache expiration: Oct  9 10:51:38 BEAST-UNRAID rcloneorig[3460]: tv/The Tonight Show Starring Jimmy Fallon: forgetting directory cache

Scanned directory 'None' not found in Plex library
Detected directory cache expiration: Oct  9 10:52:38 BEAST-UNRAID rcloneorig[3460]: tv/The Tonight Show Starring Jimmy Fallon: forgetting directory cache

Scanned directory 'None' not found in Plex library
zhdenny commented 5 years ago

Got one step further.....went ahead and translated your Code Edit suggestion into the vfs section of the code....then tried agian. This time I got a little further.

Starting to monitor /var/log/syslog with pattern for rclone vfs
Detected directory cache expiration: tv/The Tonight Show Starring Jimmy Fallon
Processing section 14, folder: /tdrive/tv
/usr/lib/plexmediaserver/Plex Media Scanner: error while loading shared libraries: libboost_atomic.so.1.59.0: cannot open shared object file: No such file or directory
Detected directory cache expiration: tv/The Tonight Show Starring Jimmy Fallon
Processing section 14, folder: /tdrive/tv
/usr/lib/plexmediaserver/Plex Media Scanner: error while loading shared libraries: libboost_atomic.so.1.59.0: cannot open shared object file: No such file or directory

But when I bash into the Plex docker, /usr/lib/plexmedia/server/libboost_atomic.so.1.59.0 does in fact exist......So not sure what the problem is there. I can see it is actually detecting the correct Plex section (14) for my TV Shows.....just have no clue about that error that follows though.

Any ideas?

zhdenny commented 5 years ago

I believe the issue has to do with needing

LD_LIBRARY_PATH=/usr/lib/plexmediaserver ; export LD_LIBRARY_PATH

in the docker exec command....I just don't know how to do that.

source: https://forums.plex.tv/t/libboost_system-so-1-59-0-missing-but-are-in-folder/141985/7

zhdenny commented 5 years ago

Finally got this thing to work. Had to do some changes to the script.

  1. rclone logs changed the wording from "forgetting" to "invalidating". Or I dunno, maybe both are used. Had to change code to reflect this
  2. Had to change code as @RDx55 recommends
  3. I had to alter the docker exec command. See below:

change: call(["/usr/bin/docker", "exec", "-i", cfg['container'], "/usr/lib/plexmediaserver/Plex Media Scanner", "--scan", "--refresh", "--section", section_id, "--directory", directory])

to: call(["/usr/bin/docker", "exec", "-it", "PlexMediaServer", "bash", "-c", "export LD_LIBRARY_PATH=/usr/lib/plexmediaserver;/usr/lib/plexmediaserver/Plex\ Media\ Scanner" " --scan" " --refresh" " --section {0} --directory {1}".format(section_id, directory)])

Also worth noting is this line in the script: scan(os.path.dirname(f))

In the rclone logs I see, an expired cache notification does not display the FILENAME of the new item, but rather, the path where that new item exists.......This leads to some problems scanning where the script will not scan the exact directory where the new file exists.....instead, it will scan one directory above it. This can lead to some unnecessary scanning. A perfect example is when a movie is downloaded, the movie will commonly be placed in its own folder [ie /movies/Batman (1992)/Batman (1992).mkv]. The script will scan the entire /movies folder in this case....instead of the Batman (1992) folder.

Not sure how to fix that.