I have no idea with batch files..that script you run as service with libreelec and it monitors your movie folder...
so let me try to explain
create directory
create a file in
/storage/.config/scripts/inotify.sh
with the below code and name it inotify.sh , could be anywhere under storage this is just an example
#!/bin/sh
monitor() {
/storage/.kodi/addons/virtual.system-tools/bin/inotifywait -m -r -e close_write,delete --format "%e %T %w%f" --fromfile /storage/.config/scripts/paths --timefmt "%d_%b_%Y_%T_%Z" --exclude '(\.jpg|\.nfo|\.edl|\.removing|\.logo.txt)' |
while read event; do
if [[ $event = "CLOSE_WRITE,CLOSE" ]]; then
kodi-send --host=192.168.1.106 --port=8080 --action="UpdateLibrary"
kodi-send --host=192.168.1.107 --port=8080 --action="UpdateLibrary"
kodi-send --host=192.168.1.108 --port=8080 --action="UpdateLibrary"
kodi-send --host=192.168.1.109 --port=8080 --action="UpdateLibrary"
elif [[ $event = "DELETE" ]]; then
kodi-send --host=192.168.1.106 --port=8080 --action="CleanLibrary"
kodi-send --host=192.168.1.107 --port=8080 --action="CleanLibrary"
kodi-send --host=192.168.1.108 --port=8080 --action="CleanLibrary"
kodi-send --host=192.168.1.109 --port=8080 --action="CleanLibrary"
fi
done
}
monitor &
Display More
then create another file in same directory /storage/.config/scripts and name it "paths"
in this file put the paths to your movie/shows folder..just one under the other...you can monitor how many folders you want..
as you can see the script above points to this file with the following line --fromfile
--fromfile /storage/.config/scripts/paths
contents of paths file example;
/var/media/HDD/Tv_Shows_Recordings
/var/media/HDD/Movies
etc
etc
etc
Then you need to start inotify.sh on startup either with autostart.sh or service via system.d
Now if your movie folders are on a remote location you might need to mount that path to the box you will be running this script from..
You need to install virtual.system-tools addon from LibreElec Repo for this to work
Also you basically don't need the part
datetime watched_filename
I m using that in my script as my script is much more then just that and has logging..but don t complicate things for now.you can leave as is..still works.