Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

run

By: a guest on Feb 25th, 2012  |  syntax: Bash  |  size: 1.23 KB  |  views: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2.  
  3. EPISODES=(
  4.   "S01E01 S1_D1 1" "S01E02 S1_D1 2" "S01E03 S1_D1 3" "S01E04 S1_D1 4"
  5.   "S01E05 S1_D2 1" "S01E06 S1_D2 2" "S01E07 S1_D2 3" "S01E08 S1_D2 4" "S01ES1 S1_D2 5"
  6.   "S02E01 S2_D1 1" "S02E02 S2_D1 2" "S02E03 S2_D1 3" "S02E04 S2_D1 4"
  7.   "S02E05 S2_D2 1" "S02E06 S2_D2 2" "S02E07 S2_D2 3" "S02E08 S2_D2 4"
  8.   "S02E09 S2_D3 1" "S02E10 S2_D3 2" "S02ES1 S2_D3 3"
  9.   "S03E01 S3_D1 1" "S03E02 S3_D1 2" "S03E03 S3_D1 3" "S03E04 S3_D1 4"
  10.   "S03E05 S3_D2 1" "S03E06 S3_D2 2" "S03E07 S3_D2 3" "S03E08 S3_D2 4"
  11.   "S03E09 S3_D3 1" "S03E10 S3_D3 2" "S03E11 S3_D3 3"
  12.   "S03E12 S3_D4 1" "S03E13 S3_D4 2" "S03ES1 S3_D4 3"
  13.   "S04E01 S4_D1 1" "S04E02 S4_D1 2" "S04E03 S4_D1 3" "S04E04 S4_D1 4"
  14.   "S04E05 S4_D2 1" "S04E06 S4_D2 2" "S04E07 S4_D2 3"
  15.   "S04E08 S4_D3 1" "S04E09 S4_D3 2" "S04ES1 S4_D3 3"
  16. )
  17.  
  18. trap ctrl_c INT
  19.  
  20. ctrl_c()
  21. {
  22.   echo -e "\n\nOperation cancelled by user"
  23.   exit $?
  24. }
  25.  
  26. TIME=`which time`
  27. SKIP=$2 ; [ -z $SKIP ] && SKIP=0
  28.  
  29. if [ $1 == "encode" ]; then
  30.   for EP in "${EPISODES[@]}"; do
  31.     (( i++ < $SKIP )) && continue
  32.     echo "$1 $EP"
  33.     [ $1 == "encode" ] && $TIME nice -n 19 ./encode $EP >>encode.log 2>&1
  34.     [ $1 == "merge" ]  && ./merge `echo $EP | cut -d " " -f 1` | grep -v Progress >>merge.log
  35.   done
  36. fi