summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-04-28 00:13:20 +0200
committerCarl Hetherington <cth@carlh.net>2023-04-28 00:13:20 +0200
commit19a7c5e93d72cf40a70e87c840b6d009aa8d0d1b (patch)
tree4a74da450c307142477ec97d8ec5c7a40f1d1dbc
parent293f82daa07bbc357940e5dd214f7c534bab0a86 (diff)
Cope with WEBVTT files named with .srt extensions.
-rw-r--r--src/lib/string_text_file.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/string_text_file.cc b/src/lib/string_text_file.cc
index 869a2c96a..348ccd1d5 100644
--- a/src/lib/string_text_file.cc
+++ b/src/lib/string_text_file.cc
@@ -103,7 +103,12 @@ StringTextFile::StringTextFile (shared_ptr<const StringTextFileContent> content)
ucnv_close (to_utf8);
if (ext == ".srt") {
- reader.reset(new sub::SubripReader(utf8.get()));
+ try {
+ reader.reset(new sub::SubripReader(utf8.get()));
+ } catch (...) {
+ /* Sometimes files are have the .srt extension but are really WEBVTT */
+ reader.reset(new sub::WebVTTReader(utf8.get()));
+ }
} else if (ext == ".ssa" || ext == ".ass") {
reader.reset(new sub::SSAReader(utf8.get()));
} else if (ext == ".vtt") {