refactor(Track): Rename Descriptor's M3U & MPD to HLS & DASH

This commit is contained in:
rlaphoenix 2024-03-01 03:13:16 +00:00
parent ec5bd39c1b
commit fa9db335d6
5 changed files with 8 additions and 8 deletions

View File

@ -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,

View File

@ -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(

View File

@ -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
))

View File

@ -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

View File

@ -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,