delete download_directory argument for API command get
This commit is contained in:
parent
8d6a7155ef
commit
f71696ee50
4 changed files with 10 additions and 16 deletions
|
@ -24,7 +24,6 @@ at anytime.
|
||||||
* Initialize lbrynet settings when configuring an api client if they are not set yet
|
* Initialize lbrynet settings when configuring an api client if they are not set yet
|
||||||
* Updated lbryum imports
|
* Updated lbryum imports
|
||||||
* Improve error message when resolving a claim fails using the "get" command
|
* Improve error message when resolving a claim fails using the "get" command
|
||||||
*
|
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
* Fixed some log messages throwing exceptions
|
* Fixed some log messages throwing exceptions
|
||||||
|
@ -40,7 +39,7 @@ at anytime.
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
* Removed unused settings from conf.py and `settings_set`
|
* Removed unused settings from conf.py and `settings_set`
|
||||||
*
|
* Removed download_directory argument from API command get
|
||||||
|
|
||||||
## [0.13.1] - 2017-06-15
|
## [0.13.1] - 2017-06-15
|
||||||
|
|
||||||
|
|
|
@ -621,8 +621,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
return finished_d
|
return finished_d
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _download_name(self, name, claim_dict, claim_id, timeout=None, download_directory=None,
|
def _download_name(self, name, claim_dict, claim_id, timeout=None, file_name=None):
|
||||||
file_name=None):
|
|
||||||
"""
|
"""
|
||||||
Add a lbry file to the file manager, start the download, and return the new lbry file.
|
Add a lbry file to the file manager, start the download, and return the new lbry file.
|
||||||
If it already exists in the file manager, return the existing lbry file
|
If it already exists in the file manager, return the existing lbry file
|
||||||
|
@ -639,7 +638,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
self.streams[claim_id] = GetStream(self.sd_identifier, self.session,
|
self.streams[claim_id] = GetStream(self.sd_identifier, self.session,
|
||||||
self.exchange_rate_manager, self.max_key_fee,
|
self.exchange_rate_manager, self.max_key_fee,
|
||||||
conf.settings['data_rate'], timeout,
|
conf.settings['data_rate'], timeout,
|
||||||
download_directory, file_name)
|
file_name)
|
||||||
try:
|
try:
|
||||||
lbry_file, finished_deferred = yield self.streams[claim_id].start(claim_dict, name)
|
lbry_file, finished_deferred = yield self.streams[claim_id].start(claim_dict, name)
|
||||||
finished_deferred.addCallback(
|
finished_deferred.addCallback(
|
||||||
|
@ -1452,13 +1451,13 @@ class Daemon(AuthJSONRPCServer):
|
||||||
|
|
||||||
@AuthJSONRPCServer.auth_required
|
@AuthJSONRPCServer.auth_required
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def jsonrpc_get(self, uri, file_name=None, timeout=None, download_directory=None):
|
def jsonrpc_get(self, uri, file_name=None, timeout=None):
|
||||||
"""
|
"""
|
||||||
Download stream from a LBRY name.
|
Download stream from a LBRY name.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
get <uri> [<file_name> | --file_name=<file_name>] [<timeout> | --timeout=<timeout>]
|
get <uri> [<file_name> | --file_name=<file_name>] [<timeout> | --timeout=<timeout>]
|
||||||
[<download_directory> | --download_directory=<download_directory>]
|
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
<file_name> : specified name for the downloaded file
|
<file_name> : specified name for the downloaded file
|
||||||
|
@ -1491,7 +1490,6 @@ class Daemon(AuthJSONRPCServer):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
timeout = timeout if timeout is not None else self.download_timeout
|
timeout = timeout if timeout is not None else self.download_timeout
|
||||||
download_directory = download_directory or self.download_directory
|
|
||||||
|
|
||||||
resolved_result = yield self.session.wallet.resolve(uri)
|
resolved_result = yield self.session.wallet.resolve(uri)
|
||||||
if resolved_result and uri in resolved_result:
|
if resolved_result and uri in resolved_result:
|
||||||
|
@ -1525,7 +1523,6 @@ class Daemon(AuthJSONRPCServer):
|
||||||
result = yield self._get_lbry_file_dict(lbry_file, full_status=True)
|
result = yield self._get_lbry_file_dict(lbry_file, full_status=True)
|
||||||
else:
|
else:
|
||||||
result = yield self._download_name(name, claim_dict, claim_id, timeout=timeout,
|
result = yield self._download_name(name, claim_dict, claim_id, timeout=timeout,
|
||||||
download_directory=download_directory,
|
|
||||||
file_name=file_name)
|
file_name=file_name)
|
||||||
response = yield self._render_response(result)
|
response = yield self._render_response(result)
|
||||||
defer.returnValue(response)
|
defer.returnValue(response)
|
||||||
|
|
|
@ -40,13 +40,13 @@ def safe_stop(looping_call):
|
||||||
|
|
||||||
class GetStream(object):
|
class GetStream(object):
|
||||||
def __init__(self, sd_identifier, session, exchange_rate_manager,
|
def __init__(self, sd_identifier, session, exchange_rate_manager,
|
||||||
max_key_fee, data_rate=None, timeout=None, download_directory=None,
|
max_key_fee, data_rate=None, timeout=None,
|
||||||
file_name=None):
|
file_name=None):
|
||||||
|
|
||||||
self.timeout = timeout or conf.settings['download_timeout']
|
self.timeout = timeout or conf.settings['download_timeout']
|
||||||
self.data_rate = data_rate or conf.settings['data_rate']
|
self.data_rate = data_rate or conf.settings['data_rate']
|
||||||
self.max_key_fee = max_key_fee or conf.settings['max_key_fee'][1]
|
self.max_key_fee = max_key_fee or conf.settings['max_key_fee'][1]
|
||||||
self.download_directory = download_directory or conf.settings['download_directory']
|
self.download_directory = conf.settings['download_directory']
|
||||||
self.file_name = file_name
|
self.file_name = file_name
|
||||||
self.timeout_counter = 0
|
self.timeout_counter = 0
|
||||||
self.code = None
|
self.code = None
|
||||||
|
|
|
@ -18,11 +18,12 @@ from lbrynet.daemon.ExchangeRateManager import ExchangeRateManager
|
||||||
from tests.mocks import BlobAvailabilityTracker as DummyBlobAvailabilityTracker
|
from tests.mocks import BlobAvailabilityTracker as DummyBlobAvailabilityTracker
|
||||||
from tests.mocks import ExchangeRateManager as DummyExchangeRateManager
|
from tests.mocks import ExchangeRateManager as DummyExchangeRateManager
|
||||||
from tests.mocks import BTCLBCFeed, USDBTCFeed
|
from tests.mocks import BTCLBCFeed, USDBTCFeed
|
||||||
|
from tests.mocks import mock_conf_settings
|
||||||
|
|
||||||
class GetStreamTests(unittest.TestCase):
|
class GetStreamTests(unittest.TestCase):
|
||||||
|
|
||||||
def init_getstream_with_mocs(self):
|
def init_getstream_with_mocs(self):
|
||||||
|
mock_conf_settings(self)
|
||||||
sd_identifier = mock.Mock(spec=StreamDescriptorIdentifier)
|
sd_identifier = mock.Mock(spec=StreamDescriptorIdentifier)
|
||||||
session = mock.Mock(spec=Session.Session)
|
session = mock.Mock(spec=Session.Session)
|
||||||
session.wallet = mock.Mock(spec=Wallet.LBRYumWallet)
|
session.wallet = mock.Mock(spec=Wallet.LBRYumWallet)
|
||||||
|
@ -34,12 +35,9 @@ class GetStreamTests(unittest.TestCase):
|
||||||
exchange_rate_manager = mock.Mock(spec=ExchangeRateManager)
|
exchange_rate_manager = mock.Mock(spec=ExchangeRateManager)
|
||||||
max_key_fee = {'currency':"LBC", 'amount':10, 'address':''}
|
max_key_fee = {'currency':"LBC", 'amount':10, 'address':''}
|
||||||
data_rate = {'currency':"LBC", 'amount':0, 'address':''}
|
data_rate = {'currency':"LBC", 'amount':0, 'address':''}
|
||||||
download_directory = '.'
|
|
||||||
|
|
||||||
|
|
||||||
getstream = Downloader.GetStream(sd_identifier, session,
|
getstream = Downloader.GetStream(sd_identifier, session,
|
||||||
exchange_rate_manager, max_key_fee, timeout=10, data_rate=data_rate,
|
exchange_rate_manager, max_key_fee, timeout=10, data_rate=data_rate)
|
||||||
download_directory=download_directory)
|
|
||||||
|
|
||||||
return getstream
|
return getstream
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue