mirror of https://github.com/devine-dl/devine.git
fix(DASH): Fix merge regression from recent commit
An else tree was used in 4d6c72ba30
when it shouldn't have been.
Fixes #81
This commit is contained in:
parent
1d5d4fd347
commit
35501bdb9c
|
@ -496,23 +496,22 @@ class DASH:
|
||||||
f.write(init_data)
|
f.write(init_data)
|
||||||
if len(segments_to_merge) > 1:
|
if len(segments_to_merge) > 1:
|
||||||
progress(downloaded="Merging", completed=0, total=len(segments_to_merge))
|
progress(downloaded="Merging", completed=0, total=len(segments_to_merge))
|
||||||
else:
|
for segment_file in segments_to_merge:
|
||||||
for segment_file in segments_to_merge:
|
segment_data = segment_file.read_bytes()
|
||||||
segment_data = segment_file.read_bytes()
|
# TODO: fix encoding after decryption?
|
||||||
# TODO: fix encoding after decryption?
|
if (
|
||||||
if (
|
not drm and isinstance(track, Subtitle) and
|
||||||
not drm and isinstance(track, Subtitle) and
|
track.codec not in (Subtitle.Codec.fVTT, Subtitle.Codec.fTTML)
|
||||||
track.codec not in (Subtitle.Codec.fVTT, Subtitle.Codec.fTTML)
|
):
|
||||||
):
|
segment_data = try_ensure_utf8(segment_data)
|
||||||
segment_data = try_ensure_utf8(segment_data)
|
segment_data = segment_data.decode("utf8"). \
|
||||||
segment_data = segment_data.decode("utf8"). \
|
replace("‎", html.unescape("‎")). \
|
||||||
replace("‎", html.unescape("‎")). \
|
replace("‏", html.unescape("‏")). \
|
||||||
replace("‏", html.unescape("‏")). \
|
encode("utf8")
|
||||||
encode("utf8")
|
f.write(segment_data)
|
||||||
f.write(segment_data)
|
f.flush()
|
||||||
f.flush()
|
segment_file.unlink()
|
||||||
segment_file.unlink()
|
progress(advance=1)
|
||||||
progress(advance=1)
|
|
||||||
|
|
||||||
track.path = save_path
|
track.path = save_path
|
||||||
if callable(track.OnDownloaded):
|
if callable(track.OnDownloaded):
|
||||||
|
|
Loading…
Reference in New Issue