rename update_stream and prevent it from using old metadata

This commit is contained in:
Kay Kurokawa 2017-03-30 15:12:07 -04:00
parent d3173b157e
commit 23596b434a
2 changed files with 14 additions and 3 deletions

View file

@ -716,9 +716,9 @@ class Daemon(AuthJSONRPCServer):
if bid <= 0.0:
raise Exception("Invalid bid")
if not file_path:
claim_out = yield publisher.update_stream(name, bid, metadata)
claim_out = yield publisher.publish_stream(name, bid, metadata)
else:
claim_out = yield publisher.publish_stream(name, file_path, bid, metadata)
claim_out = yield publisher.create_and_publish_stream(name, bid, metadata, file_path)
if conf.settings['reflect_uploads']:
d = reupload.reflect_stream(publisher.lbry_file)
d.addCallbacks(lambda _: log.info("Reflected new publication to lbry://%s", name),

View file

@ -19,8 +19,11 @@ class Publisher(object):
self.wallet = wallet
self.lbry_file = None
"""
Create lbry file and make claim
"""
@defer.inlineCallbacks
def publish_stream(self, name, file_path, bid, metadata):
def create_and_publish_stream(self, name, bid, metadata, file_path):
log.info('Starting publish for %s', name)
file_name = os.path.basename(file_path)
with file_utils.get_read_handle(file_path) as read_handle:
@ -41,6 +44,14 @@ class Publisher(object):
yield self.lbry_file.save_status()
defer.returnValue(claim_out)
"""
Make a claim without creating a lbry file
"""
@defer.inlineCallbacks
def publish_stream(self, name, bid, metadata):
claim_out = yield self.make_claim(name, bid, metadata)
defer.returnValue(claim_out)
@defer.inlineCallbacks
def update_stream(self, name, bid, metadata):
my_claim = yield self.wallet.get_my_claim(name)