From: Carl Hetherington Date: Thu, 27 Apr 2023 22:13:20 +0000 (+0200) Subject: Cope with WEBVTT files named with .srt extensions. X-Git-Tag: v2.16.56~31 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=19a7c5e93d72cf40a70e87c840b6d009aa8d0d1b Cope with WEBVTT files named with .srt extensions. --- 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") {