Project

General

Profile

Synology pre-process script to update DLNA list, allows time shift viewing on some devices

Added by Stuart Pearson over 8 years ago

I have created a basic bash shell script that I run as a pre-processor command. When ran after a pause of 60 seconds it checks for any new files matching the chosen extension ($MATCHEXT) in the selected folder location ($TVFOLDER). Any new files will be advised to the inbuilt synology media update program (synoindex), allowing some devices (worked on Medion TV) to show the video content for programmes that are still being recorded by tvheadend. For debugging/checking purposes the script writes any new file detected to the defined log file ($LOGFILE).
Hopefully it will be useful for anyone interested in this type of function.

Stuart

-------------------------------------------------------------
#!/opt/bin/bash

LOGFILE="/volume2/Freeview/status.txt"
TVFOLDER="/volume2/Freeview/"
MATCHEXT="*.ts"

sleep 60

echo "$(date) - Updating Files (Pre): " >> $LOGFILE

for VIDEO1 in $(find $TVFOLDER -name $MATCHEXT -cmin -2);

do

DIRPATH="${VIDEO1%/*}"
echo "$DIRPATH" >> $LOGFILE
echo "$VIDEO1" >> $LOGFILE
echo "" >> $LOGFILE

done