forked from LBRYCommunity/lbry-sdk
merge updates
This commit is contained in:
parent
141162e5ae
commit
c714a3f91c
4 changed files with 490 additions and 472 deletions
|
@ -316,8 +316,8 @@ class LBRYWallet(object):
|
|||
except (ValueError, TypeError):
|
||||
return Failure(InvalidStreamInfoError(name))
|
||||
known_fields = ['stream_hash', 'name', 'description', 'key_fee', 'key_fee_address', 'thumbnail',
|
||||
'content_license', 'sources', 'fee']
|
||||
known_sources = ['lbry_sd_hash']
|
||||
'content_license', 'sources', 'fee', 'author']
|
||||
known_sources = ['lbry_sd_hash', 'btih', 'url']
|
||||
known_fee_types = {'LBC': ['amount', 'address']}
|
||||
for field in known_fields:
|
||||
if field in value_dict:
|
||||
|
@ -353,7 +353,7 @@ class LBRYWallet(object):
|
|||
return Failure(UnknownNameError(name))
|
||||
|
||||
def claim_name(self, name, sd_hash, amount, description=None, key_fee=None,
|
||||
key_fee_address=None, thumbnail=None, content_license=None):
|
||||
key_fee_address=None, thumbnail=None, content_license=None, author=None, sources=None):
|
||||
value = {"sources": {'lbry_sd_hash': sd_hash}}
|
||||
if description is not None:
|
||||
value['description'] = description
|
||||
|
@ -363,6 +363,10 @@ class LBRYWallet(object):
|
|||
value['thumbnail'] = thumbnail
|
||||
if content_license is not None:
|
||||
value['content_license'] = content_license
|
||||
if author is not None:
|
||||
value['author'] = author
|
||||
if sources is not None:
|
||||
value['sources'] = sources
|
||||
|
||||
d = self._send_name_claim(name, json.dumps(value), amount)
|
||||
|
||||
|
@ -930,13 +934,15 @@ class LBRYumWallet(LBRYWallet):
|
|||
d = defer.Deferred()
|
||||
|
||||
def check_stopped():
|
||||
if self.network.is_connected():
|
||||
return False
|
||||
if self.network:
|
||||
if self.network.is_connected():
|
||||
return False
|
||||
stop_check.stop()
|
||||
self.network = None
|
||||
d.callback(True)
|
||||
|
||||
self.network.stop()
|
||||
if self.network:
|
||||
self.network.stop()
|
||||
|
||||
stop_check = task.LoopingCall(check_stopped)
|
||||
stop_check.start(.1)
|
||||
|
|
|
@ -1,16 +1,21 @@
|
|||
import logging
|
||||
from lbrynet.core.Session import LBRYSession
|
||||
import os.path
|
||||
import argparse
|
||||
import requests
|
||||
import locale
|
||||
import sys
|
||||
|
||||
if sys.platform == "darwin":
|
||||
from appdirs import user_data_dir
|
||||
from yapsy.PluginManager import PluginManager
|
||||
from twisted.internet import defer, threads, stdio, task, error
|
||||
from jsonrpc.proxy import JSONRPCProxy
|
||||
|
||||
from lbrynet.core.Session import LBRYSession
|
||||
from lbrynet.lbrynet_console.ConsoleControl import ConsoleControl
|
||||
from lbrynet.lbrynet_console.LBRYSettings import LBRYSettings
|
||||
from lbrynet.lbryfilemanager.LBRYFileManager import LBRYFileManager
|
||||
from lbrynet.conf import MIN_BLOB_DATA_PAYMENT_RATE # , MIN_BLOB_INFO_PAYMENT_RATE
|
||||
from lbrynet.conf import MIN_BLOB_DATA_PAYMENT_RATE, API_CONNECTION_STRING # , MIN_BLOB_INFO_PAYMENT_RATE
|
||||
from lbrynet.core.utils import generate_id
|
||||
from lbrynet.core.StreamDescriptor import StreamDescriptorIdentifier
|
||||
from lbrynet.core.PaymentRateManager import PaymentRateManager
|
||||
|
@ -461,7 +466,6 @@ class LBRYConsole():
|
|||
|
||||
|
||||
def launch_lbry_console():
|
||||
|
||||
from twisted.internet import reactor
|
||||
|
||||
parser = argparse.ArgumentParser(description="Launch a lbrynet console")
|
||||
|
@ -529,7 +533,7 @@ def launch_lbry_console():
|
|||
created_data_dir = False
|
||||
if not args.data_dir:
|
||||
if sys.platform == "darwin":
|
||||
data_dir = os.path.join(os.path.expanduser("~"), "Library/Application Support/lbrynet")
|
||||
data_dir = user_data_dir("LBRY")
|
||||
else:
|
||||
data_dir = os.path.join(os.path.expanduser("~"), ".lbrynet")
|
||||
else:
|
||||
|
@ -538,28 +542,35 @@ def launch_lbry_console():
|
|||
os.mkdir(data_dir)
|
||||
created_data_dir = True
|
||||
|
||||
daemon = JSONRPCProxy.from_url(API_CONNECTION_STRING)
|
||||
try:
|
||||
daemon.is_running()
|
||||
log.info("Attempt to start lbrynet-console while lbrynet-daemon is running")
|
||||
print "lbrynet-daemon is running, you must turn it off before using lbrynet-console"
|
||||
print "If you're running the app, quit before starting lbrynet-console"
|
||||
print "If you're running lbrynet-daemon in a terminal, run 'stop-lbrynet-daemon' to turn it off"
|
||||
|
||||
log_format = "(%(asctime)s)[%(filename)s:%(lineno)s] %(funcName)s(): %(message)s"
|
||||
formatter = logging.Formatter(log_format)
|
||||
except:
|
||||
log_format = "(%(asctime)s)[%(filename)s:%(lineno)s] %(funcName)s(): %(message)s"
|
||||
formatter = logging.Formatter(log_format)
|
||||
|
||||
logger = logging.getLogger()
|
||||
logger.setLevel(logging.DEBUG)
|
||||
file_handler = logging.FileHandler(os.path.join(data_dir, "console.log"))
|
||||
file_handler.setFormatter(formatter)
|
||||
file_handler.addFilter(logging.Filter("lbrynet"))
|
||||
logger.addHandler(file_handler)
|
||||
logger = logging.getLogger()
|
||||
logger.setLevel(logging.DEBUG)
|
||||
file_handler = logging.FileHandler(os.path.join(data_dir, "console.log"))
|
||||
file_handler.setFormatter(formatter)
|
||||
file_handler.addFilter(logging.Filter("lbrynet"))
|
||||
logger.addHandler(file_handler)
|
||||
|
||||
console = LBRYConsole(peer_port, dht_node_port, bootstrap_nodes, fake_wallet=args.fake_wallet,
|
||||
lbrycrd_conf=args.lbrycrd_wallet_conf, lbrycrd_dir=args.lbrycrd_wallet_dir,
|
||||
use_upnp=not args.disable_upnp, data_dir=data_dir,
|
||||
created_data_dir=created_data_dir, lbrycrdd_path=args.lbrycrdd_path)
|
||||
|
||||
d = task.deferLater(reactor, 0, console.start)
|
||||
console = LBRYConsole(peer_port, dht_node_port, bootstrap_nodes, fake_wallet=args.fake_wallet,
|
||||
lbrycrd_conf=args.lbrycrd_wallet_conf, lbrycrd_dir=args.lbrycrd_wallet_dir,
|
||||
use_upnp=not args.disable_upnp, data_dir=data_dir,
|
||||
created_data_dir=created_data_dir, lbrycrdd_path=args.lbrycrdd_path)
|
||||
|
||||
d.addErrback(lambda _: reactor.stop())
|
||||
|
||||
reactor.addSystemEventTrigger('before', 'shutdown', console.shut_down)
|
||||
reactor.run()
|
||||
d = task.deferLater(reactor, 0, console.start)
|
||||
d.addErrback(lambda _: reactor.stop())
|
||||
reactor.addSystemEventTrigger('before', 'shutdown', console.shut_down)
|
||||
reactor.run()
|
||||
|
||||
if __name__ == "__main__":
|
||||
launch_lbry_console()
|
||||
launch_lbry_console()
|
||||
|
|
File diff suppressed because it is too large
Load diff
34
setup.py
34
setup.py
|
@ -1,14 +1,15 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
import sys
|
||||
import os
|
||||
|
||||
base_dir = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
|
||||
from lbrynet import __version__
|
||||
|
||||
import ez_setup
|
||||
import sys
|
||||
import os
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
base_dir = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
ez_setup.use_setuptools()
|
||||
|
||||
console_scripts = ['lbrynet-console = lbrynet.lbrynet_console.LBRYConsole:launch_lbry_console',
|
||||
'lbrynet-stdin-uploader = lbrynet.lbrynet_console.LBRYStdinUploader:launch_stdin_uploader',
|
||||
|
@ -20,22 +21,25 @@ console_scripts = ['lbrynet-console = lbrynet.lbrynet_console.LBRYConsole:launch
|
|||
'lbrynet-gui = lbrynet.lbrynet_gui.gui:start_gui',
|
||||
'lbrynet-lookup-hosts-for-hash = lbrynet.dht_scripts:get_hosts_for_hash_in_dht',
|
||||
'lbrynet-announce_hash_to_dht = lbrynet.dht_scripts:announce_hash_to_dht',
|
||||
'lbrynet-daemon = lbrynet.lbrynet_daemon.LBRYDaemon:main',
|
||||
'stop-lbrynet-daemon = lbrynet.lbrynet_daemon.LBRYDaemon:stop']
|
||||
'lbrynet-daemon = lbrynet.lbrynet_daemon.LBRYDaemonControl:start',
|
||||
'stop-lbrynet-daemon = lbrynet.lbrynet_daemon.LBRYDaemonControl:stop']
|
||||
|
||||
requires = ['pycrypto', 'twisted', 'miniupnpc', 'yapsy', 'seccure',
|
||||
'python-bitcoinrpc==0.1', 'txJSON-RPC', 'requests>=2.4.2', 'unqlite==0.2.0',
|
||||
'leveldb', 'lbryum', 'jsonrpc', 'simplejson', 'appdirs']
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
console_scripts.append('lbrynet-daemon-status = lbrynet.lbrynet_daemon.LBRYOSXStatusBar:main')
|
||||
|
||||
requires.append('six==1.9.0')
|
||||
else:
|
||||
requires.append('six>=1.9.0')
|
||||
|
||||
gui_data_files = ['close2.gif', 'lbry-dark-242x80.gif', 'lbry-dark-icon.xbm', 'lbry-dark-icon.ico',
|
||||
'drop_down.gif', 'show_options.gif', 'hide_options.gif', 'lbry.conf']
|
||||
gui_data_paths = [os.path.join(base_dir, 'lbrynet', 'lbrynet_gui', f) for f in gui_data_files]
|
||||
|
||||
setup(name='lbrynet',
|
||||
version='.'.join([str(x) for x in __version__]),
|
||||
setup(name='lbrynet', version='.'.join([str(x) for x in __version__]),
|
||||
packages=find_packages(base_dir),
|
||||
install_requires=['six>=1.9.0', 'pycrypto', 'twisted', 'miniupnpc', 'yapsy', 'seccure', 'python-bitcoinrpc==0.1', 'txJSON-RPC', 'requests>=2.4.2', 'unqlite==0.2.0', 'leveldb', 'lbryum'],
|
||||
install_requires=requires,
|
||||
entry_points={'console_scripts': console_scripts},
|
||||
data_files=[
|
||||
('lbrynet/lbrynet_console/plugins',
|
||||
|
@ -47,4 +51,4 @@ setup(name='lbrynet',
|
|||
('lbrynet/lbrynet_gui', gui_data_paths)
|
||||
],
|
||||
dependency_links=['https://github.com/lbryio/lbryum/tarball/master/#egg=lbryum'],
|
||||
)
|
||||
)
|
Loading…
Reference in a new issue