diff options
Diffstat (limited to 'abs/core/mythtv/stable-0.28/mythtv/recordings')
-rw-r--r-- | abs/core/mythtv/stable-0.28/mythtv/recordings | 50 |
1 files changed, 36 insertions, 14 deletions
diff --git a/abs/core/mythtv/stable-0.28/mythtv/recordings b/abs/core/mythtv/stable-0.28/mythtv/recordings index 984fea9..c1fe28a 100644 --- a/abs/core/mythtv/stable-0.28/mythtv/recordings +++ b/abs/core/mythtv/stable-0.28/mythtv/recordings @@ -25,49 +25,71 @@ then recdir="/data/storage/disk0/media/recordings" tmprecdir="/data/storage/disk0/media/tmp/recordings" rm -r $tmprecdir - 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'" + su - mythtv -c "perl /usr/share/mythtv/contrib/user_jobs/mythlink.pl --format '%Ct/%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/* + # rename category_types (%Ct) from numbers to names + for cattype in $tmprecdir/* + do + if [ $cattype == "$tmprecdir/1" ] + then + rsync -a "$cattype/" "$tmprecdir/Movies" + rm -r "$cattype" + elif [[ $cattype == "$tmprecdir/2" ]] || [[ $cattype == "$tmprecdir/4" ]] + then + rsync -a "$cattype/" "$tmprecdir/TV Shows" + rm -r "$cattype" + elif [ $cattype == "$tmprecdir/3" ] + then + rsync -a "$cattype/" "$tmprecdir/Sports" + rm -r "$cattype" + fi + done + + #delete Deleted recgroup + for link in $tmprecdir/**/Deleted + do + rm -r "$link" + done + + #move all links in recgroup dirs out to parent dir + for recgroup in $tmprecdir/**/* do if [ -d "$recgroup" ] then - rsync -a "$recgroup/" "$tmprecdir" + cd "$recgroup" + rsync -a "$recgroup/" .. + cd "$tmprecdir" rm -r "$recgroup" fi done + #replace SE if no season/episode is in myth - for link in $tmprecdir/**/*\ -\ SE\ -\ * + 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]\ -\ * + 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\ -\ * + 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\ -\ * + for link in $tmprecdir/**/**/*\ -\ 0000-00-00\ -\ * do newlink=`echo "$link" | sed 's/ - 0000-00-00 - / - /'` mv "$link" "$newlink" done #add dash pt suffix if filename before the subtitle is the same #so that plex will scan and include in library - uniqs="$(ls $tmprecdir/**/* | sed 's/ = .*//' | sort | uniq -d)" + uniqs="$(ls $tmprecdir/**/**/* | sed 's/ = .*//' | sort | uniq -d)" SAVEIFS=$IFS IFS=$'\n' for link in $uniqs |