new package: srt2vobsub

This commit is contained in:
Tee KOBAYASHI 2022-04-13 22:48:23 +09:00 committed by xtkoba
parent 8da8a1009b
commit 25167cf73d
3 changed files with 110 additions and 0 deletions

View File

@ -0,0 +1,25 @@
TERMUX_PKG_HOMEPAGE=https://srt2vobsub.sourceforge.io/
TERMUX_PKG_DESCRIPTION="A command-line tool that generates a pair of .idx/.sub subtitle files from a textual subtitles file"
TERMUX_PKG_LICENSE="GPL-3.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=1.0
TERMUX_PKG_SRCURL=https://downloads.sourceforge.net/srt2vobsub/srt2vobsub-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=5f59319b300dc8629adf6debf94529f3f71ad8cc34bad5ead53a3cfc8d613c12
TERMUX_PKG_DEPENDS="bdsup2sub, ffmpeg, fontconfig-utils, imagemagick, mediainfo, python"
TERMUX_PKG_PLATFORM_INDEPENDENT=true
TERMUX_PKG_BUILD_IN_SRC=true
termux_step_make_install() {
install -Dm700 -T srt2vobsub.py $TERMUX_PREFIX/bin/srt2vobsub
install -Dm600 -t $TERMUX_PREFIX/share/man/man1 srt2vobsub.1.gz
install -Dm600 -t $TERMUX_PREFIX/share/doc/$TERMUX_PKG_NAME \
README defaults.conf langcodes.txt srt2vobsub.html
}
termux_step_create_debscripts() {
cat <<- EOF > ./postinst
#!$TERMUX_PREFIX/bin/sh
echo "Installing dependencies through pip..."
pip3 install chardet srt wand
EOF
}

View File

@ -0,0 +1,18 @@
--- a/defaults.conf
+++ b/defaults.conf
@@ -9,7 +9,7 @@
LANGUAGE=ja
ENCODING=UTF-8
ENCODINGERRORS=strict
-FONT=DejaVuSans
+FONT=DroidSans
FONTSIZE=-1
MAXLINESIZE=60
OUTLINEWIDTH=1
@@ -27,5 +27,5 @@
FIXTIMES=0
SAVESRT=0
BDSUP2SUBVERSION=auto
-BDSUP2SUBRUNTIME=/usr/share/bdsup2sub/BDSup2Sub.jar
+BDSUP2SUBRUNTIME=@TERMUX_PREFIX@/share/java/bdsup2sub.jar
BDSUP2SUBOPTS="()"

View File

@ -0,0 +1,67 @@
--- a/srt2vobsub.py
+++ b/srt2vobsub.py
@@ -52,7 +52,7 @@
'ENCODING': 'auto',
'ENCODINGERRORS': 'strict',
'SAVESRT': '0',
-'FONT': 'DejaVuSans',
+'FONT': 'DroidSans',
'FONTSIZE': 5.0,
'MAXLINESIZE': 60,
'OUTLINEWIDTH': 1,
@@ -69,7 +69,7 @@
'DEFAULTDISPLAYTIME': 2500,
'FIXTIMES': 1,
'BDSUP2SUBVERSION':'auto',
-'BDSUP2SUBRUNTIME': '/usr/share/bdsup2sub/BDSup2Sub.jar',
+'BDSUP2SUBRUNTIME': '@TERMUX_PREFIX@/share/java/bdsup2sub.jar',
'BDSUP2SUBOPTS': '()'
}
@@ -260,7 +260,7 @@
config[key] = value
return config
-license_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'LICENSE')
+license_file = '@TERMUX_PREFIX@/share/doc/srt2vobsub/LICENSE'
license_info = '''srt2vobsub Copyright (C) 2020 Michael Lange
This program comes with ABSOLUTELY NO WARRANTY; for details type
`cat %s'.
@@ -327,7 +327,7 @@
help='detect resolution and framerate from movie file', default='')
parser.add_argument('-t', '--font', dest='FONT',
- help='font to use; default: DejaVuSans',
+ help='font to use; default: DroidSans',
default=CONFIG['FONT'])
parser.add_argument('-g', '--antialiasing', dest='ANTIALIASING',
help='enable font antialiasing (default: off)', type=getboolean,
@@ -459,18 +459,12 @@
printerror('Error: requested font not found: %s.' % fontdesc)
for line in lines:
base, ext = os.path.splitext(os.path.basename(line))
- if base == 'DejaVuSans':
+ if base == 'DroidSans':
font = line
printerror('Will use %s instead.' % line)
break
else:
printerror('Error: unable to detect font "%s", command "fc-list" not found.')
- if not font:
- # fall back to our own DejaVuSans
- f = os.path.realpath(os.path.join(os.path.dirname(__file__), 'DejaVuSans.ttf'))
- if os.path.isfile(f):
- font = f
- printerror('Will use %s instead.' % f)
return font
def getstatusoutput(args, shell=False):
@@ -910,7 +904,7 @@
#### create temp directory ####
-TEMPDIR = tempfile.mkdtemp(prefix='srt2vobsub', dir='/tmp')
+TEMPDIR = tempfile.mkdtemp(prefix='srt2vobsub', dir='@TERMUX_PREFIX@/tmp')
os.chdir(TEMPDIR)
# try to convert the input file to UTF-8 first, so that we know what