/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/wav2mp4.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:
11
11
#
12
12
######
13
13
 
14
 
ARGS=()
15
 
ARGS="${@}"
16
 
 
17
14
__TMP_IMAGE_NAME=__SPEAKER_IMAGE.PNG
18
 
__OUT_NAME=
19
 
__IN_NAME=
 
15
__OUT_NAME=""
 
16
__IN_NAME=""
20
17
 
21
18
__USE_DIFFERENT_IMAGE=false
22
 
__OTHER_IMAGE_NAME=
 
19
__OTHER_IMAGE_NAME=""
23
20
 
24
 
__help () {
 
21
function __usage () {
25
22
  echo "wav2mp4.sh --- Convert audio to a video for upload. "
26
23
  echo " "
27
24
  echo "-i <audio.wav>        The input audio."
35
32
  exit
36
33
}
37
34
 
38
 
__do_cleanup () {
 
35
function __do_cleanup () {
39
36
  rm $__TMP_IMAGE_NAME
40
37
}
41
38
 
42
 
___do_convertion () {
 
39
function __do_convertion () {
43
40
  ffmpeg -loop 1\
44
41
         -i "$__TMP_IMAGE_NAME"\
45
42
         -i "$__IN_NAME"\
50
47
}
51
48
 
52
49
 
53
 
__parse_args() {
 
50
function __parse_args () {
54
51
  if [[ -z "$1" ]]
55
52
  then
56
53
    echo "Try --help or -h."
79
76
      shift
80
77
      ;;
81
78
      -h|--help)
82
 
      __help
 
79
      __usage
83
80
      exit
84
81
      shift
85
82
      ;;
86
83
      *)
87
 
      __help
 
84
      __usage
88
85
      exit 1
89
86
      shift
90
87
      ;;
97
94
}
98
95
 
99
96
 
100
 
__write_image () {
 
97
function __write_image () {
101
98
  __IMAGE_BASE64="iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAQAAABh3xcBAAAZEHpUWHRSYXcgcHJvZmlsZSB0eXBl
102
99
IGV4aWYAAHja1ZtZdhy3GYXfsYosAfOwHIznZAdZfr6LalEURdmmnDyYdNRks7oK+Ic7AIjZ//n3
103
100
Mf/iKxebTUyl5paz5Su22Hznh2qfr+fV2Xj/vV8nvn5yP75v3v7geQ28hucPeT+vrvN++v6BEl/v
396
393
}
397
394
 
398
395
 
399
 
__main () {
 
396
function __main () {
400
397
  
401
398
  if [[ $__USE_DIFFERENT_IMAGE == true ]]
402
399
  then
419
416
  fi
420
417
  
421
418
  
422
 
  ___do_convertion
 
419
  __do_convertion
423
420
  
424
421
  if [[ $__USE_DIFFERENT_IMAGE == false ]]
425
422
  then