Blame view

main_tools/OneScriptToRuleThemAll.sh 3.17 KB
e6be5137b   Jean-François Rey   reinitialized pro...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
  #!/bin/bash
  
  #####################################
  # File: OneScriptToRuleThemAll.sh   #
  # Brief : Script to launch OTMEDIA  #
  # Version : 1.0                     #
  # Date : 23/07/2013                 #
  # Author : Jean-François Rey        #
  #####################################
  
  echo -e "OneScriptToRuleThemAll :" 
  LORD="                Three::rings
             for:::the::Elven-King
          under:the:sky,:Seven:for:the
        Dwarf-Lords::in::their::halls:of
       stone,:Nine             for:Mortal
      :::Men:::     ________     doomed::to
    die.:One   _,-'...:... \`-.    for:::the
    ::Dark::  ,- .:::::::::::. \`.   Lord::on
   his:dark ,'  .:::::zzz:::::.  \`.  :throne:
   In:::the/    ::::OTMEDIA::::    \ Land::of
   :Mordor:\    ::::SCRIPTS::::    / :where::
   ::the::: '.  '::::YEEEP::::'  ,'  Shadows:
   lie.::One  \`. \`\`:::::::::'' ,'    Ring::to
    ::rule::    \`-._\`\`\`:'''_,-'     ::them::
    all,::One      \`-----'        ring::to
      ::find:::                  them,:One
       Ring:::::to            bring::them
         all::and::in:the:darkness:bind
           them:In:the:Land:of:Mordor
              where:::the::Shadows
                   :::lie.:::"
  
  
  # Check OTMEDIA_HOME env var
  if [ -z ${OTMEDIA_HOME} ]
  then 
      OTMEDIA_HOME=$(dirname $(dirname $(readlink -e $0)))
      export OTMEDIA_HOME=$OTMEDIA_HOME
  fi
  
  # where is OneScriptToRuleThemAll.sh
  MAIN_SCRIPT_PATH=$(dirname $(readlink -e $0))
  
  RING=""
  
  #---------------#
  # Parse Options #
  #---------------#
  while getopts ":hDv:cf:r" opt
  do
  	case $opt in
  		h)
  			echo -e "$0 [OPTIONS] <WAV_FILE> <OUTPUT_DIRECTORY>
  "
              echo -e "\t Options:"
              echo -e "\t\t-h :\tprint this message"
              echo -e "\t\t-D :\tDEBUG mode on"
              echo -e "\t\t-v l :\tVerbose mode, l=(1|2|3) level mode"
              echo -e "\t\t-c :\tCheck process, stop if error detected"
              echo -e "\t\t-f n :\tspecify a speeral forks number (default 1)"
              echo -e "\t\t-r :\tforce rerun the wav file"
  			exit 1
  			;;
  		D)
  			RING=$RING" -D"
  			;;
          v)
              RING=$RING" -v $OPTARG"
              ;;
          c)
              RING=$RING" -c"
              ;;
          f)
              RING=$RING" -f $OPTARG"
              ;;
          r)
              RING=$RING" -r"
              ;;
  		:)
  			echo "Option -$OPTARG requires an argument." >&2
  			exit 1
  			;;
  		\?)
  			echo "BAD USAGE : unknow opton -$OPTARG"
  			exit 1
  			;;
  	esac
  done
  
  # Check USAGE by arguments number
  if [ $(($#-($OPTIND-1))) -ne 2 ]
  then
  	echo "BAD USAGE : $0 [OPTIONS] <WAV_FILE> <OUTPUT_DIR>"
  	echo "$0 -h for more info"
  	exit 1
  fi
  
  shift $((OPTIND-1))
  # check audio file - First argument
  if [ -e $1 ] && [ -s $1 ]
  then
      echo -e "$LORD
  "
      REP_OUT=$2/${1%.*}
      ${MAIN_SCRIPT_PATH}/FirstPass.sh ${RING} $1 $2
      ${MAIN_SCRIPT_PATH}/SecondPass.sh ${RING} ${REP_OUT}
      ${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p2"
      ${MAIN_SCRIPT_PATH}/ExploitConfPass.sh ${RING} ${REP_OUT}
      ${MAIN_SCRIPT_PATH}/ThirdPass.sh ${RING} ${REP_OUT} 
      ${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p3"
      ${MAIN_SCRIPT_PATH}/RecomposePass.sh ${RING} ${REP_OUT}
      ${MAIN_SCRIPT_PATH}/ScoringRes.sh ${RING} ${REP_OUT}
  else
  	echo "can't find $1 OR file is empty"
  	exit 1
  fi