From fa9db335d6b7d11a3d40f6157004b2b9b69a8673 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Fri, 1 Mar 2024 03:13:16 +0000 Subject: [PATCH] refactor(Track): Rename Descriptor's M3U & MPD to HLS & DASH --- devine/commands/dl.py | 4 ++-- devine/core/drm/widevine.py | 2 +- devine/core/manifests/dash.py | 2 +- devine/core/manifests/hls.py | 4 ++-- devine/core/tracks/track.py | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/devine/commands/dl.py b/devine/commands/dl.py index 68c32d3..0e6e547 100644 --- a/devine/commands/dl.py +++ b/devine/commands/dl.py @@ -835,7 +835,7 @@ class dl: cleanup() try: - if track.descriptor == track.Descriptor.M3U: + if track.descriptor == track.Descriptor.HLS: HLS.download_track( track=track, save_path=save_path, @@ -845,7 +845,7 @@ class dl: proxy=proxy, license_widevine=prepare_drm ) - elif track.descriptor == track.Descriptor.MPD: + elif track.descriptor == track.Descriptor.DASH: DASH.download_track( track=track, save_path=save_path, diff --git a/devine/core/drm/widevine.py b/devine/core/drm/widevine.py index 19be6e8..266aa1e 100644 --- a/devine/core/drm/widevine.py +++ b/devine/core/drm/widevine.py @@ -78,7 +78,7 @@ class Widevine: pssh_boxes: list[Container] = [] tenc_boxes: list[Container] = [] - if track.descriptor == track.Descriptor.M3U: + if track.descriptor == track.Descriptor.HLS: m3u_url = track.url master = m3u8.loads(session.get(m3u_url).text, uri=m3u_url) pssh_boxes.extend( diff --git a/devine/core/manifests/dash.py b/devine/core/manifests/dash.py index a5ea946..aac0e68 100644 --- a/devine/core/manifests/dash.py +++ b/devine/core/manifests/dash.py @@ -206,7 +206,7 @@ class DASH: codec=track_codec, language=track_lang, is_original_lang=language and is_close_match(track_lang, [language]), - descriptor=Video.Descriptor.MPD, + descriptor=Video.Descriptor.DASH, extra=(rep, adaptation_set), **track_args )) diff --git a/devine/core/manifests/hls.py b/devine/core/manifests/hls.py index ccbd5ad..fa89f32 100644 --- a/devine/core/manifests/hls.py +++ b/devine/core/manifests/hls.py @@ -114,7 +114,7 @@ class HLS: language=language, # HLS manifests do not seem to have language info is_original_lang=True, # TODO: All we can do is assume Yes bitrate=playlist.stream_info.average_bandwidth or playlist.stream_info.bandwidth, - descriptor=Video.Descriptor.M3U, + descriptor=Video.Descriptor.HLS, drm=session_drm, extra=playlist, # video track args @@ -164,7 +164,7 @@ class HLS: codec=codec, language=track_lang, # HLS media may not have language info, fallback if needed is_original_lang=language and is_close_match(track_lang, [language]), - descriptor=Audio.Descriptor.M3U, + descriptor=Audio.Descriptor.HLS, drm=session_drm if media.type == "AUDIO" else None, extra=media, # audio track args diff --git a/devine/core/tracks/track.py b/devine/core/tracks/track.py index 4468542..7532909 100644 --- a/devine/core/tracks/track.py +++ b/devine/core/tracks/track.py @@ -20,8 +20,8 @@ from devine.core.utils.subprocess import ffprobe class Track: class Descriptor(Enum): URL = 1 # Direct URL, nothing fancy - M3U = 2 # https://en.wikipedia.org/wiki/M3U (and M3U8) - MPD = 3 # https://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP + HLS = 2 # https://en.wikipedia.org/wiki/HTTP_Live_Streaming + DASH = 3 # https://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP def __init__( self,