Update of /cvsroot/subproc/subproc
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv28892
Modified Files:
subproc
Log Message:
Correctly count the output subtitles.
Index: subproc
===================================================================
RCS file: /cvsroot/subproc/subproc/subproc,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- subproc 9 Feb 2007 23:04:38 -0000 1.23
+++ subproc 28 Feb 2007 16:00:51 -0000 1.24
@@ -24,7 +24,7 @@
#
BEGIN {
- LINT=fatal
+ LINT = fatal
# l10n support
TEXTDOMAIN = "subproc"
@@ -417,7 +417,7 @@
debug(sprintf(_"Read subtitles: %s.", isub["total"]))
}
-function write_microdvd(file, total, eol, j)
+function write_microdvd(file, total, eol, j, count)
{
# Requires the output file name and the total number of the
# subtitles to write and writes the subtitles from the
@@ -428,16 +428,19 @@
for (j = 1; j <= total; j++)
{
if (subtitles["text", j])
+ {
printf("{%s}{%s}%s%s",
int(subtitles["begin", j]),
int(subtitles["end", j]),
subtitles["text", j],
eol) > file
+ count++
+ }
}
# Then close the file
close(file)
- debug(sprintf(_"Written subtitles: %s.", isub["total"]))
+ debug(sprintf(_"Written subtitles: %s.", count))
}
function read_subviewer(file, j, line)
@@ -469,7 +472,7 @@
debug(sprintf(_"Read subtitles: %s.", isub["total"]))
}
-function write_subviewer(file, total, eol, j, k)
+function write_subviewer(file, total, eol, j, count)
{
# Requires the output file name and the total number of the
# subtitles to write and writes the subtitles from the
@@ -477,14 +480,14 @@
# subviewer format.
# Print the subtitles
- k = 1
+ count = 1
for (j = 1; j <= total; j++)
{
if (subtitles["text", j])
{
gsub(/\|/, eol, subtitles["text", j])
printf("%s%s",
- k, eol) > file
+ count, eol) > file
printf("%s --> %s%s",
time_to_subviewer(int(subtitles["begin", j])),
time_to_subviewer(int(subtitles["end", j])),
@@ -493,13 +496,13 @@
subtitles["text", j],
eol) > file
printf("%s", eol) > file
- k++
+ count++
}
}
# Then close the file
close(file)
- debug(sprintf(_"Written subtitles: %s.", isub["total"]))
+ debug(sprintf(_"Written subtitles: %s.", count - 1))
}
function time_to_subviewer(t, m, s)
|