Skip to main content

A utility to trigger Plex partial-scans on NFS configurations, on which inotify is not supported

Project description


Preview

Plex NFS Watchdog

A utility to trigger Plex partial-scans on NFS configurations, on which inotify is not supported



Table of Contents
  1. 📖 About The Project
  2. ⚙️ Getting Started
  3. 💫 Contributing
  4. 🤝 Support
  5. ⚠️ License
  6. 🛠️ Built With

:book: About The Project

Inotify is a Linux kernel subsystem that allows monitoring changes to files and directories in real-time. It is commonly used by applications to watch for changes in files or directories and respond accordingly.

Plex makes use of inotify to perform partial scans when a file is added or removed from a directory. This allows Plex to update its library without having to perform a full scan.

Running Plex Media Server with the library located on Network File System (NFS) mounted directories will not trigger such partial scans because inotify doesn't work on NFS. When a file is changed on an NFS mount, it doesn't trigger an inotify event on the client side.

Plex NFS Watchdog is a utility that can be installed on the machine that produces inotify to monitors directories for changes and triggers a partial scan on the Plex Media Server instance installed in a different machine when a change is detected by invoking the Plex API.

(back to top)

:gear: Getting Started

To use Plex NFS Watchdog you must ensure that on all machines involved the Plex's Library sections use the same folder name. The folder path can be different on each machine, but the folder name must be the same.

This is important because the utility will use the folder name to trigger the partial scan.

For example, if you have a library section called "Movies" and the folder name is "Movies", the utility will trigger a partial scan on the "Movies" library section when a change is detected in the "Movies" folder.

(back to top)

Prerequisites

Obtain the Plex Authentication Token for your Plex Media Server instance. You can find instructions on how to do this here.

(back to top)

Installation

You can install this tool as a Python Module using pip or executing the script directly.

  • If you want to install the tool as a Python Module:
    • Install the module using pip: pip install plex-nfs-watchdog
    • You can run the tool using: plex-nfs-watchdog
  • If you want to use the script directly:
    • Clone the repository anywhere on your pc:

      git clone https://github.com/LightDestory/PlexNFSWatchdog

    • Install the requirements using pip (create a venv if you want):

      pip install -r requirements.txt

    • Run directly from source:

      python ./src/plex_nfs_watchdog/plex_nfs_watchdog.py

(back to top)

Usage

This utility requires the following arguments to work:

Argument Role
--scan | -s Manually triggers a partial-scan on the given paths
--daemon | -d Starts a watchdog daemon to automatically triggers a partial-scan on the given paths
Requires: --interval and --listeners
--paths | -p [PATHS...] A list of folder paths
--host | -H HOST The host of the Plex server
Default: http://localhost:32400
--token | -t TOKEN The token of the Plex server
--interval | -i INTERVAL [OPTIONAL] The interval in seconds to wait between partial-scans
--listeners | -l [LISTENERS...] [OPTIONAL] The event type to watch: move, modify, create, delete, io_close, io_open
  • Manual Scan example:

    plex-nfs-watchdog --scan --paths /path/to/library_section1/section_chield1 --host http://localhost:32400 --token YOUR_TOKEN

  • Daemon Scan example:

    plex-nfs-watchdog --daemon --paths /path/to/library_section1 --host http://localhost:32400 --token YOUR_TOKEN --interval 150 --listeners move modify create delete

(back to top)

Notes

After the first successful run, a cache config file containing Plex's host and token will be created in the user's home directory. This file will be used for subsequent runs, so you don't have to provide them every time.

(back to top)

:dizzy: Contributing

If you are interested in contributing, please refer to Contributing Guidelines for more information and take a look at open issues. Ask any questions you may have and you will be provided guidance on how to get started.

Thank you for considering contributing.

(back to top)

:handshake: Support

If you find value in my work, please consider making a donation to help me create, and improve my projects.

Your donation will go a long way in helping me continue to create free software that can benefit people around the world.

Buy Me a Hot Chocolate at ko-fi.com

(back to top)

:warning: License

The content of this repository is distributed under the GNU GPL-3.0 License. See LICENSE for more information.

(back to top)

:hammer_and_wrench: Built With

(back to top)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plex_nfs_watchdog-0.0.10.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

plex_nfs_watchdog-0.0.10-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

Details for the file plex_nfs_watchdog-0.0.10.tar.gz.

File metadata

  • Download URL: plex_nfs_watchdog-0.0.10.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for plex_nfs_watchdog-0.0.10.tar.gz
Algorithm Hash digest
SHA256 813144d8824266eb7caa801161dc4ada60e4e3aade13ce6d281d663aaf4a909b
MD5 cb9ee13638143d41eb34bd3089a58b29
BLAKE2b-256 81d4573d1075f2965429886540289f4737249248d42da2bd4e323620c8aa4121

See more details on using hashes here.

File details

Details for the file plex_nfs_watchdog-0.0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for plex_nfs_watchdog-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 7e758ddc5a66f9cc75752421c9900b12ac999c04b93d4520c578eee9c094d4e0
MD5 5ba3d80ca4037973bfabf640381ee7ef
BLAKE2b-256 c3385364f9db62e57686f6e7c10ca452fc7b5c14a7b99583a2d3e99ca64131d1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page