mirror of
https://github.com/devine-dl/devine.git
synced 2025-04-29 17:49:44 +00:00
Move Track OnDownloaded event before decryption
This commit is contained in:
parent
a98d1d98ac
commit
87779f4e7d
@ -893,6 +893,8 @@ class dl:
|
|||||||
)
|
)
|
||||||
|
|
||||||
track.path = save_path
|
track.path = save_path
|
||||||
|
if callable(track.OnDownloaded):
|
||||||
|
track.OnDownloaded()
|
||||||
|
|
||||||
if drm:
|
if drm:
|
||||||
progress(downloaded="Decrypting", completed=0, total=100)
|
progress(downloaded="Decrypting", completed=0, total=100)
|
||||||
@ -930,9 +932,6 @@ class dl:
|
|||||||
if track.path.stat().st_size <= 3: # Empty UTF-8 BOM == 3 bytes
|
if track.path.stat().st_size <= 3: # Empty UTF-8 BOM == 3 bytes
|
||||||
raise IOError("Download failed, the downloaded file is empty.")
|
raise IOError("Download failed, the downloaded file is empty.")
|
||||||
|
|
||||||
if callable(track.OnDownloaded):
|
|
||||||
track.OnDownloaded()
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_profile(service: str) -> Optional[str]:
|
def get_profile(service: str) -> Optional[str]:
|
||||||
"""Get profile for Service from config."""
|
"""Get profile for Service from config."""
|
||||||
|
@ -502,6 +502,10 @@ class DASH:
|
|||||||
f.write(segment_data)
|
f.write(segment_data)
|
||||||
segment_file.unlink()
|
segment_file.unlink()
|
||||||
|
|
||||||
|
track.path = save_path
|
||||||
|
if callable(track.OnDownloaded):
|
||||||
|
track.OnDownloaded()
|
||||||
|
|
||||||
if drm:
|
if drm:
|
||||||
progress(downloaded="Decrypting", completed=0, total=100)
|
progress(downloaded="Decrypting", completed=0, total=100)
|
||||||
drm.decrypt(save_path)
|
drm.decrypt(save_path)
|
||||||
@ -510,7 +514,6 @@ class DASH:
|
|||||||
track.OnDecrypted(drm)
|
track.OnDecrypted(drm)
|
||||||
progress(downloaded="Decrypted", completed=100)
|
progress(downloaded="Decrypted", completed=100)
|
||||||
|
|
||||||
track.path = save_path
|
|
||||||
save_dir.rmdir()
|
save_dir.rmdir()
|
||||||
|
|
||||||
progress(downloaded="Downloaded")
|
progress(downloaded="Downloaded")
|
||||||
|
@ -361,6 +361,8 @@ class HLS:
|
|||||||
progress(downloaded="Downloaded")
|
progress(downloaded="Downloaded")
|
||||||
|
|
||||||
track.path = save_path
|
track.path = save_path
|
||||||
|
if callable(track.OnDownloaded):
|
||||||
|
track.OnDownloaded()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def download_segment(
|
def download_segment(
|
||||||
|
@ -55,8 +55,7 @@ class Track:
|
|||||||
# TODO: Currently using OnFoo event naming, change to just segment_filter
|
# TODO: Currently using OnFoo event naming, change to just segment_filter
|
||||||
self.OnSegmentFilter: Optional[Callable] = None
|
self.OnSegmentFilter: Optional[Callable] = None
|
||||||
|
|
||||||
# TODO: This should realistically be before decryption
|
# Called after the Track has downloaded
|
||||||
# Called after the Track has been fully downloaded and decrypted
|
|
||||||
self.OnDownloaded: Optional[Callable] = None
|
self.OnDownloaded: Optional[Callable] = None
|
||||||
# Called after the Track or one of its segments have been decrypted
|
# Called after the Track or one of its segments have been decrypted
|
||||||
self.OnDecrypted: Optional[Callable[[DRM_T, Optional[m3u8.Segment]], None]] = None
|
self.OnDecrypted: Optional[Callable[[DRM_T, Optional[m3u8.Segment]], None]] = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user