Accept blank lines as valid subtitles.
authorDavid Thompson <dthompson2@worcester.edu>
Sun, 25 Jan 2015 16:13:07 +0000 (11:13 -0500)
committerDavid Thompson <dthompson2@worcester.edu>
Sun, 25 Jan 2015 16:13:07 +0000 (11:13 -0500)
* srt2vtt (read-sub-rip): Allow the first subtitle line to be blank.

srt2vtt

diff --git a/srt2vtt b/srt2vtt
index 27e0927e23b3b28c7418cbc085e2d4e2e434fad8..15c812f8ae52dd578636fb632c07d2359755bb57 100755 (executable)
--- a/srt2vtt
+++ b/srt2vtt
@@ -66,7 +66,9 @@ two values: the start time and the end time.  Valid input looks like
                ((start end) (parse-time-span (read-line port)))
                ((lines) (let loop ((lines '()))
                           (let ((line (read-line port)))
-                            (if (string-null? line)
+                            (if (and (string-null? line)
+                                     ;; A subtitle may be a blank line!
+                                     (not (null? lines)))
                                 lines
                                 (loop (cons line lines)))))))
     (make-subtitle id start end lines)))