def make_downloader(self, metadata, options, payment_rate_manager): # TODO: check options for payment rate manager parameters prm = LiveStreamPaymentRateManager(self.default_payment_rate_manager, payment_rate_manager) def save_source_if_blob(stream_hash): if metadata.metadata_source == StreamMetadata.FROM_BLOB: d = self.stream_info_manager.save_sd_blob_hash_to_stream(stream_hash, metadata.source_blob_hash) else: d = defer.succeed(True) d.addCallback(lambda _: stream_hash) return d d = save_sd_info(self.stream_info_manager, metadata.validator.raw_info) d.addCallback(save_source_if_blob) def create_downloader(stream_hash): stream_downloader = FullLiveStreamDownloader(stream_hash, self.peer_finder, self.rate_limiter, self.blob_manager, self.stream_info_manager, prm, self.wallet, True) # TODO: change upload_allowed=True above to something better d = stream_downloader.set_stream_info() d.addCallback(lambda _: stream_downloader) return d d.addCallback(create_downloader) return d
def make_downloader(self, metadata, options, payment_rate_manager): # TODO: check options for payment rate manager parameters payment_rate_manager = LiveStreamPaymentRateManager(self.default_payment_rate_manager, payment_rate_manager) def save_source_if_blob(stream_hash): if metadata.metadata_source == StreamMetadata.FROM_BLOB: d = self.stream_info_manager.save_sd_blob_hash_to_stream(stream_hash, metadata.source_blob_hash) else: d = defer.succeed(True) d.addCallback(lambda _: stream_hash) return d d = save_sd_info(self.stream_info_manager, metadata.validator.raw_info) d.addCallback(save_source_if_blob) def create_downloader(stream_hash): stream_downloader = FullLiveStreamDownloader(stream_hash, self.peer_finder, self.rate_limiter, self.blob_manager, self.stream_info_manager, payment_rate_manager, self.wallet, True) # TODO: change upload_allowed=True above to something better d = stream_downloader.set_stream_info() d.addCallback(lambda _: stream_downloader) return d d.addCallback(create_downloader) return d
def read_sd_file(self, sd_blob): reader = BlobStreamDescriptorReader(sd_blob) return save_sd_info(self.stream_info_manager, reader, ignore_duplicate=True)