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:
rlaphoenix 2024-02-10 17:47:12 +00:00
parent 7be24a130d
commit 439e376b38
4 changed files with 9 additions and 9 deletions

View File

@ -341,7 +341,7 @@ class dl:
non_sdh_sub = deepcopy(subtitle)
non_sdh_sub.id += "_stripped"
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)
with console.status("Sorting tracks by language and bitrate...", spinner="dots"):
@ -585,7 +585,7 @@ class dl:
track.repackage()
has_repacked = True
if callable(track.OnRepacked):
track.OnRepacked(track)
track.OnRepacked()
if has_repacked:
# we don't want to fill up the log with "Repacked x track"
self.log.info("Repacked one or more tracks with FFMPEG")
@ -899,7 +899,7 @@ class dl:
drm.decrypt(save_path)
track.drm = None
if callable(track.OnDecrypted):
track.OnDecrypted(track)
track.OnDecrypted()
progress(downloaded="Decrypted", completed=100)
if isinstance(track, Subtitle):
@ -931,7 +931,7 @@ class dl:
raise IOError("Download failed, the downloaded file is empty.")
if callable(track.OnDownloaded):
track.OnDownloaded(track)
track.OnDownloaded()
@staticmethod
def get_profile(service: str) -> Optional[str]:

View File

@ -507,7 +507,7 @@ class DASH:
drm.decrypt(save_path)
track.drm = None
if callable(track.OnDecrypted):
track.OnDecrypted(track)
track.OnDecrypted()
progress(downloaded="Decrypted", completed=100)
track.path = save_path

View File

@ -511,7 +511,7 @@ class HLS:
newest_segment_key[0].decrypt(out_path)
track.drm = None
if callable(track.OnDecrypted):
track.OnDecrypted(track)
track.OnDecrypted()
return download_size

View File

@ -304,7 +304,7 @@ class Tracks:
if not vt.path or not vt.path.exists():
raise ValueError("Video Track must be downloaded before muxing...")
if callable(vt.OnMultiplex):
vt.OnMultiplex(vt)
vt.OnMultiplex()
cl.extend([
"--language", "0:{}".format(LANGUAGE_MUX_MAP.get(
str(vt.language), str(vt.language)
@ -319,7 +319,7 @@ class Tracks:
if not at.path or not at.path.exists():
raise ValueError("Audio Track must be downloaded before muxing...")
if callable(at.OnMultiplex):
at.OnMultiplex(at)
at.OnMultiplex()
cl.extend([
"--track-name", f"0:{at.get_track_name() or ''}",
"--language", "0:{}".format(LANGUAGE_MUX_MAP.get(
@ -336,7 +336,7 @@ class Tracks:
if not st.path or not st.path.exists():
raise ValueError("Text Track must be downloaded before muxing...")
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)
cl.extend([
"--track-name", f"0:{st.get_track_name() or ''}",