3 # Wrapper script around make_home_videos.pl script that
4 # facilitates copying over the daily_clips to another
5 # linux server location, properly merging the clips
6 # created with the existing clips and playlists on
8 # USAGE: make_home_videos.cmd <tapename>
9 # EXAMPLE: make_home_videos.cmd Dec06-Apr07
11 SERVER="/naspool/videos/HomeVideos"
12 MAKE_VIDEOS="/naspool/videos/bin/make_home_videos.pl"
14 $MAKE_VIDEOS -e -c -m -p -a -n $*
16 # Copy the daily clips over to the main file server
17 pushd "$*/daily_clips" > /dev/null
19 for i in `/bin/ls -1 *.avi`;
21 filename=`echo "$i" | sed 's/.avi//g'`
22 year=`echo "$filename" | awk --field-separator - '{print $1}'`
23 month=`echo "$filename" | awk --field-separator - '{print $2}'`
24 day=`echo "$filename" | awk --field-separator - '{print $3}'`
26 # set lastyear if we haven't done so yet
27 if [[ -z "$lastyear" ]];
32 # if we have changed year directories, remake the playlists for lastyear
33 if [[ "$year" != "$lastyear" ]];
35 pushd "$SERVER/$lastyear" > /dev/null
40 # make the destination directory if it is missing
41 if [[ ! -d "$SERVER/$year" ]];
46 # don't overwrite existing filenames
47 basefilename="$filename"
49 while [[ -f "$SERVER/$year/$filename.avi" ]];
52 filename="$basefilename.$num"
55 echo "Copying $i to $SERVER/$year/$filename.avi"
56 cp "$i" "$SERVER/$year/$filename.avi"
61 # remake the playlists for year
62 pushd "$SERVER/$year" > /dev/null
68 echo "-> Rebooting the system in 10 seconds... Press CTRL-C to abort..."
70 echo "-> Rebooting now..."
71 # chmod u+s /sbin/reboot if you can't run the below command without being root