summaryrefslogtreecommitdiff
path: root/qdsg.sh
blob: 41cd9b50e5547cb2b5b4451779dc99a6b483451e (plain)
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
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash

run_ffmpeg_if_not_exist() {
	local vid_input = $1
	local out_basename = $2
	local vid_codec = $3
	
	ffmpeg -i "$vid_input" -c:v "$vid_codec"
}

# generates multiple resolution for the given video files.
# $1: file name
# @return 
encode_video() {
	# name the input
	local vid_input = $1
	local vid
	
	
}

# ensure that the necessary directories exist
mkdir -p out/
mkdir -p out/video/mp4/

# copy robots.txt
echo "Copying robots.txt"
cp robots.txt out/

# process every html site
for inFile in in/*.html; do
	[ -e "$inFile" ] || continue
	
	echo "Processing file $inFile"
	filename=$(basename "$inFile")
	outFile="out/$filename"
	
	# get the title of the file if it is noted in the file
	site_title=""
	firstline=$(cat $inFile | head -n1)
	[[ $firstline == TITLE:* ]] && {
		site_title="$(echo $firstline | sed 's/TITLE: //g') - "
	}
	
	# assemble the page
	cat header.html | sed "s/%SITE_TITLE%/$site_title/g" > "$outFile"
	if [[ $firstline == TITLE:* ]]; then
		cat "$inFile" | tail -n +2 >> "$outFile"
	else
		echo -en "\t" && echo "$filename does not seem to have a title!"
		cat "$inFile" >> "$outFile"
	fi
	
	cat footer.html >> "$outFile"
done

for inFile in videos/*; do
	sleep 0
done