fix subrip command line parsing, and tweak the output name slightly, to

allow for simpler automation.
This commit is contained in:
espie 2007-01-22 17:43:10 +00:00
parent d04ac7e6e8
commit 94b7017db6
3 changed files with 20 additions and 11 deletions

View File

@ -1,8 +1,8 @@
# $OpenBSD: Makefile,v 1.2 2007/01/22 13:57:53 espie Exp $
# $OpenBSD: Makefile,v 1.3 2007/01/22 17:43:10 espie Exp $
COMMENT= "extract subtitles from dvds"
DISTNAME= ogmrip-0.10.0
PKGNAME= subrip-0.10.0
PKGNAME= subrip-0.10.0p0
CATEGORIES= multimedia converters
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=ogmrip/}

View File

@ -1,5 +1,5 @@
#! /bin/sh
# $OpenBSD: subrip,v 1.1.1.1 2007/01/22 13:55:42 espie Exp $
# $OpenBSD: subrip,v 1.2 2007/01/22 17:43:10 espie Exp $
#
# Copyright (c) 2007 Marc Espie <espie@openbsd.org>
#
@ -36,9 +36,9 @@ fi
set -e
set -- $args
for i
while [ $# -ge 1 ]
do
case "$i" in
case "$1" in
-s)
sidlist="$sidlist $2"; shift; shift;;
-d)
@ -55,10 +55,12 @@ do
gextra="$gextra $2";shift; shift;;
--)
shift; break;;
*)
break;;
esac
done
if [ $# -gt 0 ]; then
if [ $# -ge 1 ]; then
output=$1
else
output=subtitle
@ -117,6 +119,7 @@ $keep || rm -f $mytmp/*.pgm
for sid in $sidlist
do
srttool -s <$mytmp/z$sid.srtx >$output.$sid
real=`echo $output|sed -e "s/%d/$sid/"`
srttool -s <$mytmp/z$sid.srtx >$real.srt
done
$keep || rm -rf $mytmp

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: subrip.1,v 1.1.1.1 2007/01/22 13:55:42 espie Exp $
.\" $OpenBSD: subrip.1,v 1.2 2007/01/22 17:43:10 espie Exp $
.\" Public domain
.Dd January 20, 2007
.Dt SUBRIP 1
@ -26,7 +26,11 @@ and passes them to
.Xr gocr 1
for conversion into srt files.
The resulting files are named
.Pa output.<sid> .
.Pa output.srt ,
where a
.Sq %d
in output is replaced with the subtitle stream number
.Ar sid .
.Pp
.Nm
is a simple shell-script that acts as a front-end and can be
@ -80,9 +84,11 @@ to store user-supplied information to help in character recognition.
.Nm
stores temporary files into a temporary subdirectory of
.Va TMPDIR ,
or
or of
.Pa /tmp
if not set.
if
.Va TMPDIR
is not set.
.Sh SEE ALSO
.Xr gocr 1 ,
.Xr mencoder 1 ,