/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-13 20:18:48 UTC
  • Revision ID: git-v1:df5c8db5509b9612b896bd2a9fc8b50ee5eedb1e
You can use git on Launchpad too.

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
 
# 2021-01-13:
13
 
#   * Fixed up if statments
14
 
#
15
 
####
 
11
####################
 
12
ARGS=()
 
13
ARGS="${@}"
16
14
 
17
15
__IN_NAME=
18
16
__OUT_NAME=
70
68
}
71
69
 
72
70
__parse_args() {
73
 
  if [[ -z "$1" ]]
 
71
  if [ -z "$1" ]
74
72
  then
75
73
    echo "Try --help or -h."
76
74
    exit 1
117
115
}
118
116
 
119
117
__main () {
120
 
  if [[ ! -e "$__IN_NAME" ]]
 
118
  if [ ! -e "$__IN_NAME" ]
121
119
  then
122
120
    echo "missing input audio. Please provide."
123
121
    exit 1
124
122
  fi
125
123
  
126
 
  if [[ $__OUT_NAME == "" ]]
 
124
  if [ $__OUT_NAME == "" ]
127
125
  then
128
126
    echo "missing output file name. Please provide."
129
127
    exit 1
130
128
  fi
131
129
  
132
130
  
133
 
  if [[ $__USE_WEBM == true ]]
 
131
  if [ $__USE_WEBM = true ]
134
132
  then
135
 
    if [[ $__IN_NAME == $__OUT_NAME.webm ]]
 
133
    if [ $__IN_NAME = $__OUT_NAME.webm ]
136
134
    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 ]]
 
139
  elif [ $__USE_FJ = true ]
142
140
  then
143
 
    if [[ $__IN_NAME == $__OUT_NAME.mp4 ]]
 
141
    if [ $__IN_NAME = $__OUT_NAME.mp4 ]
144
142
    then
145
143
      echo "Filenames can't be the same."
146
144
      exit
147
145
    fi
148
146
    __enc_fj
149
147
  else
150
 
    if [[ $__IN_NAME == $__OUT_NAME.mp4 ]]
 
148
    if [ $__IN_NAME = $__OUT_NAME.mp4 ]
151
149
    then
152
150
      echo "Filenames can't be the same."
153
151
      exit