Commit 6aa891c900f9ed4e43b87f99043838356eb30fd5

Authored by Jean-François Rey
1 parent 8425b85497
Exists in master

up

Showing 1 changed file with 1 additions and 1 deletions Inline Diff

main_tools/OneScriptToRuleThemAll.sh
1 #!/bin/bash 1 #!/bin/bash
2 2
3 ##################################### 3 #####################################
4 # File: OneScriptToRuleThemAll.sh # 4 # File: OneScriptToRuleThemAll.sh #
5 # Brief : Script to launch OTMEDIA # 5 # Brief : Script to launch OTMEDIA #
6 # Version : 1.0 # 6 # Version : 1.0 #
7 # Date : 23/07/2013 # 7 # Date : 23/07/2013 #
8 # Author : Jean-François Rey # 8 # Author : Jean-François Rey #
9 ##################################### 9 #####################################
10 10
11 # Color variables 11 # Color variables
12 txtgrn=$(tput setaf 2) # Green 12 txtgrn=$(tput setaf 2) # Green
13 txtylw=$(tput setaf 3) # Yellow 13 txtylw=$(tput setaf 3) # Yellow
14 txtblu=$(tput setaf 4) # Blue 14 txtblu=$(tput setaf 4) # Blue
15 txtpur=$(tput setaf 5) # Purple 15 txtpur=$(tput setaf 5) # Purple
16 txtcyn=$(tput setaf 6) # Cyan 16 txtcyn=$(tput setaf 6) # Cyan
17 txtwht=$(tput setaf 7) # White 17 txtwht=$(tput setaf 7) # White
18 txtrst=$(tput sgr0) # Text reset. 18 txtrst=$(tput sgr0) # Text reset.
19 #/color 19 #/color
20 20
21 21
22 echo -e "#### OneScriptToRuleThemAll ####" 22 echo -e "#### OneScriptToRuleThemAll ####"
23 LORD=" Three::rings 23 LORD=" Three::rings
24 for:::the::Elven-King 24 for:::the::Elven-King
25 under:the:sky,:Seven:for:the 25 under:the:sky,:Seven:for:the
26 Dwarf-Lords::in::their::halls:of 26 Dwarf-Lords::in::their::halls:of
27 stone,:Nine for:Mortal 27 stone,:Nine for:Mortal
28 :::Men::: ________ doomed::to 28 :::Men::: ________ doomed::to
29 die.:One _,-'...:... \`-. for:::the 29 die.:One _,-'...:... \`-. for:::the
30 ::Dark:: ,- .:::::::::::. \`. Lord::on 30 ::Dark:: ,- .:::::::::::. \`. Lord::on
31 his:dark ,' .:::::zzz:::::. \`. :throne: 31 his:dark ,' .:::::zzz:::::. \`. :throne:
32 In:::the/ ::::${txtpur}OTMEDIA${txtrst}:::: \ Land::of 32 In:::the/ ::::${txtpur}OTMEDIA${txtrst}:::: \ Land::of
33 :Mordor:\ ::::${txtpur}SCRIPTS${txtrst}:::: / :where:: 33 :Mordor:\ ::::${txtpur}SCRIPTS${txtrst}:::: / :where::
34 ::the::: '. '::::YEEEP::::' ,' Shadows: 34 ::the::: '. '::::YEEEP::::' ,' Shadows:
35 lie.::One \`. \`\`:::::::::'' ,' Ring::to 35 lie.::One \`. \`\`:::::::::'' ,' Ring::to
36 ::rule:: \`-._\`\`\`:'''_,-' ::them:: 36 ::rule:: \`-._\`\`\`:'''_,-' ::them::
37 all,::One \`-----' ring::to 37 all,::One \`-----' ring::to
38 ::find::: them,:One 38 ::find::: them,:One
39 Ring:::::to bring::them 39 Ring:::::to bring::them
40 all::and::in:the:darkness:bind 40 all::and::in:the:darkness:bind
41 them:In:the:Land:of:Mordor 41 them:In:the:Land:of:Mordor
42 where:::the::Shadows 42 where:::the::Shadows
43 :::lie.:::" 43 :::lie.:::"
44 44
45 45
46 # Check OTMEDIA_HOME env var 46 # Check OTMEDIA_HOME env var
47 if [ -z ${OTMEDIA_HOME} ] 47 if [ -z ${OTMEDIA_HOME} ]
48 then 48 then
49 OTMEDIA_HOME=$(dirname $(dirname $(readlink -e $0))) 49 OTMEDIA_HOME=$(dirname $(dirname $(readlink -e $0)))
50 export OTMEDIA_HOME=$OTMEDIA_HOME 50 export OTMEDIA_HOME=$OTMEDIA_HOME
51 fi 51 fi
52 52
53 # where is OneScriptToRuleThemAll.sh 53 # where is OneScriptToRuleThemAll.sh
54 MAIN_SCRIPT_PATH=$(dirname $(readlink -e $0)) 54 MAIN_SCRIPT_PATH=$(dirname $(readlink -e $0))
55 55
56 RING="" 56 RING=""
57 p1=0 57 p1=0
58 p2=0 58 p2=0
59 conf=0 59 conf=0
60 exploitconf=0 60 exploitconf=0
61 p3=0 61 p3=0
62 recompose=0 62 recompose=0
63 scoring=0 63 scoring=0
64 64
65 #---------------# 65 #---------------#
66 # Parse Options # 66 # Parse Options #
67 #---------------# 67 #---------------#
68 while getopts ":hDv:cf:r123C:eRsa" opt 68 while getopts ":hDv:cf:r123C:eRsa" opt
69 do 69 do
70 case $opt in 70 case $opt in
71 h) 71 h)
72 echo -e "$0 [OPTIONS] <WAV_FILE> <OUTPUT_DIRECTORY>\n" 72 echo -e "$0 [OPTIONS] <WAV_FILE> <OUTPUT_DIRECTORY>\n"
73 echo -e "\t Options:" 73 echo -e "\t Options:"
74 echo -e "\t\t-h :\tprint this message" 74 echo -e "\t\t-h :\tprint this message"
75 echo -e "\t\t-D :\tDEBUG mode on" 75 echo -e "\t\t-D :\tDEBUG mode on"
76 echo -e "\t\t-v l :\tVerbose mode, l=(1|2|3) level mode" 76 echo -e "\t\t-v l :\tVerbose mode, l=(1|2|3) level mode"
77 echo -e "\t\t-c :\tCheck process, stop if error detected" 77 echo -e "\t\t-c :\tCheck process, stop if error detected"
78 echo -e "\t\t-f n :\tSpecify a speeral forks number (default 1)" 78 echo -e "\t\t-f n :\tSpecify a speeral forks number (default 1)"
79 echo -e "\t\t-r :\tForce to rerun without deleting all files" 79 echo -e "\t\t-r :\tForce to rerun without deleting all files"
80 echo -e "\t\t-a :\tDo every pass" 80 echo -e "\t\t-a :\tDo every pass"
81 echo -e "\t\t-1 :\tDo 1rt pass" 81 echo -e "\t\t-1 :\tDo 1rt pass"
82 echo -e "\t\t-2 :\tDo 2nd pass" 82 echo -e "\t\t-2 :\tDo 2nd pass"
83 echo -e "\t\t-3 :\tDo 3rd pass" 83 echo -e "\t\t-3 :\tDo 3rd pass"
84 echo -e "\t\t-C p :\tDo p confidence pass (1=all, 2 or 3)" 84 echo -e "\t\t-C p :\tDo p confidence pass (1=all, 2 or 3)"
85 echo -e "\t\t-e :\tDo exploit confidence pass (SOLR)" 85 echo -e "\t\t-e :\tDo exploit confidence pass (SOLR)"
86 echo -e "\t\t-R :\tDo recompose res" 86 echo -e "\t\t-R :\tDo recompose res"
87 echo -e "\t\t-s :\tDo scoring" 87 echo -e "\t\t-s :\tDo scoring"
88 exit 1 88 exit 1
89 ;; 89 ;;
90 D) 90 D)
91 RING=$RING" -D" 91 RING=$RING" -D"
92 ;; 92 ;;
93 v) 93 v)
94 RING=$RING" -v $OPTARG" 94 RING=$RING" -v $OPTARG"
95 ;; 95 ;;
96 c) 96 c)
97 RING=$RING" -c" 97 RING=$RING" -c"
98 ;; 98 ;;
99 f) 99 f)
100 FORKS=" -f $OPTARG" 100 FORKS=" -f $OPTARG"
101 ;; 101 ;;
102 r) 102 r)
103 RING=$RING" -r" 103 RING=$RING" -r"
104 ;; 104 ;;
105 a) 105 a)
106 p1=1 106 p1=1
107 p2=1 107 p2=1
108 p3=1 108 p3=1
109 conf=1 109 conf=1
110 exploitconf=1 110 exploitconf=1
111 recompose=1 111 recompose=1
112 scoring=1 112 scoring=1
113 ;; 113 ;;
114 1) 114 1)
115 p1=1 115 p1=1
116 ;; 116 ;;
117 2) 117 2)
118 p2=1 118 p2=1
119 ;; 119 ;;
120 3) 120 3)
121 p3=1 121 p3=1
122 ;; 122 ;;
123 C) 123 C)
124 conf=$OPTARG 124 conf=$OPTARG
125 ;; 125 ;;
126 e) 126 e)
127 exploitconf=1 127 exploitconf=1
128 ;; 128 ;;
129 a) 129 R)
130 recompose=1 130 recompose=1
131 ;; 131 ;;
132 s) 132 s)
133 scoring=1 133 scoring=1
134 ;; 134 ;;
135 :) 135 :)
136 echo "Option -$OPTARG requires an argument." >&2 136 echo "Option -$OPTARG requires an argument." >&2
137 exit 1 137 exit 1
138 ;; 138 ;;
139 \?) 139 \?)
140 echo "BAD USAGE : unknow opton -$OPTARG" 140 echo "BAD USAGE : unknow opton -$OPTARG"
141 exit 1 141 exit 1
142 ;; 142 ;;
143 esac 143 esac
144 done 144 done
145 145
146 # Check USAGE by arguments number 146 # Check USAGE by arguments number
147 if [ $(($#-($OPTIND-1))) -ne 2 ] 147 if [ $(($#-($OPTIND-1))) -ne 2 ]
148 then 148 then
149 echo "BAD USAGE : $0 [OPTIONS] <WAV_FILE> <OUTPUT_DIR>" 149 echo "BAD USAGE : $0 [OPTIONS] <WAV_FILE> <OUTPUT_DIR>"
150 echo "$0 -h for more info" 150 echo "$0 -h for more info"
151 exit 1 151 exit 1
152 fi 152 fi
153 153
154 shift $((OPTIND-1)) 154 shift $((OPTIND-1))
155 # check audio file - First argument 155 # check audio file - First argument
156 if [ -e $1 ] && [ -s $1 ] 156 if [ -e $1 ] && [ -s $1 ]
157 then 157 then
158 echo -e "$LORD\n" 158 echo -e "$LORD\n"
159 REP_OUT=$2/$(basename ${1%.*}) 159 REP_OUT=$2/$(basename ${1%.*})
160 if [ $p1 -eq 1 ];then ${MAIN_SCRIPT_PATH}/FirstPass.sh ${RING} ${FORKS} $1 $2;fi 160 if [ $p1 -eq 1 ];then ${MAIN_SCRIPT_PATH}/FirstPass.sh ${RING} ${FORKS} $1 $2;fi
161 if [ $p2 -eq 1 ];then ${MAIN_SCRIPT_PATH}/SecondPass.sh ${RING} ${FORKS} ${REP_OUT};fi 161 if [ $p2 -eq 1 ];then ${MAIN_SCRIPT_PATH}/SecondPass.sh ${RING} ${FORKS} ${REP_OUT};fi
162 if [ $conf -eq 1 ] || [ $conf -eq 2 ];then $p${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p2";fi 162 if [ $conf -eq 1 ] || [ $conf -eq 2 ];then $p${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p2";fi
163 if [ $exploitconf -eq 1 ]; then ${MAIN_SCRIPT_PATH}/ExploitConfidencePass.sh ${RING} ${REP_OUT};fi 163 if [ $exploitconf -eq 1 ]; then ${MAIN_SCRIPT_PATH}/ExploitConfidencePass.sh ${RING} ${REP_OUT};fi
164 if [ $p3 -eq 1 ];then ${MAIN_SCRIPT_PATH}/ThirdPass.sh ${RING} ${FORKS} ${REP_OUT};fi 164 if [ $p3 -eq 1 ];then ${MAIN_SCRIPT_PATH}/ThirdPass.sh ${RING} ${FORKS} ${REP_OUT};fi
165 if [ $conf -eq 1 ] || [ $conf -eq 3 ];then ${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p3";fi 165 if [ $conf -eq 1 ] || [ $conf -eq 3 ];then ${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p3";fi
166 if [ $recompose -eq 1 ];then ${MAIN_SCRIPT_PATH}/RecomposePass.sh ${RING} ${REP_OUT};fi 166 if [ $recompose -eq 1 ];then ${MAIN_SCRIPT_PATH}/RecomposePass.sh ${RING} ${REP_OUT};fi
167 if [ $scoring -eq 1 ];then ${MAIN_SCRIPT_PATH}/ScoringRes.sh ${RING} ${REP_OUT};fi 167 if [ $scoring -eq 1 ];then ${MAIN_SCRIPT_PATH}/ScoringRes.sh ${RING} ${REP_OUT};fi
168 echo "done" 168 echo "done"
169 else 169 else
170 echo "can't find $1 OR file is empty" 170 echo "can't find $1 OR file is empty"
171 exit 1 171 exit 1
172 fi 172 fi
173 173
174 174
175 175
176 176