morganestes
4/1/2013 - 2:36 PM

Use the wistia-uploader gem to loop through a list of files and upload them to a project.

Use the wistia-uploader gem to loop through a list of files and upload them to a project.

wuploadall() { ~/bin/go-wistia.sh ${PWD##*/}; }

wuploadhere() { ~/bin/go-wistia-sorted.sh; }
#!/bin/bash
##
# Uploads all videos (of specified extensions) to Wistia using their Gem.
# Author: Morgan Estes <morgan.estes@gmail.com>
# Contributor: Jeff Vincent <jeff@wistia.com>
# Version: 0.3
# Changelog:
# 0.1 - Initial revision. Uploads all mp4 files to a specified project.
# 0.2 - Jeff's revisions. Added multiple video filetypes to check for and upload.
# 0.3 - Morgan again. Added reverse sort by filename. Our videos are all numbered,
#    	and videos uploaded to Wisita insert the newest one on top, so video 1 always
#		ended up at the bottom. This is jus a cheater's way for me to not have to sort
#		my videos again through the UI. YMMV.
##

shopt -s nullglob
project_hash=${PWD##*/}
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
 
for video in `ls *.{mp4,avi,mov,m4v,flv} | sort -n -r`
do
    echo "Uploading $video to project ID $project_hash using wistia-uploader"
	wistia-uploader -p "$project_hash" -f "$video"
done
IFS=$SAVEIFS
#!/bin/bash
# Usage: uploads all videos (of specified extensions) to Wistia using their Gem.
 
shopt -s nullglob
project_hash=$1
 
for video in *.{mp4,avi,mov,m4v,flv}
do
    echo "Uploading $video to project ID $project_hash using the wistia-uploader Gem"
	wistia-uploader -p "$project_hash" -f "$video"
done