From 210c1215d636c9f40b703a5576e87e68b6e27b94 Mon Sep 17 00:00:00 2001 From: Jack Date: Wed, 11 May 2016 01:48:23 -0400 Subject: [PATCH] add metadata to lbry_file --- lbrynet/lbrynet_daemon/LBRYDaemon.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lbrynet/lbrynet_daemon/LBRYDaemon.py b/lbrynet/lbrynet_daemon/LBRYDaemon.py index 75179f88e..5d21bf76a 100644 --- a/lbrynet/lbrynet_daemon/LBRYDaemon.py +++ b/lbrynet/lbrynet_daemon/LBRYDaemon.py @@ -1119,9 +1119,22 @@ class LBRYDaemon(jsonrpc.JSONRPC): return d + def _add_metadata(message): + def _add_to_dict(metadata): + message['metadata'] = metadata + return defer.succeed(message) + + if f.txid: + d = self._resolve_name(f.uri) + d.addCallback(_add_to_dict) + else: + d = defer.succeed(None) + return d + if f: d = f.get_total_bytes() d.addCallback(_generate_reply) + d.addCallback(_add_metadata) return d else: return False