K22R8CT 24 Posted August 13, 2019 Share Posted August 13, 2019 (edited) I found a little utility to forward my NAS's (linux) inotify messages to a receiver on my Mac (where Emby runs) that triggers FSEvents: https://github.com/mhallin/notify-forwarder This allows changes on the NAS file system to be picked up in real-time by Emby. Here are some basic instructions: On NAS # Fetch and build cd git clone https://github.com/mhallin/notify-forwarder.git cd notify-forwarder make sudo cp _build/notiify-forwarder /usr/local/bin # script sudo emacs /usr/local/bin/notify-forwarder.sh # Paste the following, specifying your own parent directories # (subdirectory changes are automatically picked up) and the IP of your emby server #!/bin/bash until /usr/local/bin/notify-forwarder watch -c <ip of emby server> <Full path to NAS media parent directory> <Full path to Mac media parent directory>; do echo "notify-forwarder crashed with exit code $?. Restarting..." >&2 sleep 1 done # Set permissions sudo chmod a+x /usr/local/bin/notify-forwarder.sh # Add cron entry as quick and dirty startup trigger crontab -e # Paste @[member="reboot"] /usr/local/bin/notify-forwarder.sh On Mac # Fetch and build cd git clone https://github.com/mhallin/notify-forwarder.git cd notify-forwarder make sudo cp _build/notify-forwarder /usr/local/bin # script sudo emacs /usr/local/bin/notify-forwarder.sh # Paste the following #!/bin/bash /usr/local/bin/notify-forwarder receive # Set permissions sudo chmod a+x /usr/local/bin/notify-forwarder.sh # Create plist startup script substituting your <username> sudo emacs /Library/LaunchDaemons/com.<username>.notify-forwarder.plist # Paste the following, again substituting <username> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>EnvironmentVariables</key> <dict> <key>PATH</key> <string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:</string> </dict> <key>Label</key> <string>com.<username>.notify-forwarder</string> <key>Program</key> <string>/usr/local/bin/notify-forwarder.sh</string> <key>RunAtLoad</key> <true/> <key>LaunchOnlyOnce</key> <true/> </dict> </plist> # Set permissions, again substituting <username> sudo chown root:wheel /Library/LaunchDaemons/com.<username>.notify-forwarder.plist sudo chmod 644 /Library/LaunchDaemons/com.<username>.notify-forwarder.plist # Load it, again substituting <username> sudo launchctl load -w /Library/LaunchDaemons/com.<username>.notify-forwarder.plist Test It # Install fswatch (monitoring utility) on your Mac to test # (I'm using brew) brew install fswatch # Run it fswatch <Full path to Mac media parent directory> # Touch a file on your NAS and in a short time fswatch should pick it up. # If it does Emby will (at least the current version) touch <Full path to NAS media parent directory>/test.txt Reboot NAS and Mac to confirm scripts run at startup then in Emby reduce the frequency of Scan Media Library to something reasonable. DISCLAIMERS and TO DO I can't vouch for the propriety of this utility For some reason my Mac script doesn't start on boot, I have to load it manually. If anyone knows why I'd like to know! Hope this is helpful. EDIT 8/14/19 - Apparently the forwarder (NAS) is slightly buggy and errors out after a while. I've updated the bash script to respawn it when that happens EDIT 8/21/19 - Got script to load at startup via LaunchDaemon Edited August 21, 2019 by Anon28109 1 Link to comment Share on other sites More sharing options...
Luke 37049 Posted August 13, 2019 Share Posted August 13, 2019 That's great info, thanks ! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now