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