#!/bin/sh # makestreams # Scot Hacker, UC Berkeley Graduate School of Journalism # shacker@berkeley.edu # Batch-generate .qtl ref movies, add hint tracks, add metadata, # and move files to their final destination. # Usage: # Configure base variables below. # Place script somewhere in your path. # cd to the dir containing raw movie files and type "makestreams" # You'll be prompted for any needed input. # This script must be run as root (QT requirement) # CONFIGURE VARIABLES # Repository location. This is the base path on the system where all # streamed media resides. This probably stays constant (you'll be # prompted to add subdirectories to this at runtime). REPO="/Volumes/Media" COPYRIGHT="The Regents, University of California, 2006" # Base URL for streamed media at your site BASEURL="rtsp://streams.journalism.berkeley.edu" # Comment is a piece of metadata that can be a URL or any other string COMMENT="http://journalism.berkeley.edu/events/video/" # Since this script runs as root, the final output will be root owned. # Since you might want to later manipulate the content through the Finder # as a non-root user, we'll also set the user and group file ownership. # Configure that here. USER="webcast1" GROUP="editors" # End configuration ################# echo "This script must be run as root, or will generate errors." echo # Get title metadata for this session echo "Enter a title for this session, e.g. \"New Media Lectures 2006\" (without quotes)" read TITLE # Get path (relative to repository) from user echo echo "Enter path from base repository, without quotes, e.g. events/newmedia2005 would result in an rtsp link such as: $BASEURL/events/newmedia2005/mcgoo_speaks.qtl and would put finished movies at $REPO/events/newmedia2005 Enter relative path on the following line (no leading or trailing slash):" read RELPATH # Now add hint tracks and metadata to all # movies in the current directory, then generate .qtl echo echo "Adding metadata and hinting...." echo for i in *; do /usr/bin/qtmedia -a nam "$TITLE" -a cprt "$COPYRIGHT" -a cmt "$COMMENT" -h $i /usr/bin/qtref -t "$i" "$BASEURL/$RELPATH/$i" done # Let's also put metadata into the .qtl file itself for j in *.qtl; do /usr/bin/qtmedia -a nam "$TITLE" -a cprt "$COPYRIGHT" -a cmt "$COMMENT" -h $j done # Fix permissions echo echo "Setting permissions on all files..." /usr/sbin/chown $USER:$GROUP * echo "Permissions set." echo # Move all movie files in working dir to their final destination. # Create destination directory if it doesn't already exist. if [ ! -d $REPO/$RELPATH ]; then mkdir -p $REPO/$RELPATH fi mv * "$REPO/$RELPATH" echo "Finished movies are at $REPO/$RELPATH" echo echo "Done." echo