diff --git a/devine/core/manifests/dash.py b/devine/core/manifests/dash.py index aac0e68..6a53bfd 100644 --- a/devine/core/manifests/dash.py +++ b/devine/core/manifests/dash.py @@ -207,7 +207,12 @@ class DASH: language=track_lang, is_original_lang=language and is_close_match(track_lang, [language]), descriptor=Video.Descriptor.DASH, - extra=(rep, adaptation_set), + data={ + "dash": { + "representation": rep, + "adaptation_set": adaptation_set + } + }, **track_args )) diff --git a/devine/core/manifests/hls.py b/devine/core/manifests/hls.py index fa89f32..08db12f 100644 --- a/devine/core/manifests/hls.py +++ b/devine/core/manifests/hls.py @@ -116,7 +116,11 @@ class HLS: bitrate=playlist.stream_info.average_bandwidth or playlist.stream_info.bandwidth, descriptor=Video.Descriptor.HLS, drm=session_drm, - extra=playlist, + data={ + "hls": { + "playlist": playlist + } + }, # video track args **(dict( range_=Video.Range.DV if any( @@ -166,7 +170,11 @@ class HLS: is_original_lang=language and is_close_match(track_lang, [language]), descriptor=Audio.Descriptor.HLS, drm=session_drm if media.type == "AUDIO" else None, - extra=media, + data={ + "hls": { + "media": media + } + }, # audio track args **(dict( bitrate=0, # TODO: M3U doesn't seem to state bitrate? diff --git a/devine/core/tracks/track.py b/devine/core/tracks/track.py index f15f7ef..39e3c27 100644 --- a/devine/core/tracks/track.py +++ b/devine/core/tracks/track.py @@ -35,7 +35,7 @@ class Track: name: Optional[str] = None, drm: Optional[Iterable[DRM_T]] = None, edition: Optional[str] = None, - extra: Optional[Any] = None, + data: Optional[dict] = None, id_: Optional[str] = None, ) -> None: if not isinstance(url, (str, list)): @@ -54,6 +54,8 @@ class Track: raise TypeError(f"Expected id_ to be a {str}, not {type(id_)}") if not isinstance(edition, (str, type(None))): raise TypeError(f"Expected edition to be a {str}, not {type(edition)}") + if not isinstance(data, (dict, type(None))): + raise TypeError(f"Expected data to be a {dict}, not {type(data)}") invalid_urls = ", ".join(set(type(x) for x in url if not isinstance(x, str))) if invalid_urls: @@ -74,7 +76,7 @@ class Track: self.name = name self.drm = drm self.edition: str = edition - self.extra: Any = extra or {} # allow anything for extra, but default to a dict + self.data = data or {} if not id_: this = copy(self)