From 19a7c5e93d72cf40a70e87c840b6d009aa8d0d1b Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 28 Apr 2023 00:13:20 +0200 Subject: [PATCH] Cope with WEBVTT files named with .srt extensions. --- src/lib/string_text_file.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 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") { -- 2.30.2