/useful/trunk-1

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/useful/trunk-1

« back to all changes in this revision

Viewing changes to scripts/enc2firefox.sh

  • Committer: Gustav Hartvigsson
  • Date: 2024-07-10 20:46:40 UTC
  • Revision ID: git-v1:72a9ba15a007b97bd061bb2f8e4d5959f0c3c34c
* added bash function libary.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
# 2021-01-13:
13
13
#   * Fixed up if statments
14
14
#
 
15
# 2024-07-10
 
16
#  * Simplefied if-else-statement.
 
17
#
15
18
####
16
19
 
17
 
__IN_NAME=
18
 
__OUT_NAME=
 
20
__IN_NAME=""
 
21
__OUT_NAME=""
19
22
__USE_WEBM=false
20
23
__USE_FJ=false
21
24
 
22
 
__help () {
 
25
__usage () {
23
26
  echo "enc2firefox.sh -- Make Videos Playable in Firefox"
24
27
  echo " "
25
28
  echo "-i <input video file>     Input Video File."
100
103
      shift
101
104
      ;;
102
105
      -h|--help)
103
 
      __help
 
106
      __usage
104
107
      shift
105
108
      ;;
106
109
      *)
107
 
      __help
 
110
      __usage
108
111
      exit 1
109
112
      shift
110
113
      ;;
117
120
}
118
121
 
119
122
__main () {
120
 
  if [[ ! -e "$__IN_NAME" ]]
121
 
  then
 
123
  if [[ ! -e "$__IN_NAME" ]]; then
122
124
    echo "missing input audio. Please provide."
123
125
    exit 1
124
126
  fi
125
127
  
126
 
  if [[ $__OUT_NAME == "" ]]
127
 
  then
 
128
  if [[ $__OUT_NAME == "" ]]; then
128
129
    echo "missing output file name. Please provide."
129
130
    exit 1
130
131
  fi
131
 
  
132
 
  
133
 
  if [[ $__USE_WEBM == true ]]
134
 
  then
135
 
    if [[ $__IN_NAME == $__OUT_NAME.webm ]]
136
 
    then
 
132
 
 
133
  if [[ $__USE_WEBM == true ]]; then
 
134
    if [[ $__IN_NAME == $__OUT_NAME.webm ]]; then
137
135
      echo "Filenames can't be the same."
138
136
      exit
139
137
    fi
140
138
    __enc_webm
141
 
  elif [[ $__USE_FJ == true ]]
142
 
  then
143
 
    if [[ $__IN_NAME == $__OUT_NAME.mp4 ]]
144
 
    then
145
 
      echo "Filenames can't be the same."
146
 
      exit
 
139
  elif [[ $__IN_NAME == $__OUT_NAME.mp4 ]]; then
 
140
    if [[ $__USE_FJ == true ]]; then
 
141
      __enc_fj
 
142
    else
 
143
      __enc_mp4
147
144
    fi
148
 
    __enc_fj
149
145
  else
150
 
    if [[ $__IN_NAME == $__OUT_NAME.mp4 ]]
151
 
    then
152
 
      echo "Filenames can't be the same."
153
 
      exit
154
 
    fi
155
 
    __enc_mp4
 
146
    echo " Input and output files can't be the same."
 
147
    exit
156
148
  fi
157
149
}
158
150