diff --git a/devine/core/manifests/dash.py b/devine/core/manifests/dash.py index 7189478..cf500f7 100644 --- a/devine/core/manifests/dash.py +++ b/devine/core/manifests/dash.py @@ -565,6 +565,9 @@ class DASH: segmented=True ) + if callable(track.OnSegmentDownloaded): + track.OnSegmentDownloaded(out_path) + # fix audio decryption on ATVP by fixing the sample description index # TODO: Should this be done in the video data or the init data? if isinstance(track, Audio): diff --git a/devine/core/manifests/hls.py b/devine/core/manifests/hls.py index ab50a1c..7633966 100644 --- a/devine/core/manifests/hls.py +++ b/devine/core/manifests/hls.py @@ -484,6 +484,9 @@ class HLS: segmented=True ) + if callable(track.OnSegmentDownloaded): + track.OnSegmentDownloaded(out_path) + download_size = out_path.stat().st_size # fix audio decryption on ATVP by fixing the sample description index diff --git a/devine/core/tracks/track.py b/devine/core/tracks/track.py index 2d94d0e..6880aa4 100644 --- a/devine/core/tracks/track.py +++ b/devine/core/tracks/track.py @@ -55,6 +55,8 @@ class Track: # TODO: Currently using OnFoo event naming, change to just segment_filter self.OnSegmentFilter: Optional[Callable] = None + # Called after one of the Track's segments have downloaded + self.OnSegmentDownloaded: Optional[Callable[[Path], None]] = None # Called after the Track has downloaded self.OnDownloaded: Optional[Callable] = None # Called after the Track or one of its segments have been decrypted