merge updates

This commit is contained in:
Jack 2016-03-23 22:27:48 -04:00
parent 141162e5ae
commit c714a3f91c
4 changed files with 490 additions and 472 deletions

View file

@ -316,8 +316,8 @@ class LBRYWallet(object):
except (ValueError, TypeError): except (ValueError, TypeError):
return Failure(InvalidStreamInfoError(name)) return Failure(InvalidStreamInfoError(name))
known_fields = ['stream_hash', 'name', 'description', 'key_fee', 'key_fee_address', 'thumbnail', known_fields = ['stream_hash', 'name', 'description', 'key_fee', 'key_fee_address', 'thumbnail',
'content_license', 'sources', 'fee'] 'content_license', 'sources', 'fee', 'author']
known_sources = ['lbry_sd_hash'] known_sources = ['lbry_sd_hash', 'btih', 'url']
known_fee_types = {'LBC': ['amount', 'address']} known_fee_types = {'LBC': ['amount', 'address']}
for field in known_fields: for field in known_fields:
if field in value_dict: if field in value_dict:
@ -353,7 +353,7 @@ class LBRYWallet(object):
return Failure(UnknownNameError(name)) return Failure(UnknownNameError(name))
def claim_name(self, name, sd_hash, amount, description=None, key_fee=None, 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}} value = {"sources": {'lbry_sd_hash': sd_hash}}
if description is not None: if description is not None:
value['description'] = description value['description'] = description
@ -363,6 +363,10 @@ class LBRYWallet(object):
value['thumbnail'] = thumbnail value['thumbnail'] = thumbnail
if content_license is not None: if content_license is not None:
value['content_license'] = content_license 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) d = self._send_name_claim(name, json.dumps(value), amount)
@ -930,12 +934,14 @@ class LBRYumWallet(LBRYWallet):
d = defer.Deferred() d = defer.Deferred()
def check_stopped(): def check_stopped():
if self.network:
if self.network.is_connected(): if self.network.is_connected():
return False return False
stop_check.stop() stop_check.stop()
self.network = None self.network = None
d.callback(True) d.callback(True)
if self.network:
self.network.stop() self.network.stop()
stop_check = task.LoopingCall(check_stopped) stop_check = task.LoopingCall(check_stopped)

View file

@ -1,16 +1,21 @@
import logging import logging
from lbrynet.core.Session import LBRYSession
import os.path import os.path
import argparse import argparse
import requests import requests
import locale import locale
import sys import sys
if sys.platform == "darwin":
from appdirs import user_data_dir
from yapsy.PluginManager import PluginManager from yapsy.PluginManager import PluginManager
from twisted.internet import defer, threads, stdio, task, error 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.ConsoleControl import ConsoleControl
from lbrynet.lbrynet_console.LBRYSettings import LBRYSettings from lbrynet.lbrynet_console.LBRYSettings import LBRYSettings
from lbrynet.lbryfilemanager.LBRYFileManager import LBRYFileManager 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.utils import generate_id
from lbrynet.core.StreamDescriptor import StreamDescriptorIdentifier from lbrynet.core.StreamDescriptor import StreamDescriptorIdentifier
from lbrynet.core.PaymentRateManager import PaymentRateManager from lbrynet.core.PaymentRateManager import PaymentRateManager
@ -461,7 +466,6 @@ class LBRYConsole():
def launch_lbry_console(): def launch_lbry_console():
from twisted.internet import reactor from twisted.internet import reactor
parser = argparse.ArgumentParser(description="Launch a lbrynet console") parser = argparse.ArgumentParser(description="Launch a lbrynet console")
@ -529,7 +533,7 @@ def launch_lbry_console():
created_data_dir = False created_data_dir = False
if not args.data_dir: if not args.data_dir:
if sys.platform == "darwin": if sys.platform == "darwin":
data_dir = os.path.join(os.path.expanduser("~"), "Library/Application Support/lbrynet") data_dir = user_data_dir("LBRY")
else: else:
data_dir = os.path.join(os.path.expanduser("~"), ".lbrynet") data_dir = os.path.join(os.path.expanduser("~"), ".lbrynet")
else: else:
@ -538,7 +542,15 @@ def launch_lbry_console():
os.mkdir(data_dir) os.mkdir(data_dir)
created_data_dir = True 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"
except:
log_format = "(%(asctime)s)[%(filename)s:%(lineno)s] %(funcName)s(): %(message)s" log_format = "(%(asctime)s)[%(filename)s:%(lineno)s] %(funcName)s(): %(message)s"
formatter = logging.Formatter(log_format) formatter = logging.Formatter(log_format)
@ -549,15 +561,14 @@ def launch_lbry_console():
file_handler.addFilter(logging.Filter("lbrynet")) file_handler.addFilter(logging.Filter("lbrynet"))
logger.addHandler(file_handler) logger.addHandler(file_handler)
console = LBRYConsole(peer_port, dht_node_port, bootstrap_nodes, fake_wallet=args.fake_wallet, 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, lbrycrd_conf=args.lbrycrd_wallet_conf, lbrycrd_dir=args.lbrycrd_wallet_dir,
use_upnp=not args.disable_upnp, data_dir=data_dir, use_upnp=not args.disable_upnp, data_dir=data_dir,
created_data_dir=created_data_dir, lbrycrdd_path=args.lbrycrdd_path) created_data_dir=created_data_dir, lbrycrdd_path=args.lbrycrdd_path)
d = task.deferLater(reactor, 0, console.start) d = task.deferLater(reactor, 0, console.start)
d.addErrback(lambda _: reactor.stop()) d.addErrback(lambda _: reactor.stop())
reactor.addSystemEventTrigger('before', 'shutdown', console.shut_down) reactor.addSystemEventTrigger('before', 'shutdown', console.shut_down)
reactor.run() reactor.run()

File diff suppressed because it is too large Load diff

View file

@ -1,14 +1,15 @@
#!/usr/bin/env python #!/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__ 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', console_scripts = ['lbrynet-console = lbrynet.lbrynet_console.LBRYConsole:launch_lbry_console',
'lbrynet-stdin-uploader = lbrynet.lbrynet_console.LBRYStdinUploader:launch_stdin_uploader', '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-gui = lbrynet.lbrynet_gui.gui:start_gui',
'lbrynet-lookup-hosts-for-hash = lbrynet.dht_scripts:get_hosts_for_hash_in_dht', '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-announce_hash_to_dht = lbrynet.dht_scripts:announce_hash_to_dht',
'lbrynet-daemon = lbrynet.lbrynet_daemon.LBRYDaemon:main', 'lbrynet-daemon = lbrynet.lbrynet_daemon.LBRYDaemonControl:start',
'stop-lbrynet-daemon = lbrynet.lbrynet_daemon.LBRYDaemon:stop'] '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': 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', 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'] '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] gui_data_paths = [os.path.join(base_dir, 'lbrynet', 'lbrynet_gui', f) for f in gui_data_files]
setup(name='lbrynet', setup(name='lbrynet', version='.'.join([str(x) for x in __version__]),
version='.'.join([str(x) for x in __version__]),
packages=find_packages(base_dir), 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}, entry_points={'console_scripts': console_scripts},
data_files=[ data_files=[
('lbrynet/lbrynet_console/plugins', ('lbrynet/lbrynet_console/plugins',