forked from MestreLion/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsrt3d
More file actions
executable file
·59 lines (48 loc) · 1.24 KB
/
srt3d
File metadata and controls
executable file
·59 lines (48 loc) · 1.24 KB
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
#!/bin/bash
format="--3dsbs"
args=(--font Arial --color 0xFFFF00 --margin-vertical 50)
myname="${0##*/}"
argerr() { printf "%s: %s\n" "$myname" "${1:-error}" >&2 ; usage 1 ; }
invalid() { argerr "invalid option: $1" ; }
usage() {
cat <<-USAGE
Usage: $myname [--sbs|--tab] INPUT...
USAGE
if [[ "$1" ]] ; then
cat >&2 <<- USAGE
Try '$myname --help' for more information.
USAGE
exit 1
fi
cat <<-USAGE
A sub3dtool wrapper to convert an SRT file to 3D (using ASS format)
using custom font and color options
Options:
-h|--help - show this page
-s|--sbs|--side - Side-by-Side (default)
-t|--tab|--top - Top-and-Bottom
Current custom options:
${args[@]}
Copyright (C) 2013 Rodrigo Silva (MestreLion) <linux@rodrigosilva.com>
License: GPLv3 or later. See <http://www.gnu.org/licenses/gpl.html>
USAGE
exit 0
}
# Option handling
files=()
for arg in "$@"; do [[ "$arg" == "-h" || "$arg" == "--help" ]] && usage ; done
while (( $# )); do
case "$1" in
-s|--sbs|--side) format="--3dsbs" ;;
-t|--tab|--top) format="--3dtb" ;;
--) shift ; break ;;
-*) invalid "$1" ;;
*) files+=( "$1" ) ;;
esac
shift
done
files+=( "$@" )
for sub in "${files[@]}"; do
out="${sub%.*}".ssa
sub3dtool "$format" "${args[@]}" -o "$out" "$sub"
done