mirror of https://github.com/devine-dl/devine.git
Remove empty caption lists post-parsing in Subtitle.parse()
This issue is common with Now TV where it for some reason parses into "two" languages. "en" and "eng". This results in one empty caption list, and one non empty caption list. The empty caption list tends to be first. This issue causes a multitude of snowballing problems later down the codebase like when converting to SRT it will result in "MULTI-LANGUAGE SRT" header, which most programs do not recognize, like mkvmerge, causing a mux failure.
This commit is contained in:
parent
9683c34337
commit
96f1cbb260
|
@ -187,6 +187,12 @@ class Subtitle(Track):
|
|||
except pycaption.exceptions.CaptionReadNoCaptions:
|
||||
return pycaption.CaptionSet({"en": []})
|
||||
|
||||
# remove empty caption lists or some code breaks, especially if it's the first list
|
||||
for language in caption_set.get_languages():
|
||||
if not caption_set.get_captions(language):
|
||||
# noinspection PyProtectedMember
|
||||
del caption_set._captions[language]
|
||||
|
||||
return caption_set
|
||||
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in New Issue