X-Git-Url: http://git.pippins.net/embedvideo/.git/static/gitweb.js?a=blobdiff_plain;f=make_home_videos.cmd.nocapture;fp=make_home_videos.cmd.nocapture;h=2895f424fc39ad891c38e60d4a81457e3f91463b;hb=be9a9d1914a8f80b031631f902c9daae0b8f6d90;hp=0000000000000000000000000000000000000000;hpb=6ab397855fde341417761a2e91667c85cbfc41ef;p=videoscripts%2F.git diff --git a/make_home_videos.cmd.nocapture b/make_home_videos.cmd.nocapture new file mode 100755 index 0000000..2895f42 --- /dev/null +++ b/make_home_videos.cmd.nocapture @@ -0,0 +1,67 @@ +#!/bin/bash +# DESCRIPTION: +# Wrapper script around make_home_videos.pl script that +# facilitates copying over the daily_clips to another +# linux server location, properly merging the clips +# created with the existing clips and playlists on +# the remote server. +# USAGE: make_home_videos.cmd +# EXAMPLE: make_home_videos.cmd Dec06-Apr07 + +SERVER="/naspool/videos/HomeVideos" +MAKE_VIDEOS="/naspool/videos/bin/make_home_videos.pl" + +$MAKE_VIDEOS -e -m -p -a -n $* + +# Copy the daily clips over to the main file server +pushd "$*/daily_clips" > /dev/null +lastyear="" +for i in `/bin/ls -1 *.avi`; +do + filename=`echo "$i" | sed 's/.avi//g'` + year=`echo "$filename" | awk --field-separator - '{print $1}'` + month=`echo "$filename" | awk --field-separator - '{print $2}'` + day=`echo "$filename" | awk --field-separator - '{print $3}'` + + # set lastyear if we haven't done so yet + if [[ -z "$lastyear" ]]; + then + lastyear="$year" + fi + + # if we have changed year directories, remake the playlists for lastyear + if [[ "$year" != "$lastyear" ]]; + then + pushd "$SERVER/$lastyear" > /dev/null + $MAKE_VIDEOS -p -d . + popd > /dev/null + fi + + # make the destination directory if it is missing + if [[ ! -d "$SERVER/$year" ]]; + then + mkdir "$SERVER/$year" + fi + + # don't overwrite existing filenames + basefilename="$filename" + num=0 + while [[ -f "$SERVER/$year/$filename.avi" ]]; + do + ((num++)) + filename="$basefilename.$num" + done + + echo "Copying $i to $SERVER/$year/$filename.avi" + cp "$i" "$SERVER/$year/$filename.avi" + + lastyear=$year +done + +# remake the playlists for year +pushd "$SERVER/$year" > /dev/null +$MAKE_VIDEOS -p -d . +popd > /dev/null + +popd > /dev/null +