refactor(Track): Rename extra to data, enforce type as dict

Setting data as a dictionary allows more places of code (including DASH, HLS, Services, etc) to get/set what they want by key instead of typically by index (list/tuple). Tuples or lists were typically in services because DASH and HLS stored needed data as a tuple and services did not want to interrupt or remove that data, even though it would be fine.
This commit is contained in:
rlaphoenix
2024-03-01 04:29:45 +00:00
parent a6a5699577
commit 90c544966a
3 changed files with 20 additions and 5 deletions

View File

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