mirror of https://github.com/devine-dl/devine.git
No longer pass the track through track events
If you are setting a callable onto a track event, then you have access to the track variable, so just include/use that in your lambda/callable.
This commit is contained in:
parent
7be24a130d
commit
439e376b38
|
@ -341,7 +341,7 @@ class dl:
|
||||||
non_sdh_sub = deepcopy(subtitle)
|
non_sdh_sub = deepcopy(subtitle)
|
||||||
non_sdh_sub.id += "_stripped"
|
non_sdh_sub.id += "_stripped"
|
||||||
non_sdh_sub.sdh = False
|
non_sdh_sub.sdh = False
|
||||||
non_sdh_sub.OnMultiplex = lambda x: x.strip_hearing_impaired()
|
non_sdh_sub.OnMultiplex = lambda: non_sdh_sub.strip_hearing_impaired()
|
||||||
title.tracks.add(non_sdh_sub)
|
title.tracks.add(non_sdh_sub)
|
||||||
|
|
||||||
with console.status("Sorting tracks by language and bitrate...", spinner="dots"):
|
with console.status("Sorting tracks by language and bitrate...", spinner="dots"):
|
||||||
|
@ -585,7 +585,7 @@ class dl:
|
||||||
track.repackage()
|
track.repackage()
|
||||||
has_repacked = True
|
has_repacked = True
|
||||||
if callable(track.OnRepacked):
|
if callable(track.OnRepacked):
|
||||||
track.OnRepacked(track)
|
track.OnRepacked()
|
||||||
if has_repacked:
|
if has_repacked:
|
||||||
# we don't want to fill up the log with "Repacked x track"
|
# we don't want to fill up the log with "Repacked x track"
|
||||||
self.log.info("Repacked one or more tracks with FFMPEG")
|
self.log.info("Repacked one or more tracks with FFMPEG")
|
||||||
|
@ -899,7 +899,7 @@ class dl:
|
||||||
drm.decrypt(save_path)
|
drm.decrypt(save_path)
|
||||||
track.drm = None
|
track.drm = None
|
||||||
if callable(track.OnDecrypted):
|
if callable(track.OnDecrypted):
|
||||||
track.OnDecrypted(track)
|
track.OnDecrypted()
|
||||||
progress(downloaded="Decrypted", completed=100)
|
progress(downloaded="Decrypted", completed=100)
|
||||||
|
|
||||||
if isinstance(track, Subtitle):
|
if isinstance(track, Subtitle):
|
||||||
|
@ -931,7 +931,7 @@ class dl:
|
||||||
raise IOError("Download failed, the downloaded file is empty.")
|
raise IOError("Download failed, the downloaded file is empty.")
|
||||||
|
|
||||||
if callable(track.OnDownloaded):
|
if callable(track.OnDownloaded):
|
||||||
track.OnDownloaded(track)
|
track.OnDownloaded()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_profile(service: str) -> Optional[str]:
|
def get_profile(service: str) -> Optional[str]:
|
||||||
|
|
|
@ -507,7 +507,7 @@ class DASH:
|
||||||
drm.decrypt(save_path)
|
drm.decrypt(save_path)
|
||||||
track.drm = None
|
track.drm = None
|
||||||
if callable(track.OnDecrypted):
|
if callable(track.OnDecrypted):
|
||||||
track.OnDecrypted(track)
|
track.OnDecrypted()
|
||||||
progress(downloaded="Decrypted", completed=100)
|
progress(downloaded="Decrypted", completed=100)
|
||||||
|
|
||||||
track.path = save_path
|
track.path = save_path
|
||||||
|
|
|
@ -511,7 +511,7 @@ class HLS:
|
||||||
newest_segment_key[0].decrypt(out_path)
|
newest_segment_key[0].decrypt(out_path)
|
||||||
track.drm = None
|
track.drm = None
|
||||||
if callable(track.OnDecrypted):
|
if callable(track.OnDecrypted):
|
||||||
track.OnDecrypted(track)
|
track.OnDecrypted()
|
||||||
|
|
||||||
return download_size
|
return download_size
|
||||||
|
|
||||||
|
|
|
@ -304,7 +304,7 @@ class Tracks:
|
||||||
if not vt.path or not vt.path.exists():
|
if not vt.path or not vt.path.exists():
|
||||||
raise ValueError("Video Track must be downloaded before muxing...")
|
raise ValueError("Video Track must be downloaded before muxing...")
|
||||||
if callable(vt.OnMultiplex):
|
if callable(vt.OnMultiplex):
|
||||||
vt.OnMultiplex(vt)
|
vt.OnMultiplex()
|
||||||
cl.extend([
|
cl.extend([
|
||||||
"--language", "0:{}".format(LANGUAGE_MUX_MAP.get(
|
"--language", "0:{}".format(LANGUAGE_MUX_MAP.get(
|
||||||
str(vt.language), str(vt.language)
|
str(vt.language), str(vt.language)
|
||||||
|
@ -319,7 +319,7 @@ class Tracks:
|
||||||
if not at.path or not at.path.exists():
|
if not at.path or not at.path.exists():
|
||||||
raise ValueError("Audio Track must be downloaded before muxing...")
|
raise ValueError("Audio Track must be downloaded before muxing...")
|
||||||
if callable(at.OnMultiplex):
|
if callable(at.OnMultiplex):
|
||||||
at.OnMultiplex(at)
|
at.OnMultiplex()
|
||||||
cl.extend([
|
cl.extend([
|
||||||
"--track-name", f"0:{at.get_track_name() or ''}",
|
"--track-name", f"0:{at.get_track_name() or ''}",
|
||||||
"--language", "0:{}".format(LANGUAGE_MUX_MAP.get(
|
"--language", "0:{}".format(LANGUAGE_MUX_MAP.get(
|
||||||
|
@ -336,7 +336,7 @@ class Tracks:
|
||||||
if not st.path or not st.path.exists():
|
if not st.path or not st.path.exists():
|
||||||
raise ValueError("Text Track must be downloaded before muxing...")
|
raise ValueError("Text Track must be downloaded before muxing...")
|
||||||
if callable(st.OnMultiplex):
|
if callable(st.OnMultiplex):
|
||||||
st.OnMultiplex(st)
|
st.OnMultiplex()
|
||||||
default = bool(self.audio and is_close_match(st.language, [self.audio[0].language]) and st.forced)
|
default = bool(self.audio and is_close_match(st.language, [self.audio[0].language]) and st.forced)
|
||||||
cl.extend([
|
cl.extend([
|
||||||
"--track-name", f"0:{st.get_track_name() or ''}",
|
"--track-name", f"0:{st.get_track_name() or ''}",
|
||||||
|
|
Loading…
Reference in New Issue