-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmobileconverter.sh
More file actions
executable file
·50 lines (40 loc) · 994 Bytes
/
mobileconverter.sh
File metadata and controls
executable file
·50 lines (40 loc) · 994 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# HTML5 video converter
# ---------------------------------------------------------------------
function makefiles {
# Get current folder name
filename_original=$(basename "$1")
filename=${filename_original%.*}
#filename=${filename//[ ()$+&\.\-\'\,]/}
# filename=${filename,,}
extension=${filename_original##*.}
target="$2"
cd "$target/"
source="$1"
# Create mp4 if not same source
mp4="$filename.mp3"
echo "- Convert: $mp4"
avconv -i "$source" "$mp4"
}
time_start_total=`date +%s`
RAWVIDEO=false
if [ -d "$1" ]
then
# Move to target directory
cd "$1"
### Loop all image folders / days ###
for i in $1/*
do
makefiles "$i" "$2"
done
elif [ -f "$1" ]
then
cd $(dirname $1)
makefiles "$1" "$2"
else
echo "Usage: [$filename]"
fi
#end of script
time_end=`date +%s`
time_elapsed=$((time_end - time_start_total))
echo "script executed in $time_elapsed seconds" $(( time_elapsed / 60 ))m $(( time_elapsed % 60 ))s