-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmythtv_remodel.sh
40 lines (38 loc) · 1.69 KB
/
mythtv_remodel.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#! /bin/sh
### BEGIN INIT INFO
# Provides: mythtvremodel
# Required-Start: $local_fs $syslog $remote_fs dbus
# Required-Stop: $local_fs $syslog $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: rename, move delete recordings
### END INIT INFO
# script to rename files recorded from mythtv and then to move them and delete them
#made by prupert.co.uk
#creative commons licence, whichever is the most FREE (as in beer)
#lets put in some variables so others can use this
#location of log file, you can choose anything and any name
log=/path/to/mythtvremodel.log
#this is the full path to mythrename.pl
mrename=/location/to/mythrename.pl
#this is the full path to your recordings folder
record=/var/www/mythweb/data/recordings/
#this is the extension your recordings are stored as, usually mpg or nuv
ext=mpg
#this is the full path to where you want your files moved to
dest=/path/to/folder/to/move/recordings/to/
#this is the full path to myth.find_orphans.pl
morphan=/path/to/myth.find_orphans.pl
#mythtv database password for myth.find_orphans.pl
pass=yourmythtvdatabasepassword
# first, run mythtvrename to get nice names for the recordings
echo starting mythtvremodel on `date "+%m/%d/%y %l:%M:%S %p"` > $log
perl $mrename --underscores --format %T-%S-%d%m%y >> $log
# use find to search for all recorded files in the recording folder and move them to the TV folder
find "$record" -name "*.$ext" >> $log
find "$record" -name "*.$ext" -exec mv {} "$dest" \; >> $log
# use mythorphan to remove the now missing recorded files from the database
perl $morphan --pass=$pass --dodbdelete >> $log
#that should be it
echo stopping mythtvremodel on `date "+%m/%d/%y %l:%M:%S %p"` >> $log
exit 0