forked from LBRYCommunity/lbry-sdk
Merge branch 'master' into fix_descriptor_get
This commit is contained in:
commit
c66225ccf8
13 changed files with 82 additions and 73 deletions
|
@ -1,5 +1,5 @@
|
||||||
[bumpversion]
|
[bumpversion]
|
||||||
current_version = 0.9.1rc4
|
current_version = 0.9.1
|
||||||
commit = True
|
commit = True
|
||||||
tag = True
|
tag = True
|
||||||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)((?P<release>[a-z]+)(?P<candidate>\d+))?
|
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)((?P<release>[a-z]+)(?P<candidate>\d+))?
|
||||||
|
|
20
CHANGELOG.md
20
CHANGELOG.md
|
@ -9,19 +9,35 @@ at anytime.
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Added
|
### Added
|
||||||
* publish API command can take metadata fields as arguments
|
* Add `wallet_list` command
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
*
|
* Dont add expected payment to wallet when payment rate is 0
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
* Fixed descriptor_get
|
||||||
* Fixed jsonrpc_reflect()
|
* Fixed jsonrpc_reflect()
|
||||||
* Fixed api help return
|
* Fixed api help return
|
||||||
* Fixed API command descriptor_get
|
* Fixed API command descriptor_get
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
|
||||||
|
## [0.9.1] - 2017-03-17
|
||||||
|
### Fixed
|
||||||
|
* Fix wallet_public_key API command
|
||||||
|
|
||||||
|
## [0.9.1rc5] - 2017-03-16
|
||||||
|
### Added
|
||||||
|
* publish API command can take metadata fields as arguments
|
||||||
|
* Added `reflect_uploads` config to disable reflecting on upload
|
||||||
|
### Fixed
|
||||||
|
* Fixed jsonrpc_reflect()
|
||||||
|
* Fixed api help return
|
||||||
|
|
||||||
## [0.9.1rc2] - 2017-03-15
|
## [0.9.1rc2] - 2017-03-15
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -633,8 +633,9 @@ Returns:
|
||||||
Get public key from wallet address
|
Get public key from wallet address
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
'wallet': (str) wallet address in base58
|
'address': (str) wallet address in base58
|
||||||
Returns:
|
Returns:
|
||||||
(str) Public key in hex encoding
|
(list) list of public keys associated with address.
|
||||||
|
Could contain more than one public key if multisig.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
__version__ = "0.9.1rc4"
|
__version__ = "0.9.1"
|
||||||
version = tuple(__version__.split('.'))
|
version = tuple(__version__.split('.'))
|
||||||
|
|
||||||
logging.getLogger(__name__).addHandler(logging.NullHandler())
|
logging.getLogger(__name__).addHandler(logging.NullHandler())
|
||||||
|
|
|
@ -19,9 +19,10 @@ def log_response(fn):
|
||||||
elif future.exception():
|
elif future.exception():
|
||||||
exc, traceback = future.exception_info()
|
exc, traceback = future.exception_info()
|
||||||
log.warning('Failed to send an analytics event', exc_info=(type(exc), exc, traceback))
|
log.warning('Failed to send an analytics event', exc_info=(type(exc), exc, traceback))
|
||||||
else:
|
# GRIN TURNED THIS OFF. Segment only has one response: {"success": true}
|
||||||
response = future.result()
|
# else:
|
||||||
log.debug('Response (%s): %s', response.status_code, response.content)
|
# response = future.result()
|
||||||
|
# log.debug('Response (%s): %s', response.status_code, response.content)
|
||||||
|
|
||||||
@functools.wraps(fn)
|
@functools.wraps(fn)
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
|
|
|
@ -192,7 +192,7 @@ ADJUSTABLE_SETTINGS = {
|
||||||
'peer_port': (int, 3333),
|
'peer_port': (int, 3333),
|
||||||
'pointtrader_server': (str, 'http://127.0.0.1:2424'),
|
'pointtrader_server': (str, 'http://127.0.0.1:2424'),
|
||||||
'reflector_port': (int, 5566),
|
'reflector_port': (int, 5566),
|
||||||
'reflector_reupload': (bool, True),
|
'reflect_uploads': (bool, True),
|
||||||
'reflector_servers': (list, [('reflector.lbry.io', 5566)], server_port),
|
'reflector_servers': (list, [('reflector.lbry.io', 5566)], server_port),
|
||||||
'run_on_startup': (bool, False),
|
'run_on_startup': (bool, False),
|
||||||
'run_reflector_server': (bool, False),
|
'run_reflector_server': (bool, False),
|
||||||
|
|
|
@ -1101,8 +1101,13 @@ class LBRYumWallet(Wallet):
|
||||||
def _address_is_mine(self, address):
|
def _address_is_mine(self, address):
|
||||||
return self._run_cmd_as_defer_succeed('ismine', address)
|
return self._run_cmd_as_defer_succeed('ismine', address)
|
||||||
|
|
||||||
def get_pub_keys(self, wallet):
|
# returns a list of public keys associated with address
|
||||||
return self._run_cmd_as_defer_succeed('getpubkyes', wallet)
|
# (could be multiple public keys if a multisig address)
|
||||||
|
def get_pub_keys(self, address):
|
||||||
|
return self._run_cmd_as_defer_succeed('getpubkeys', address)
|
||||||
|
|
||||||
|
def list_addresses(self):
|
||||||
|
return self._run_cmd_as_defer_succeed('listaddresses')
|
||||||
|
|
||||||
def _save_wallet(self, val):
|
def _save_wallet(self, val):
|
||||||
self.wallet.storage.write()
|
self.wallet.storage.write()
|
||||||
|
|
|
@ -5,12 +5,10 @@ from twisted.protocols.basic import FileSender
|
||||||
from twisted.python.failure import Failure
|
from twisted.python.failure import Failure
|
||||||
from zope.interface import implements
|
from zope.interface import implements
|
||||||
|
|
||||||
|
|
||||||
from lbrynet.core.Offer import Offer
|
from lbrynet.core.Offer import Offer
|
||||||
from lbrynet import analytics
|
from lbrynet import analytics
|
||||||
from lbrynet.interfaces import IQueryHandlerFactory, IQueryHandler, IBlobSender
|
from lbrynet.interfaces import IQueryHandlerFactory, IQueryHandler, IBlobSender
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -212,11 +210,14 @@ class BlobRequestHandler(object):
|
||||||
|
|
||||||
def set_expected_payment():
|
def set_expected_payment():
|
||||||
log.debug("Setting expected payment")
|
log.debug("Setting expected payment")
|
||||||
if self.blob_bytes_uploaded != 0 and self.blob_data_payment_rate is not None:
|
if (
|
||||||
|
self.blob_bytes_uploaded != 0 and self.blob_data_payment_rate is not None
|
||||||
|
and self.blob_data_payment_rate > 0
|
||||||
|
):
|
||||||
# TODO: explain why 2**20
|
# TODO: explain why 2**20
|
||||||
self.wallet.add_expected_payment(self.peer,
|
self.wallet.add_expected_payment(self.peer,
|
||||||
self.currently_uploading.length * 1.0 *
|
self.currently_uploading.length * 1.0 *
|
||||||
self.blob_data_payment_rate / 2**20)
|
self.blob_data_payment_rate / 2 ** 20)
|
||||||
self.blob_bytes_uploaded = 0
|
self.blob_bytes_uploaded = 0
|
||||||
self.peer.update_stats('blobs_uploaded', 1)
|
self.peer.update_stats('blobs_uploaded', 1)
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -17,6 +17,7 @@ from lbrynet.lbryfile.StreamDescriptor import EncryptedFileStreamType
|
||||||
from lbrynet.cryptstream.client.CryptStreamDownloader import AlreadyStoppedError
|
from lbrynet.cryptstream.client.CryptStreamDownloader import AlreadyStoppedError
|
||||||
from lbrynet.cryptstream.client.CryptStreamDownloader import CurrentlyStoppingError
|
from lbrynet.cryptstream.client.CryptStreamDownloader import CurrentlyStoppingError
|
||||||
from lbrynet.core.sqlite_helpers import rerun_if_locked
|
from lbrynet.core.sqlite_helpers import rerun_if_locked
|
||||||
|
from lbrynet import conf
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
@ -57,7 +58,8 @@ class EncryptedFileManager(object):
|
||||||
yield self._open_db()
|
yield self._open_db()
|
||||||
yield self._add_to_sd_identifier()
|
yield self._add_to_sd_identifier()
|
||||||
yield self._start_lbry_files()
|
yield self._start_lbry_files()
|
||||||
safe_start_looping_call(self.lbry_file_reflector)
|
if conf.settings['reflect_uploads']:
|
||||||
|
safe_start_looping_call(self.lbry_file_reflector)
|
||||||
|
|
||||||
def get_lbry_file_status(self, lbry_file):
|
def get_lbry_file_status(self, lbry_file):
|
||||||
return self._get_lbry_file_status(lbry_file.rowid)
|
return self._get_lbry_file_status(lbry_file.rowid)
|
||||||
|
|
|
@ -774,9 +774,10 @@ class Daemon(AuthJSONRPCServer):
|
||||||
claim_out = yield publisher.update_stream(name, bid, metadata)
|
claim_out = yield publisher.update_stream(name, bid, metadata)
|
||||||
else:
|
else:
|
||||||
claim_out = yield publisher.publish_stream(name, file_path, bid, metadata)
|
claim_out = yield publisher.publish_stream(name, file_path, bid, metadata)
|
||||||
d = reupload.reflect_stream(publisher.lbry_file)
|
if conf.settings['reflect_uploads']:
|
||||||
d.addCallbacks(lambda _: log.info("Reflected new publication to lbry://%s", name),
|
d = reupload.reflect_stream(publisher.lbry_file)
|
||||||
log.exception)
|
d.addCallbacks(lambda _: log.info("Reflected new publication to lbry://%s", name),
|
||||||
|
log.exception)
|
||||||
log.info("Success! Published to lbry://%s txid: %s nout: %d", name, claim_out['txid'],
|
log.info("Success! Published to lbry://%s txid: %s nout: %d", name, claim_out['txid'],
|
||||||
claim_out['nout'])
|
claim_out['nout'])
|
||||||
yield self._add_to_pending_claims(claim_out, name)
|
yield self._add_to_pending_claims(claim_out, name)
|
||||||
|
@ -1217,29 +1218,11 @@ class Daemon(AuthJSONRPCServer):
|
||||||
"""
|
"""
|
||||||
Get daemon settings
|
Get daemon settings
|
||||||
|
|
||||||
Args:
|
|
||||||
None
|
|
||||||
Returns:
|
Returns:
|
||||||
(dict) Dictionary of daemon settings
|
(dict) Dictionary of daemon settings
|
||||||
{
|
See ADJUSTABLE_SETTINGS in lbrynet/conf.py for full list of settings
|
||||||
'run_on_startup': (bool) currently not supported
|
|
||||||
'data_rate': (float) data rate
|
|
||||||
'max_key_fee': (float) maximum key fee
|
|
||||||
'download_directory': (str) path of where files are downloaded
|
|
||||||
'max_upload': (float), currently not supported
|
|
||||||
'max_download': (float), currently not supported
|
|
||||||
'download_timeout': (int) download timeout in seconds
|
|
||||||
'max_search_results': (int) max search results
|
|
||||||
'wallet_type': (str) wallet type
|
|
||||||
'delete_blobs_on_remove': (bool) delete blobs on removal
|
|
||||||
'peer_port': (int) peer port
|
|
||||||
'dht_node_port': (int) dht node port
|
|
||||||
'use_upnp': (bool) use upnp if true
|
|
||||||
}
|
|
||||||
"""
|
"""
|
||||||
|
return self._render_response(conf.settings.get_adjustable_settings_dict())
|
||||||
log.info("Get daemon settings")
|
|
||||||
return self._render_response(conf.settings.get_current_settings_dict())
|
|
||||||
|
|
||||||
@AuthJSONRPCServer.auth_required
|
@AuthJSONRPCServer.auth_required
|
||||||
def jsonrpc_set_settings(self, **kwargs):
|
def jsonrpc_set_settings(self, **kwargs):
|
||||||
|
@ -1249,6 +1232,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
return self.jsonrpc_settings_set(**kwargs)
|
return self.jsonrpc_settings_set(**kwargs)
|
||||||
|
|
||||||
@AuthJSONRPCServer.auth_required
|
@AuthJSONRPCServer.auth_required
|
||||||
|
@defer.inlineCallbacks
|
||||||
def jsonrpc_settings_set(self, **kwargs):
|
def jsonrpc_settings_set(self, **kwargs):
|
||||||
"""
|
"""
|
||||||
Set daemon settings
|
Set daemon settings
|
||||||
|
@ -1261,22 +1245,14 @@ class Daemon(AuthJSONRPCServer):
|
||||||
'max_upload': (float), currently not supported
|
'max_upload': (float), currently not supported
|
||||||
'max_download': (float), currently not supported
|
'max_download': (float), currently not supported
|
||||||
'download_timeout': (int) download timeout in seconds
|
'download_timeout': (int) download timeout in seconds
|
||||||
|
'search_timeout': (float) search timeout in seconds
|
||||||
|
'cache_time': (int) cache timeout in seconds
|
||||||
Returns:
|
Returns:
|
||||||
(dict) settings dict
|
(dict) Updated dictionary of daemon settings
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def _log_settings_change():
|
yield self._update_settings(kwargs)
|
||||||
log.info(
|
defer.returnValue(conf.settings.get_adjustable_settings_dict())
|
||||||
"Set daemon settings to %s",
|
|
||||||
json.dumps(conf.settings.get_adjustable_settings_dict()))
|
|
||||||
|
|
||||||
d = self._update_settings(kwargs)
|
|
||||||
d.addErrback(lambda err: log.info(err.getTraceback()))
|
|
||||||
d.addCallback(lambda _: _log_settings_change())
|
|
||||||
d.addCallback(
|
|
||||||
lambda _: self._render_response(conf.settings.get_adjustable_settings_dict()))
|
|
||||||
|
|
||||||
return d
|
|
||||||
|
|
||||||
def jsonrpc_help(self, command=None):
|
def jsonrpc_help(self, command=None):
|
||||||
"""
|
"""
|
||||||
|
@ -2005,18 +1981,36 @@ class Daemon(AuthJSONRPCServer):
|
||||||
return self.jsonrpc_wallet_public_key(wallet)
|
return self.jsonrpc_wallet_public_key(wallet)
|
||||||
|
|
||||||
@AuthJSONRPCServer.auth_required
|
@AuthJSONRPCServer.auth_required
|
||||||
def jsonrpc_wallet_public_key(self, wallet):
|
def jsonrpc_wallet_public_key(self, address):
|
||||||
"""
|
"""
|
||||||
Get public key from wallet address
|
Get public key from wallet address
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
'wallet': (str) wallet address in base58
|
'address': (str) wallet address in base58
|
||||||
Returns:
|
Returns:
|
||||||
(str) Public key in hex encoding
|
(list) list of public keys associated with address.
|
||||||
|
Could contain more than one public key if multisig.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
d = self.session.wallet.get_pub_keys(wallet)
|
d = self.session.wallet.get_pub_keys(address)
|
||||||
d.addCallback(lambda r: self._render_response(r))
|
d.addCallback(lambda r: self._render_response(r))
|
||||||
|
return d
|
||||||
|
|
||||||
|
@AuthJSONRPCServer.auth_required
|
||||||
|
@defer.inlineCallbacks
|
||||||
|
def jsonrpc_wallet_list(self):
|
||||||
|
"""
|
||||||
|
List wallet addresses
|
||||||
|
|
||||||
|
Args:
|
||||||
|
None
|
||||||
|
Returns:
|
||||||
|
List of wallet addresses
|
||||||
|
"""
|
||||||
|
|
||||||
|
addresses = yield self.session.wallet.list_addresses()
|
||||||
|
response = yield self._render_response(addresses)
|
||||||
|
defer.returnValue(response)
|
||||||
|
|
||||||
@AuthJSONRPCServer.auth_required
|
@AuthJSONRPCServer.auth_required
|
||||||
def jsonrpc_get_new_address(self):
|
def jsonrpc_get_new_address(self):
|
||||||
|
|
|
@ -64,8 +64,7 @@ def main():
|
||||||
os.path.basename(sys.argv[0]))
|
os.path.basename(sys.argv[0]))
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
help_response = api.call('help', params)
|
print_help_response(api.call('help', params))
|
||||||
print help_response['help'] if 'help' in help_response else help_response
|
|
||||||
|
|
||||||
elif method not in api.commands():
|
elif method not in api.commands():
|
||||||
print_error("'" + method + "' is not a valid command.")
|
print_error("'" + method + "' is not a valid command.")
|
||||||
|
@ -84,13 +83,16 @@ def main():
|
||||||
# instead of this generic message.
|
# instead of this generic message.
|
||||||
# https://app.asana.com/0/158602294500137/200173944358192
|
# https://app.asana.com/0/158602294500137/200173944358192
|
||||||
print "Something went wrong, here's the usage for %s:" % method
|
print "Something went wrong, here's the usage for %s:" % method
|
||||||
print api.call('help', {'command': method})
|
print_help_response(api.call('help', {'command': method}))
|
||||||
if hasattr(err, 'msg'):
|
if hasattr(err, 'msg'):
|
||||||
print "Here's the traceback for the error you encountered:"
|
print "Here's the traceback for the error you encountered:"
|
||||||
print err.msg
|
print err.msg
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
|
def print_help_response(help_response):
|
||||||
|
print help_response['help'] if 'help' in help_response else help_response
|
||||||
|
|
||||||
def guess_type(x):
|
def guess_type(x):
|
||||||
if '.' in x:
|
if '.' in x:
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import argparse
|
import argparse
|
||||||
import binascii
|
import binascii
|
||||||
import logging
|
import logging
|
||||||
import os
|
|
||||||
import StringIO
|
import StringIO
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -11,7 +10,6 @@ from twisted.internet import reactor
|
||||||
|
|
||||||
from lbrynet import conf
|
from lbrynet import conf
|
||||||
from lbrynet.cryptstream import CryptBlob
|
from lbrynet.cryptstream import CryptBlob
|
||||||
from lbrynet.core import HashBlob
|
|
||||||
from lbrynet.core import log_support
|
from lbrynet.core import log_support
|
||||||
from lbrynet.core import cryptoutils
|
from lbrynet.core import cryptoutils
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ from lbrynet.core import log_support
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import collections
|
import collections
|
||||||
import itertools
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
|
@ -11,25 +10,15 @@ import shutil
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import appdirs
|
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
from twisted.internet import protocol
|
|
||||||
from twisted.internet import endpoints
|
|
||||||
|
|
||||||
from lbrynet import analytics
|
from lbrynet import analytics
|
||||||
from lbrynet import conf
|
from lbrynet import conf
|
||||||
from lbrynet.core import Error
|
|
||||||
from lbrynet.core import Wallet
|
from lbrynet.core import Wallet
|
||||||
from lbrynet.core import BlobAvailability
|
from lbrynet.core import BlobAvailability
|
||||||
from lbrynet.core import HashAnnouncer
|
|
||||||
from lbrynet.core import PeerManager
|
|
||||||
from lbrynet.core import Session
|
from lbrynet.core import Session
|
||||||
from lbrynet.core import utils
|
from lbrynet.core import utils
|
||||||
from lbrynet.core.client import DHTPeerFinder
|
|
||||||
from lbrynet.dht import node
|
|
||||||
from lbrynet.metadata import Metadata
|
|
||||||
from lbrynet.core import StreamDescriptor as sd
|
|
||||||
|
|
||||||
import common
|
import common
|
||||||
import name
|
import name
|
||||||
|
|
Loading…
Add table
Reference in a new issue