Parser
The main task of a parser is to populate and update two data structures, playlists and levels, which are used by TapasPlayer.
- The playlists data structure is a list of dictionaries, one for each available video level. The dictionary has to include the following keys:
- url: the video level base URL;
- is_live: true if the video is a live stream;
- segments: a list of dictionaries. Each dictionary contains: the segment_url; the segment_duration; and the byterange, when the video segmentation is logic.
- start_index: index of the first chunk to be downloaded by the Downlaoder;
- end_index: index of the last chunk of the current playlist;
- duration: the duration (in seconds) of the playlist.
- The levels data structure is a list of dictionaries, one for each available video level. The dictionary has to include the following keys:
- rate: is the encoding rate of the video level measured in bytes/s;
- resolution: is the video level resolution.
Base class methods
-
class parsers.BaseParser.BaseParser(url, playlists_type, video_container)[source]
-
getFragmentDuration()[source]
Gets the nominal fragment duration in seconds for the current playlist
-
getLevels()[source]
Gets the list of levels.
Returns a list of dictionary with rate (in B/s) and resolution for each entry
Return type: | list of dictionaries |
-
getPlaylistType()[source]
Gets the playlist type (e.g. HLS or DASH)
-
getPlaylists()[source]
For eache level, gets its playlist with the segments properties (e.g. list of segment url, segments duration etc.)
Return type: | list of dictionaries |
-
getVideoContainer()[source]
Gets the video container type (e.g. MP4 or MPEGTS)
-
loadPlaylist()[source]
Called to start the download of the playlists for each level.
(It must be implemented for new parser).