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() cleanup()
try: try:
if track.descriptor == track.Descriptor.M3U: if track.descriptor == track.Descriptor.HLS:
HLS.download_track( HLS.download_track(
track=track, track=track,
save_path=save_path, save_path=save_path,
@ -845,7 +845,7 @@ class dl:
proxy=proxy, proxy=proxy,
license_widevine=prepare_drm license_widevine=prepare_drm
) )
elif track.descriptor == track.Descriptor.MPD: elif track.descriptor == track.Descriptor.DASH:
DASH.download_track( DASH.download_track(
track=track, track=track,
save_path=save_path, save_path=save_path,

View File

@ -78,7 +78,7 @@ class Widevine:
pssh_boxes: list[Container] = [] pssh_boxes: list[Container] = []
tenc_boxes: list[Container] = [] tenc_boxes: list[Container] = []
if track.descriptor == track.Descriptor.M3U: if track.descriptor == track.Descriptor.HLS:
m3u_url = track.url m3u_url = track.url
master = m3u8.loads(session.get(m3u_url).text, uri=m3u_url) master = m3u8.loads(session.get(m3u_url).text, uri=m3u_url)
pssh_boxes.extend( pssh_boxes.extend(

View File

@ -206,7 +206,7 @@ class DASH:
codec=track_codec, codec=track_codec,
language=track_lang, language=track_lang,
is_original_lang=language and is_close_match(track_lang, [language]), is_original_lang=language and is_close_match(track_lang, [language]),
descriptor=Video.Descriptor.MPD, descriptor=Video.Descriptor.DASH,
extra=(rep, adaptation_set), extra=(rep, adaptation_set),
**track_args **track_args
)) ))

View File

@ -114,7 +114,7 @@ class HLS:
language=language, # HLS manifests do not seem to have language info language=language, # HLS manifests do not seem to have language info
is_original_lang=True, # TODO: All we can do is assume Yes is_original_lang=True, # TODO: All we can do is assume Yes
bitrate=playlist.stream_info.average_bandwidth or playlist.stream_info.bandwidth, bitrate=playlist.stream_info.average_bandwidth or playlist.stream_info.bandwidth,
descriptor=Video.Descriptor.M3U, descriptor=Video.Descriptor.HLS,
drm=session_drm, drm=session_drm,
extra=playlist, extra=playlist,
# video track args # video track args
@ -164,7 +164,7 @@ class HLS:
codec=codec, codec=codec,
language=track_lang, # HLS media may not have language info, fallback if needed language=track_lang, # HLS media may not have language info, fallback if needed
is_original_lang=language and is_close_match(track_lang, [language]), 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, drm=session_drm if media.type == "AUDIO" else None,
extra=media, extra=media,
# audio track args # audio track args

View File

@ -20,8 +20,8 @@ from devine.core.utils.subprocess import ffprobe
class Track: class Track:
class Descriptor(Enum): class Descriptor(Enum):
URL = 1 # Direct URL, nothing fancy URL = 1 # Direct URL, nothing fancy
M3U = 2 # https://en.wikipedia.org/wiki/M3U (and M3U8) HLS = 2 # https://en.wikipedia.org/wiki/HTTP_Live_Streaming
MPD = 3 # https://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP DASH = 3 # https://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP
def __init__( def __init__(
self, self,