Merge pull request #494 from lbryio/fix-download-button

fix missing download button
This commit is contained in:
Jack Robison 2017-02-18 14:23:29 -05:00 committed by GitHub
commit e86bada307
2 changed files with 25 additions and 11 deletions

View file

@ -8,6 +8,8 @@ can and probably will change functionality and break backwards compatability
at anytime. at anytime.
## [Unreleased] ## [Unreleased]
### Fixed
* Fix result expected by ui from file_get for missing files
## [0.8.4] - 2017-02-17 ## [0.8.4] - 2017-02-17

View file

@ -1058,7 +1058,7 @@ class Daemon(AuthJSONRPCServer):
defer.returnValue(lbry_file) defer.returnValue(lbry_file)
except Exception as err: except Exception as err:
# TODO: do something with the error, don't return None when a file isn't found # TODO: do something with the error, don't return None when a file isn't found
defer.returnValue(None) defer.returnValue(False)
def _get_lbry_files(self): def _get_lbry_files(self):
def safe_get(sd_hash): def safe_get(sd_hash):
@ -1466,22 +1466,34 @@ class Daemon(AuthJSONRPCServer):
def jsonrpc_file_get(self, **kwargs): def jsonrpc_file_get(self, **kwargs):
""" """
Get a file Get a file, if no matching file exists returns False
Args: Args:
'name': get file by lbry uri, 'name': get file by lbry uri,
'sd_hash': get file by the hash in the name claim, 'sd_hash': get file by the hash in the name claim,
'file_name': get file by its name in the downloads folder, 'file_name': get file by its name in the downloads folder,
Returns: Returns:
'completed': bool 'completed': bool,
'file_name': string 'file_name': str,
'key': hex string 'download_directory': str,
'points_paid': float 'points_paid': float,
'stopped': bool 'stopped': bool,
'stream_hash': base 58 string 'stream_hash': str (hex),
'stream_name': string 'stream_name': str,
'suggested_file_name': string 'suggested_file_name': str,
'sd_hash': string 'sd_hash': str (hex),
'lbry_uri': str,
'txid': str (b58),
'claim_id': str (b58),
'download_path': str,
'mime_type': str,
'key': str (hex),
'total_bytes': int,
'written_bytes': int,
'code': str,
'message': str
'metadata': Metadata dict if claim is valid, otherwise status str
}
""" """
d = self._get_deferred_for_lbry_file(kwargs) d = self._get_deferred_for_lbry_file(kwargs)
d.addCallback(lambda r: self._render_response(r)) d.addCallback(lambda r: self._render_response(r))