summaryrefslogtreecommitdiffstats
path: root/abs/core/mythtv
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2015-07-28 00:49:31 (GMT)
committerBritney Fransen <brfransen@gmail.com>2015-07-28 00:49:31 (GMT)
commit1ac5d8dcb5e1fb78504adffef1ec0857340459dc (patch)
tree68fef3fbbcb4d076bf5a2e6f10a96f5a3732b99e /abs/core/mythtv
parent9ffa52f396be860f9c0bd4b9fd9eaf5cebff0670 (diff)
downloadlinhes_pkgbuild-1ac5d8dcb5e1fb78504adffef1ec0857340459dc.zip
linhes_pkgbuild-1ac5d8dcb5e1fb78504adffef1ec0857340459dc.tar.gz
linhes_pkgbuild-1ac5d8dcb5e1fb78504adffef1ec0857340459dc.tar.bz2
google-chrome: update to 44.0.2403.107
Diffstat (limited to 'abs/core/mythtv')
-rw-r--r--abs/core/mythtv/stable-0.27/mythtv/recordings91
1 files changed, 90 insertions, 1 deletions
diff --git a/abs/core/mythtv/stable-0.27/mythtv/recordings b/abs/core/mythtv/stable-0.27/mythtv/recordings
index 7fdde51..382fc4c 100644
--- a/abs/core/mythtv/stable-0.27/mythtv/recordings
+++ b/abs/core/mythtv/stable-0.27/mythtv/recordings
@@ -1,5 +1,94 @@
#!/bin/bash
+
+#START=$(date +%s)
+
+#check if mythbackend is running and was just started
+for i in 1 2
+do
+if [ `cat /etc/sv/mythbackend/supervise/pid` ]
+then
+ now=$(date +%s)
+ mythbackendStartTime=`stat -c %Y /etc/sv/mythbackend/supervise/pid`
+ if [[ $(( $now - $mythbackendStartTime )) -lt 59 ]]
+ then
+ #echo "mythbackend started less than a minute ago. Sleeping..."
+ sleep 60
+ fi
+else
+ #echo "mythbackend not running. exiting."
+ exit
+fi
+done
+
if [ -f /usr/share/mythtv/contrib/user_jobs/mythlink.pl ]
then
- su - mythtv -c "perl /usr/share/mythtv/contrib/user_jobs/mythlink.pl --link /data/storage/disk0/media/recordings"
+ recdir="/data/storage/disk0/media/recordings"
+ tmprecdir="/data/storage/disk0/media/tmp/recordings"
+ su - mythtv -c "perl /usr/share/mythtv/contrib/user_jobs/mythlink.pl --format '%U/%T/%T %- S%ssE%ep %- %oY-%om-%od %- %S' --link '$tmprecdir'"
+
+ #delete Deleted recgroup and move files out of other dirs
+ if [ -d "$tmprecdir/Deleted" ]
+ then
+ rm -r "$tmprecdir/Deleted"
+ fi
+ #move all links in recgroup dirs out to tmprecdir
+ for recgroup in $tmprecdir/*
+ do
+ if [ -d "$recgroup" ]
+ then
+ rsync -a "$recgroup/" "$tmprecdir"
+ rm -r "$recgroup"
+ fi
+ done
+ #replace SE if no season/episode is in myth
+ for link in $tmprecdir/**/*\ -\ SE\ -\ *
+ do
+ newlink=`echo "$link" | sed 's/ - SE - / - /'`
+ mv "$link" "$newlink"
+ done
+ #replace SEyy if no season is in myth
+ for link in $tmprecdir/**/*\ -\ SE[0-9][0-9]\ -\ *
+ do
+ newlink=`echo "$link" | sed 's/ - SE/ - S00E/'`
+ mv "$link" "$newlink"
+ done
+ #replace SyyE if no episode is in myth
+ for link in $tmprecdir/**/*\ -\ S[0-9][0-9]E\ -\ *
+ do
+ newlink=`echo "$link" | sed 's/E - /E00 - /'`
+ mv "$link" "$newlink"
+ done
+ #replace blank original date
+ for link in $tmprecdir/**/*\ -\ 0000-00-00\ -\ *
+ do
+ newlink=`echo "$link" | sed 's/ - 0000-00-00 - / - /'`
+ mv "$link" "$newlink"
+ done
+
+ #change symlinks mtime to match the file it is linked to
+# for link in $tmprecdir/**/*
+# do
+# if [ -L "$link" ]
+# then
+# file=`readlink "$link"`
+# touch -hr "$file" "$link"
+# fi
+# done
+
+ #sync tmprecdir to recdir
+ #rsync -aOP --delete --ignore-existing "$tmprecdir/" "$recdir/"
+ rsync -aOP --delete "$tmprecdir/" "$recdir/"
+
+ #check if plex media server is running
+ if [[ `pidof "Plex Media Server"` ]]
+ then
+ #get plex section and update
+ /usr/LH/bin/plexmediascanner.sh -l | grep -i myth | cut -d: -f1 | while read -r line ; do
+ /usr/LH/bin/plexmediascanner.sh --scan --refresh --section $line
+ done
+ fi
fi
+
+#END=$(date +%s)
+#DIFF=$(( $END - $START ))
+#echo "It took $DIFF seconds"