Closed m4chine closed 1 week ago
Any error?
Run the tool without the background operator '&' to see what it does print.
No error.
$ plex-nfs-watchdog --daemon --paths /mnt/media/movies/ /mnt/media/tv --interval 150 --listeners move modify create delete INFO: Found Plex configuration from cache: /home/[user]/.local/share/plex_nfs_watchdog_cache/plex_config.json INFO: Connected to Plex server INFO: Plex version: 1.40.5.8854-f36c552fd INFO: Found 3 Plex sections: {'movies': ('Movies', '/mnt/media/movies'), 'music': ('Music', '/mnt/media/music'), 'tv': ('TV Shows', '/mnt/media/tv')} INFO: Scheduling watcher for /mnt/media/movies INFO: Scheduling watcher for /mnt/media/tv INFO: Registering inotify watcher... INFO: Ready to operate...
Are there any logs anywhere to inspect besides console out?
$ mount -l ... remote_addr:/volume1/downloads/media on /mnt/media type nfs4 (rw,relatime,vers=4.1,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=local_addr,local_lock=none,addr=remote_addr) ...
No error.
$ plex-nfs-watchdog --daemon --paths /mnt/media/movies/ /mnt/media/tv --interval 150 --listeners move modify create delete INFO: Found Plex configuration from cache: /home/[user]/.local/share/plex_nfs_watchdog_cache/plex_config.json INFO: Connected to Plex server INFO: Plex version: 1.40.5.8854-f36c552fd INFO: Found 3 Plex sections: {'movies': ('Movies', '/mnt/media/movies'), 'music': ('Music', '/mnt/media/music'), 'tv': ('TV Shows', '/mnt/media/tv')} INFO: Scheduling watcher for /mnt/media/movies INFO: Scheduling watcher for /mnt/media/tv INFO: Registering inotify watcher... INFO: Ready to operate...
Are there any logs anywhere to inspect besides console out?
From this log I can see that the watcher successfully started.
Now, try to insert some content on such libraries. You must use the Plex recommended directory-structure of a folder per show
So I wasn't questioning whether or not the process started successfully and was in fact running.
My problem is when running in plex-nfs-watchdog --daemon, it is not picking up the media additions when the process should be monitoring the two folders "-paths /mnt/media/movies/ /mnt/media/tv" for changes. I add media to mnt/media/movies or mnt/media/tv, the addition is not reflected in Plex. But I then run plex-nfs-watchdog --scan and it picks up the media that should have been picked up from the plex-nfs-watchdog --daemon process.
From the console output, "scheduling watcher "or "registering inotify watcher" is not working properly.
Am I able to properly convey my problem?
So I wasn't questioning whether or not the process started successfully and was in fact running.
My problem is when running in plex-nfs-watchdog --daemon, it is not picking up the media additions when the process should be monitoring the two folders "-paths /mnt/media/movies/ /mnt/media/tv" for changes. I add media to mnt/media/movies or mnt/media/tv, the addition is not reflected in Plex. But I then run plex-nfs-watchdog --scan and it picks up the media that should have been picked up from the plex-nfs-watchdog --daemon process.
From the console output, "scheduling watcher "or "registering inotify watcher" is not working properly.
- Add movie1 to /mnt/media/movies
- Run plex-nfs-watchdog --daemon ...
- Plex does not show movie1
- run plex-nfs-watchdog --scan
- Plex does show movie1
Am I able to properly convey my problem?
A daemon is a background service... you are doing on the wrong order:
You're not understanding what I'm saying. I understand what a daemon is.
I do not want to run plex-nfs-watchdog --scan manually. I am simply pointing out it works with my configuration. My original post points this out.
I want to run plex-nfs-watchdog --daemon. It is not working. The watcher is not detecting changes.
I did however mix up the sequence of events in my last post, the following is accurate.
plex-nfs-watchdog --daemon DOES NOT WORK, plex-nfs-watchdog --scan DOES WORK.
Does this make better sense?
Do you see the log about queueing the file? https://github.com/LightDestory/PlexNFSWatchdog/blob/master/src/plex_nfs_watchdog/modules/plex/plex_agent.py#L240
The parse_event
function is called by https://github.com/LightDestory/PlexNFSWatchdog/blob/master/src/plex_nfs_watchdog/modules/watchdog/plex_watchdog_event.py that is just an implementation of FileSystemEventHandler
by the watchdog
library.
The IO change detection
is not something that I have implementend myself, I am using the mainstream library for that.
I did some further testing.
nfsserver - running the NFS server plexserver - running plex, plex-nfs-watchdog and mounted the remote NFS share on nfsserver
When creating a folder via plexserver on the mounted NFS share, the folder is queued and works as intended.
When creating a folder via nfsserver on its local filesystem which is shared via NFS, plex-nfs-watchdog on the plexserver does not pick up the folder creation and therefor not queued and does not work as intended.
Should plexserver pickup a folder creation that was initiated via nfsserver?
Assuming we have 2 servers:
When an operation is performed on a file inside the StorageServer, StreamServer does not notice it because NFS does not provide for inotify.
That is why I developed this utility: it must be run inside the server that performs operations on the data.
So the watchdog must be started inside the StorageServer and must be able to communicate via HTTP with the StreamServer
If you want to be able to track changes on both your server you should run an instance of the watchdog inside every datastore and point all of them to the same PlexServer
Thank you! I moved the script to nfsserver/StorageServer and eventually got it working.
It took some python investigation, as the current plex-nfs-watchdog code base looks to require some newer python coding features.
For others awareness, I first tried python-3.8 and python-3.9, both producing different errors.
python-3.8 Error: TypeError: 'type' object is not subscriptable python-3.9 Error: TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
And finally got the code working on python-3.11.
Thanks again @LightDestory for your support.
Description
I cannot get the --daemon to trigger a partial scan. I tried both as a regular user and root but the daemon is not picking up changes.
When I run the manual scan, it picks up the the changes and runs a partial scan.
Reproduction
Daemon does not work:
plex-nfs-watchdog --daemon --paths /mnt/media/movies/ /mnt/media/tv --interval 150 --listeners move modify create delete &
Manual scan works:
plex-nfs-watchdog --scan --paths /mnt/media/movies/ /mnt/media/tv --interval 150 --listeners move modify create delete
Environment
Arch Linux 6.10.5-arch1-1 I did use pipx to install plex-nfs-watchdog vs. pip
Am I doing something wrong? Thanks in advance.