Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if self.independent:
output.append(',INDEPENDENT=%s' % self.independent)
if self.byterange:
output.append(',BYTERANGE=%s' % self.byterange)
if self.gap:
output.append(',GAP=%s' % self.gap)
return ''.join(output)
def __str__(self):
return self.dumps(None)
class PartialSegmentList(list, GroupedBasePathMixin):
def __str__(self):
output = [str(part) for part in self]
return '\n'.join(output)
class Key(BasePathMixin):
'''
Key used to encrypt the segments in a m3u8 playlist (EXT-X-KEY)
`method`
is a string. ex.: "AES-128"
`uri`
is a string. ex:: "https://priv.example.com/key.php?r=52"
`base_uri`
self.parts.base_path = newbase_path
if self.init_section is not None:
self.init_section.base_path = newbase_path
@property
def base_uri(self):
return self._base_uri
@base_uri.setter
def base_uri(self, newbase_uri):
self._base_uri = newbase_uri
self.parts.base_uri = newbase_uri
if self.init_section is not None:
self.init_section.base_uri = newbase_uri
class SegmentList(list, GroupedBasePathMixin):
def __str__(self):
output = []
last_segment = None
for segment in self:
output.append(segment.dumps(last_segment))
last_segment = segment
return '\n'.join(output)
@property
def uri(self):
return [seg.uri for seg in self]
def by_key(self, key):
return [ segment for segment in self if segment.key == key ]
class TagList(list):
def __str__(self):
output = [str(tag) for tag in self]
return '\n'.join(output)
class MediaList(TagList, GroupedBasePathMixin):
@property
def uri(self):
return [media.uri for media in self]
class PlaylistList(TagList, GroupedBasePathMixin):
pass
class SessionDataList(TagList):
pass
class Start(object):
def __init__(self, time_offset, precise=None):
self.time_offset = float(time_offset)
self.precise = precise
def __str__(self):
output = [
'TIME-OFFSET=' + str(self.time_offset)
self.last_part = last_part
def dumps(self):
report = []
report.append('URI=' + quoted(self.uri))
report.append('LAST-MSN=' + number_to_string(self.last_msn))
if self.last_part is not None:
report.append('LAST-PART=' + number_to_string(
self.last_part))
return ('#EXT-X-RENDITION-REPORT:' + ','.join(report))
def __str__(self):
return self.dumps()
class RenditionReportList(list, GroupedBasePathMixin):
def __str__(self):
output = [str(report) for report in self]
return '\n'.join(output)
class ServerControl(object):
def __init__(self, can_skip_until=None, can_block_reload=None,
hold_back=None, part_hold_back=None):
self.can_skip_until = can_skip_until
self.can_block_reload = can_block_reload
self.hold_back = hold_back
self.part_hold_back = part_hold_back
def __getitem__(self, item):
return getattr(self, item)
media_out.append('CHANNELS=' + quoted(self.channels))
return ('#EXT-X-MEDIA:' + ','.join(media_out))
def __str__(self):
return self.dumps()
class TagList(list):
def __str__(self):
output = [str(tag) for tag in self]
return '\n'.join(output)
class MediaList(TagList, GroupedBasePathMixin):
@property
def uri(self):
return [media.uri for media in self]
class PlaylistList(TagList, GroupedBasePathMixin):
pass
class SessionDataList(TagList):
pass
class Start(object):