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: copy_home_videos.cmd <tapename>
9 # EXAMPLE: copy_home_videos.cmd Dec06-Apr07
11 SERVER="/mnt/p/video/HomeVideos"
13 # Copy the daily clips over to the main file server
14 pushd "$*/daily_clips" > /dev/null
16 for i in `/bin/ls -1 *.avi`;
18 filename=`echo "$i" | sed 's/.avi//g'`
19 year=`echo "$filename" | awk --field-separator - '{print $1}'`
20 month=`echo "$filename" | awk --field-separator - '{print $2}'`
21 day=`echo "$filename" | awk --field-separator - '{print $3}'`
23 # set lastyear if we haven't done so yet
24 if [[ -z "$lastyear" ]];
29 # if we have changed year directories, remake the playlists for lastyear
30 if [[ "$year" != "$lastyear" ]];
32 pushd "$SERVER/$lastyear" > /dev/null
33 make_home_videos.pl -p -d .
37 # make the destination directory if it is missing
38 if [[ ! -d "$SERVER/$year" ]];
43 # don't overwrite existing filenames
44 basefilename="$filename"
46 while [[ -f "$SERVER/$year/$filename.avi" ]];
49 filename="$basefilename.$num"
52 echo "Copying $i to $SERVER/$year/$filename.avi"
53 cp "$i" "$SERVER/$year/$filename.avi"
58 # remake the playlists for year
59 pushd "$SERVER/$year" > /dev/null
60 make_home_videos.pl -p -d .