def start(self, name, file_path, bid, title=None, description=None, thumbnail=None, key_fee=None, key_fee_address=None, content_license=None, author=None, sources=None): def _show_result(): message = "[" + str(datetime.now()) + "] Published " + self.file_name + " --> lbry://" + \ str(self.publish_name) + " with txid: " + str(self.tx_hash) log.info(message) return defer.succeed(message) self.publish_name = name self.file_path = file_path self.bid_amount = bid self.title = title self.description = description self.thumbnail = thumbnail self.key_fee = key_fee self.key_fee_address = key_fee_address self.content_license = content_license self.author = author self.sources = sources d = self._check_file_path(self.file_path) d.addCallback(lambda _: create_lbry_file(self.session, self.lbry_file_manager, self.file_name, open(self.file_path))) d.addCallback(self.add_to_lbry_files) d.addCallback(lambda _: self._create_sd_blob()) d.addCallback(lambda _: self._claim_name()) d.addCallbacks(lambda _: _show_result(), self._show_publish_error) return d
def start(self, name, file_path, bid, metadata): log.info('Starting publish for %s', name) def _show_result(): log.info("Success! Published %s --> lbry://%s txid: %s", self.file_name, self.publish_name, self.txid) return defer.succeed(self.txid) self.publish_name = name self.file_path = file_path self.bid_amount = bid self.metadata = metadata if os.name == "nt": file_mode = 'rb' else: file_mode = 'r' d = self._check_file_path(self.file_path) d.addCallback(lambda _: create_lbry_file( self.session, self.lbry_file_manager, self.file_name, open(self.file_path, file_mode))) d.addCallback(self.add_to_lbry_files) d.addCallback(lambda _: self._create_sd_blob()) d.addCallback(lambda _: self._claim_name()) d.addCallback(lambda _: self.set_status()) d.addCallback(lambda _: self.start_reflector()) d.addCallbacks(lambda _: _show_result(), self._show_publish_error) return d
def start(self, name, file_path, bid, metadata, fee=None, sources={}): def _show_result(): message = "[%s] Published %s --> lbry://%s txid: %s" % (datetime.now(), self.file_name, self.publish_name, self.txid) log.info(message) return defer.succeed(self.txid) self.publish_name = name self.file_path = file_path self.bid_amount = bid self.fee = fee self.metadata = metadata d = self._check_file_path(self.file_path) d.addCallback(lambda _: create_lbry_file(self.session, self.lbry_file_manager, self.file_name, open(self.file_path))) d.addCallback(self.add_to_lbry_files) d.addCallback(lambda _: self._create_sd_blob()) d.addCallback(lambda _: self._claim_name()) d.addCallbacks(lambda _: _show_result(), self._show_publish_error) return d
def create_stream(): test_file = GenFile(5209343, b''.join([chr(i + 3) for i in xrange(0, 64, 6)])) d = create_lbry_file(self.session, self.lbry_file_manager, "test_file", test_file, key="0123456701234567", iv_generator=iv_generator()) return d
def create_stream(): test_file = GenFile(5209343, b''.join([chr(i) for i in xrange(0, 64, 6)])) d = create_lbry_file(session, lbry_file_manager, "test_file", test_file) return d
def create_stream(): test_file = GenFile(53209343, b''.join([chr(i + 5) for i in xrange(0, 64, 6)])) return create_lbry_file(self.session, self.lbry_file_manager, "test_file", test_file, suggested_file_name="test_file")