1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 13:44:14 +01:00

postprocess: remove file when only use merge subtitles

In some cases we could end up with two subtitles
but we only have "one" subtitle. like one from HLS and one from
a different way.
This commit is contained in:
Johan Andersson 2023-06-01 21:11:31 +02:00
parent 9387fe6c2c
commit 485f3fa6d8
3 changed files with 2 additions and 5 deletions

View File

@ -133,7 +133,7 @@ class postprocess:
# This if statement is for use cases where both -S and -M are specified to not only merge the subtitle but also store it separately.
if self.config.get("merge_subtitle") and not self.config.get("subtitle"):
if self.subfixes and len(self.subfixes) >= 2:
if self.subfixes and len(self.subfixes) >= 2 and self.config.get("get_all_subtitles"):
for subfix in self.subfixes:
subfile = orig_filename.parent / (orig_filename.stem + "." + subfix + ".srt")
os.remove(subfile)

View File

@ -444,9 +444,6 @@ def _special_settings(config):
if config.get("get_only_episode_url"):
config.set("get_url", True)
if config.get("get_all_subtitles"):
config.set("subtitle", True)
return config

View File

@ -97,7 +97,7 @@ def subtitle_filter(subtitles) -> List:
def subtitle_decider(stream, subtitles):
if subtitles and (stream.config.get("merge_subtitle") or stream.config.get("subtitle")):
if subtitles and (stream.config.get("merge_subtitle") or stream.config.get("subtitle") or stream.config("get_all_subtitles")):
subtitles = subtitle_filter(subtitles)
if stream.config.get("get_all_subtitles"):
for sub in subtitles: