def write(self, sequence, *args, **kwargs): if self.disable_ads: if sequence.segment.scte35 is not None: self.reader.ads = sequence.segment.scte35 if self.reader.ads: log.info("Will skip ads beginning with segment {0}".format(sequence.num)) else: log.info("Will stop skipping ads beginning with segment {0}".format(sequence.num)) if self.reader.ads: return return HLSStreamWriter.write(self, sequence, *args, **kwargs)
def __init__(self, *args, **kwargs): HLSStreamWriter.__init__(self, *args, **kwargs) options = self.session.plugins.get("twitch").options self.disable_ads = options.get("disable-ads") if self.disable_ads: log.info("Will skip ad segments")