summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Xu <alex_y_xu@yahoo.ca>2013-08-17 22:22:38 -0400
committerAlex Xu <alex_y_xu@yahoo.ca>2013-08-17 22:22:38 -0400
commit780226fa442abda5cb5b1018e998f50e7985e908 (patch)
tree353b00372e2137e72236c5665293133114208277
parent11d9810801baa3e9627e99f0a58ef0eedaeb5bae (diff)
downloadhtml5ks-780226fa442abda5cb5b1018e998f50e7985e908.tar.xz
html5ks-780226fa442abda5cb5b1018e998f50e7985e908.zip
toolchain improvements
-rw-r--r--.gitignore6
-rw-r--r--README2
-rwxr-xr-xiencode.sh23
-rw-r--r--nginx.conf1
-rwxr-xr-xreencode.sh23
-rw-r--r--unrpyc/Makefile11
-rwxr-xr-xunrpyc/find-gzip.sh10
-rwxr-xr-xvencode.sh24
-rw-r--r--www/css/index.css6
9 files changed, 79 insertions, 27 deletions
diff --git a/.gitignore b/.gitignore
index 902d0ed..ef69786 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,11 +1,15 @@
# unrpyc built code
/unrpyc/renpy
+/unrpyc/*.json.gz
/unrpyc/*.json.o
/unrpyc/*.json
/unrpyc/*.rpyc
-# generated nginx conf
+# generated nginx conf - see nginx.sh
/nginx.gen.conf
# ignore 'copyrighted' contents similar to emulators
/www/scripts
/www/dump
/rpy
+
+# generated files
+/www/*.appcache
diff --git a/README b/README
index 170ed2c..f3a05a3 100644
--- a/README
+++ b/README
@@ -9,7 +9,7 @@ How to use:
1. Follow steps in unrpyc/README
2. Extract files from data.rpa with an appropriate tool. Put files in www/dump.
3. Modify www/dump/ui/bt-cf-{un,}checked.png to remove empty borders.
-4. Re-encode (sigh) dump/video/* into .mp4, .webm and .ogg files. reencode.sh can be used to do this, but spinning your own is fine too.
+4. Run reencode.sh to make .webm, .mp4, .ogg, .webp files. Use environment variable THREADS to control number of threads/processes spawned.
4. Run nginx.sh to start nginx with appropriate options for development, then connect to localhost:8080.
-- or --
diff --git a/iencode.sh b/iencode.sh
new file mode 100755
index 0000000..8e2fa81
--- /dev/null
+++ b/iencode.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# configure cwebp location if not in PATH
+CWEBP=cwebp
+# configure flags
+CWEBP_FLAGS="-m 6"
+
+cd $(dirname $0)/www/dump
+
+iencode() {
+ EXT="$1"
+ QUAL="$2"
+ export EXT QUAL CWEBP CWEBP_FLAGS
+ set -x
+ find . -name \*."${EXT}" -print0 | xargs -0 -n 1 bash -c '
+ IN="$0"
+ OUT="${IN%.${EXT}}.webp"
+ ${CWEBP} -q "${QUAL}" ${CWEBP_FLAGS} ${IN} -o ${OUT}
+ '
+}
+
+iencode jpg 90
+iencode png 99
diff --git a/nginx.conf b/nginx.conf
index cc1f0d7..c0a88bd 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -30,6 +30,7 @@ http {
text/html; charset=utf-8 html;
text/plain; charset=utf-8 txt;
video/mp4 mp4;
+ video/ogg ogv;
video/webm webm;
video/x-matroska mkv;
}
diff --git a/reencode.sh b/reencode.sh
index f7baf0d..8aba8d8 100755
--- a/reencode.sh
+++ b/reencode.sh
@@ -1,22 +1,7 @@
#!/bin/bash
-# configure ffmpeg location if not in PATH
-FFMPEG=ffmpeg
-# configure flags (e.g. if you want to force high -threads)
-FFMPEG_FLAGS=""
-set -e
-FFMPEG_FLAGS+="$@"
-cd $(dirname $0)/www/dump/video
+export THREADS=${THREADS:-4}
-encode() {
- set -x
- ${FFMPEG} -i "$1" -c:v "$2" $3 ${FFMPEG_FLAGS} "$4"
-}
-
-for f in *.mkv; do
- OUT=${f%.mkv}
- encode $f libx264 "-preset slower -tune animation" ${OUT}.mp4
- encode $f libvpx "-crf 15 -b:v 1M -an -f webm -y" /dev/null
- encode $f libvpx "-crf 15 -b:v 1M -c:a libvorbis" ${OUT}.webm
- encode $f libtheora "-qscale:v 6 -c:a libvorbis" ${OUT}.ogg
-done
+cd $(dirname $0)
+./vencode.sh
+./iencode.sh
diff --git a/unrpyc/Makefile b/unrpyc/Makefile
index b8ad495..ea97e56 100644
--- a/unrpyc/Makefile
+++ b/unrpyc/Makefile
@@ -1,7 +1,9 @@
-all: script.json.gz imachine.json.gz imachine_replay.json.gz
+gzip := $(shell ./find-gzip.sh)
+
+all: script.json script.json.gz imachine.json imachine.json.gz imachine_replay.json imachine_replay.json.gz
%.json.gz: %.json
- gzip -9c $< > $@
+ $(gzip) -c $< > $@
touch $< $@
script.json: $(patsubst %.rpyc,%.json,$(wildcard script-*.rpyc))
@@ -25,6 +27,9 @@ test: all
jshint --show-non-errors *.json
install: all
- install -t ../www/scripts script.json script.json.gz imachine.json imachine.json.gz
+ install -t ../www/scripts script.json script.json.gz imachine.json imachine.json.gz imachine_replay.json imachine_replay.json.gz
+
+uninstall:
+ rm -f ../www/scripts/*
.PHONY: all clean test install
diff --git a/unrpyc/find-gzip.sh b/unrpyc/find-gzip.sh
new file mode 100755
index 0000000..26e60c0
--- /dev/null
+++ b/unrpyc/find-gzip.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+ZOPFLI="$(command -v zopfli)"
+GZIP="$(command -v gzip)"
+if [ -n $ZOPFLI ]; then
+ echo "$ZOPFLI"
+elif [ -n $GZIP ]; then
+ echo "$GZIP -9"
+else
+ exit 1
+fi
diff --git a/vencode.sh b/vencode.sh
new file mode 100755
index 0000000..23d20be
--- /dev/null
+++ b/vencode.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# configure ffmpeg location if not in PATH
+FFMPEG=ffmpeg
+# configure flags
+FFMPEG_FLAGS="-y"
+
+set -e
+
+cd $(dirname $0)/www/dump/video
+
+vencode() {
+ set -x
+ ${FFMPEG} -threads ${THREADS} -i "$1" -c:v "$2" $3 ${FFMPEG_FLAGS} "$4"
+}
+
+for f in *.mkv; do
+ OUT=${f%.mkv}
+ vencode $f libx264 "-preset slower -tune animation" ${OUT}.mp4
+ vencode $f libvpx "-crf 15 -b:v 1M -an -f webm -y" /dev/null
+ vencode $f libvpx "-crf 15 -b:v 1M -c:a copy" ${OUT}.webm
+ vencode $f libtheora "-qscale:v 6 -c:a copy" ${OUT}.ogg
+done
+
diff --git a/www/css/index.css b/www/css/index.css
index 775bfc6..6d1264c 100644
--- a/www/css/index.css
+++ b/www/css/index.css
@@ -2,9 +2,9 @@
@font-face {
font-family: "Playtime";
/* src: url("playtime.ttf"); */
- src: url("font/PlaytimeWithHotToddies.woff") format('woff'),
- url("font/PlaytimeWithHotToddies.ttf") format('ttf'),
- url("font/PlaytimeWithHotToddies.svg") format('svg');
+ src: url("font/playtime-webfont.woff") format('woff'),
+ url("font/playtime-webfont.ttf") format('ttf'),
+ url("font/playtime-webfont.svg") format('svg');
}
@font-face {
font-family: "Gentium";