Blame view

main_tools/OneScriptToRuleThemAll.sh 4.73 KB
e6be5137b   Jean-François Rey   reinitialized pro...
1
2
3
4
5
6
7
8
9
  #!/bin/bash
  
  #####################################
  # File: OneScriptToRuleThemAll.sh   #
  # Brief : Script to launch OTMEDIA  #
  # Version : 1.0                     #
  # Date : 23/07/2013                 #
  # Author : Jean-François Rey        #
  #####################################
630a18786   Jean-François Rey   YesIRastafari
10
11
12
13
14
15
16
17
18
  # Color variables
  txtgrn=$(tput setaf 2) # Green
  txtylw=$(tput setaf 3) # Yellow
  txtblu=$(tput setaf 4) # Blue
  txtpur=$(tput setaf 5) # Purple
  txtcyn=$(tput setaf 6) # Cyan
  txtwht=$(tput setaf 7) # White
  txtrst=$(tput sgr0) # Text reset.
  #/color
7e99f0793   Jean-François Rey   up
19
  echo -e "#### OneScriptToRuleThemAll ####" 
e6be5137b   Jean-François Rey   reinitialized pro...
20
21
22
23
24
25
26
27
28
  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:
630a18786   Jean-François Rey   YesIRastafari
29
30
   In:::the/    ::::${txtpur}OTMEDIA${txtrst}::::    \ Land::of
   :Mordor:\    ::::${txtpur}SCRIPTS${txtrst}::::    / :where::
e6be5137b   Jean-François Rey   reinitialized pro...
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
   ::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=""
ea2c35ad6   Jean-François Rey   bugfix :D
54
55
56
57
58
59
60
  p1=0
  p2=0
  conf=0
  exploitconf=0
  p3=0
  recompose=0
  scoring=0
e6be5137b   Jean-François Rey   reinitialized pro...
61
62
63
64
  
  #---------------#
  # Parse Options #
  #---------------#
6db49dab6   Jean-François Rey   bugfix arguments
65
  while getopts ":hDv:cf:r123C:eRsa" opt
e6be5137b   Jean-François Rey   reinitialized pro...
66
67
68
69
70
71
72
73
74
75
  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"
135404bcf   Jean-François Rey   Modify verbose an...
76
77
78
79
80
81
              echo -e "\t\t-f n :\tSpecify a speeral forks number (default 1)"
              echo -e "\t\t-r :\tForce to rerun without deleting all files"
              echo -e "\t\t-a :\tDo every pass"
              echo -e "\t\t-1 :\tDo 1rt pass"
              echo -e "\t\t-2 :\tDo 2nd pass"
              echo -e "\t\t-3 :\tDo 3rd pass"
6db49dab6   Jean-François Rey   bugfix arguments
82
              echo -e "\t\t-C p :\tDo p confidence pass (1=all, 2 or 3)"
135404bcf   Jean-François Rey   Modify verbose an...
83
84
85
              echo -e "\t\t-e :\tDo exploit confidence pass (SOLR)"
              echo -e "\t\t-R :\tDo recompose res"
              echo -e "\t\t-s :\tDo scoring"
e6be5137b   Jean-François Rey   reinitialized pro...
86
87
88
89
90
91
92
93
94
95
96
97
  			exit 1
  			;;
  		D)
  			RING=$RING" -D"
  			;;
          v)
              RING=$RING" -v $OPTARG"
              ;;
          c)
              RING=$RING" -c"
              ;;
          f)
6db49dab6   Jean-François Rey   bugfix arguments
98
              FORKS=" -f $OPTARG"
e6be5137b   Jean-François Rey   reinitialized pro...
99
100
101
102
              ;;
          r)
              RING=$RING" -r"
              ;;
135404bcf   Jean-François Rey   Modify verbose an...
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
          a)
              p1=1
              p2=1
              p3=1
              conf=1
              exploitconf=1
              recompose=1
              scoring=1
              ;;
          1)
              p1=1
              ;;
          2)
              p2=1
              ;;
          3)
              p3=1
              ;;
          C)
6db49dab6   Jean-François Rey   bugfix arguments
122
              conf=$OPTARG
135404bcf   Jean-François Rey   Modify verbose an...
123
124
125
126
              ;;
          e)
              exploitconf=1
              ;;
6aa891c90   Jean-François Rey   up
127
          R)
135404bcf   Jean-François Rey   Modify verbose an...
128
129
130
131
132
              recompose=1
              ;;
          s)
              scoring=1
              ;;
e6be5137b   Jean-François Rey   reinitialized pro...
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
  		:)
  			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
  "
bc77cbdb1   Jean-François Rey   oublie
158
      REP_OUT=$2/$(basename ${1%.*})
6db49dab6   Jean-François Rey   bugfix arguments
159
160
161
      if [ $p1 -eq 1 ];then ${MAIN_SCRIPT_PATH}/FirstPass.sh ${RING} ${FORKS} $1 $2;fi
      if [ $p2 -eq 1 ];then ${MAIN_SCRIPT_PATH}/SecondPass.sh ${RING} ${FORKS} ${REP_OUT};fi
      if [ $conf -eq 1 ] || [ $conf -eq 2 ];then $p${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p2";fi
135404bcf   Jean-François Rey   Modify verbose an...
162
      if [ $exploitconf -eq 1 ]; then ${MAIN_SCRIPT_PATH}/ExploitConfidencePass.sh ${RING} ${REP_OUT};fi
6db49dab6   Jean-François Rey   bugfix arguments
163
164
      if [ $p3 -eq 1 ];then ${MAIN_SCRIPT_PATH}/ThirdPass.sh ${RING} ${FORKS} ${REP_OUT};fi
      if [ $conf -eq 1 ] || [ $conf -eq 3 ];then ${MAIN_SCRIPT_PATH}/ConfPass.sh ${RING} ${REP_OUT} "res_p3";fi
135404bcf   Jean-François Rey   Modify verbose an...
165
166
167
      if [ $recompose -eq 1 ];then ${MAIN_SCRIPT_PATH}/RecomposePass.sh ${RING} ${REP_OUT};fi
      if [ $scoring -eq 1 ];then ${MAIN_SCRIPT_PATH}/ScoringRes.sh ${RING} ${REP_OUT};fi
      echo "done"
e6be5137b   Jean-François Rey   reinitialized pro...
168
169
170
171
  else
  	echo "can't find $1 OR file is empty"
  	exit 1
  fi