/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: 2021-01-14 11:47:07 UTC
  • Revision ID: git-v1:8ab298a55bc6629f1bf4fc1660469a59f4ebf0cf
General fixup.

* Removed unused ARGS declarations.

* Made all variabels start with two underlines

* Expilitly declared functions as such.

* Expilitly declared strings (file names and such) as strings
  at the start of the files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env bash
2
 
###################
 
2
####
3
3
# FILE NAME: enc2firefox.sh
4
4
#
5
5
# Encodes (mp4/x264) videos so they can be played in firefox.
8
8
# 2020-09-05:
9
9
#   * Removed an eval that made no sense.
10
10
#   * Added FJ mode for those spicy memes.
11
 
####################
12
 
ARGS=()
13
 
ARGS="${@}"
 
11
#
 
12
# 2021-01-13:
 
13
#   * Fixed up if statments
 
14
#
 
15
####
14
16
 
15
17
__IN_NAME=
16
18
__OUT_NAME=
68
70
}
69
71
 
70
72
__parse_args() {
71
 
  if [ -z "$1" ]
 
73
  if [[ -z "$1" ]]
72
74
  then
73
75
    echo "Try --help or -h."
74
76
    exit 1
115
117
}
116
118
 
117
119
__main () {
118
 
  if [ ! -e "$__IN_NAME" ]
 
120
  if [[ ! -e "$__IN_NAME" ]]
119
121
  then
120
122
    echo "missing input audio. Please provide."
121
123
    exit 1
122
124
  fi
123
125
  
124
 
  if [ $__OUT_NAME == "" ]
 
126
  if [[ $__OUT_NAME == "" ]]
125
127
  then
126
128
    echo "missing output file name. Please provide."
127
129
    exit 1
128
130
  fi
129
131
  
130
132
  
131
 
  if [ $__USE_WEBM = true ]
 
133
  if [[ $__USE_WEBM == true ]]
132
134
  then
133
 
    if [ $__IN_NAME = $__OUT_NAME.webm ]
 
135
    if [[ $__IN_NAME == $__OUT_NAME.webm ]]
134
136
    then
135
137
      echo "Filenames can't be the same."
136
138
      exit
137
139
    fi
138
140
    __enc_webm
139
 
  elif [ $__USE_FJ = true ]
 
141
  elif [[ $__USE_FJ == true ]]
140
142
  then
141
 
    if [ $__IN_NAME = $__OUT_NAME.mp4 ]
 
143
    if [[ $__IN_NAME == $__OUT_NAME.mp4 ]]
142
144
    then
143
145
      echo "Filenames can't be the same."
144
146
      exit
145
147
    fi
146
148
    __enc_fj
147
149
  else
148
 
    if [ $__IN_NAME = $__OUT_NAME.mp4 ]
 
150
    if [[ $__IN_NAME == $__OUT_NAME.mp4 ]]
149
151
    then
150
152
      echo "Filenames can't be the same."
151
153
      exit