Skip to content

Commit

Permalink
refactor(Track): Rename Descriptor's M3U & MPD to HLS & DASH
Browse files Browse the repository at this point in the history
  • Loading branch information
rlaphoenix committed Mar 1, 2024
1 parent fa55e02 commit d16ace8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions devine/commands/dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ def cleanup():
cleanup()

try:
if track.descriptor == track.Descriptor.M3U:
if track.descriptor == track.Descriptor.HLS:
HLS.download_track(
track=track,
save_path=save_path,
Expand All @@ -845,7 +845,7 @@ def cleanup():
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,
Expand Down
2 changes: 1 addition & 1 deletion devine/core/drm/widevine.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def from_track(cls, track: AnyTrack, session: Optional[Session] = None) -> Widev
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(
Expand Down
2 changes: 1 addition & 1 deletion devine/core/manifests/dash.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def to_tracks(
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
))
Expand Down
4 changes: 2 additions & 2 deletions devine/core/manifests/hls.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def to_tracks(self, language: Union[str, Language]) -> Tracks:
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
Expand Down Expand Up @@ -164,7 +164,7 @@ def to_tracks(self, language: Union[str, Language]) -> Tracks:
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
Expand Down
4 changes: 2 additions & 2 deletions devine/core/tracks/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
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,
Expand Down

0 comments on commit d16ace8

Please sign in to comment.