commit
37b5f22c1a
11 changed files with 237 additions and 309 deletions
|
@ -27,3 +27,17 @@ POINTTRADER_SERVER = 'http://ec2-54-187-192-68.us-west-2.compute.amazonaws.com:2
|
|||
#POINTTRADER_SERVER = 'http://127.0.0.1:2424'
|
||||
|
||||
CRYPTSD_FILE_EXTENSION = ".cryptsd"
|
||||
|
||||
API_INTERFACE = "localhost"
|
||||
API_ADDRESS = "lbryapi"
|
||||
API_PORT = 5279
|
||||
ICON_PATH = "app.icns"
|
||||
APP_NAME = "LBRY"
|
||||
DEFAULT_WALLET = "lbryum"
|
||||
|
||||
API_CONNECTION_STRING = "http://%s:%i/%s" % (API_INTERFACE, API_PORT, API_ADDRESS)
|
||||
UI_ADDRESS = "http://" + API_INTERFACE + ":" + str(API_PORT)
|
||||
|
||||
PROTOCOL_PREFIX = "lbry"
|
||||
|
||||
DEFAULT_TIMEOUT = 30
|
|
@ -3,9 +3,9 @@ Keep track of which LBRY Files are downloading and store their LBRY File specifi
|
|||
"""
|
||||
|
||||
import logging
|
||||
import datetime
|
||||
import os
|
||||
import sys
|
||||
from datetime import datetime
|
||||
|
||||
from twisted.internet.task import LoopingCall
|
||||
from twisted.enterprise import adbapi
|
||||
|
@ -28,13 +28,14 @@ class LBRYFileManager(object):
|
|||
Keeps track of currently opened LBRY Files, their options, and their LBRY File specific metadata.
|
||||
"""
|
||||
|
||||
def __init__(self, session, stream_info_manager, sd_identifier):
|
||||
def __init__(self, session, stream_info_manager, sd_identifier, delete_data=False):
|
||||
self.session = session
|
||||
self.stream_info_manager = stream_info_manager
|
||||
self.sd_identifier = sd_identifier
|
||||
self.lbry_files = []
|
||||
self.sql_db = None
|
||||
self.check_exists_loop = LoopingCall(self.check_files_exist)
|
||||
# self.delete_data = delete_data
|
||||
# self.check_exists_loop = LoopingCall(self.check_files_exist)
|
||||
if sys.platform.startswith("darwin"):
|
||||
self.download_directory = os.path.join(os.path.expanduser("~"), 'Downloads')
|
||||
else:
|
||||
|
@ -42,24 +43,34 @@ class LBRYFileManager(object):
|
|||
log.debug("Download directory for LBRYFileManager: %s", str(self.download_directory))
|
||||
|
||||
def setup(self):
|
||||
self.check_exists_loop.start(1)
|
||||
# self.check_exists_loop.start(10)
|
||||
|
||||
d = self._open_db()
|
||||
d.addCallback(lambda _: self._add_to_sd_identifier())
|
||||
d.addCallback(lambda _: self._start_lbry_files())
|
||||
return d
|
||||
|
||||
def check_files_exist(self):
|
||||
def _disp(deleted_files):
|
||||
if deleted_files[0][0]:
|
||||
for file in bad_files:
|
||||
print "[" + str(datetime.datetime.now()) + "] Detected " + file.file_name + " was deleted, removing from file manager"
|
||||
|
||||
bad_files = [lbry_file for lbry_file in self.lbry_files
|
||||
if lbry_file.completed == True and
|
||||
os.path.isfile(os.path.join(self.download_directory, lbry_file.file_name)) == False]
|
||||
d = defer.DeferredList([self.delete_lbry_file(lbry_file) for lbry_file in bad_files], consumeErrors=True)
|
||||
d.addCallback(lambda files: _disp(files) if len(files) else defer.succeed(None))
|
||||
# def check_files_exist(self):
|
||||
# def _disp(deleted_files):
|
||||
# if deleted_files[0][0]:
|
||||
# for file in bad_files:
|
||||
# log.info("[" + str(datetime.now()) + "] Detected " + file.file_name + " was deleted, removing from file manager")
|
||||
#
|
||||
# def _delete_stream_data(lbry_file):
|
||||
# s_h = lbry_file.stream_hash
|
||||
# d = self.get_count_for_stream_hash(s_h)
|
||||
# # TODO: could possibly be a timing issue here
|
||||
# d.addCallback(lambda c: self.stream_info_manager.delete_stream(s_h) if c == 0 else True)
|
||||
# return d
|
||||
#
|
||||
# bad_files = [lbry_file for lbry_file in self.lbry_files
|
||||
# if lbry_file.completed == True and
|
||||
# os.path.isfile(os.path.join(self.download_directory, lbry_file.file_name)) == False]
|
||||
# d = defer.DeferredList([self.delete_lbry_file(lbry_file) for lbry_file in bad_files], consumeErrors=True)
|
||||
# d.addCallback(lambda files: _disp(files) if len(files) else defer.succeed(None))
|
||||
#
|
||||
# if self.delete_data:
|
||||
# d2 = defer.DeferredList([_delete_stream_data(lbry_file) for lbry_file in bad_files], consumeErrors=True)
|
||||
|
||||
def get_lbry_file_status(self, lbry_file):
|
||||
return self._get_lbry_file_status(lbry_file.rowid)
|
||||
|
@ -169,7 +180,7 @@ class LBRYFileManager(object):
|
|||
return defer.fail(Failure(ValueError("Could not find that LBRY file")))
|
||||
|
||||
def stop(self):
|
||||
self.check_exists_loop.stop()
|
||||
# self.check_exists_loop.stop()
|
||||
|
||||
ds = []
|
||||
|
||||
|
|
|
@ -1,54 +1,79 @@
|
|||
import os
|
||||
import json
|
||||
import webbrowser
|
||||
import xmlrpclib, sys
|
||||
import sys
|
||||
from time import sleep
|
||||
import subprocess
|
||||
|
||||
def render_video(path):
|
||||
r = r'<center><video src="' + path + r'" controls autoplay width="960" height="720"></center>'
|
||||
return r
|
||||
from jsonrpc.proxy import JSONRPCProxy
|
||||
|
||||
API_CONNECTION_STRING = "http://localhost:5279/lbryapi"
|
||||
UI_ADDRESS = "http://localhost:5279"
|
||||
|
||||
|
||||
class LBRYURIHandler(object):
|
||||
def __init__(self):
|
||||
self.started_daemon = False
|
||||
self.start_timeout = 0
|
||||
self.daemon = JSONRPCProxy.from_url(API_CONNECTION_STRING)
|
||||
|
||||
def check_status(self):
|
||||
status = None
|
||||
try:
|
||||
status = json.loads(self.daemon.is_running())['result']
|
||||
if self.start_timeout < 30 and not status:
|
||||
sleep(1)
|
||||
self.start_timeout += 1
|
||||
self.check_status()
|
||||
elif status:
|
||||
return True
|
||||
else:
|
||||
exit(1)
|
||||
except:
|
||||
if self.start_timeout < 30:
|
||||
sleep(1)
|
||||
self.start_timeout += 1
|
||||
self.check_status()
|
||||
else:
|
||||
exit(1)
|
||||
|
||||
def handle(self, lbry_name):
|
||||
lbry_process = [d for d in subprocess.Popen(['ps','aux'], stdout=subprocess.PIPE).stdout.readlines()
|
||||
if 'LBRY.app' in d]
|
||||
try:
|
||||
status = json.loads(self.daemon.is_running())['result']
|
||||
except:
|
||||
pass
|
||||
|
||||
if lbry_process:
|
||||
self.check_status()
|
||||
started = False
|
||||
else:
|
||||
os.system("open /Applications/LBRY.app")
|
||||
self.check_status()
|
||||
started = True
|
||||
|
||||
if lbry_name == "lbry" or lbry_name == "" and not started:
|
||||
webbrowser.get('safari').open(UI_ADDRESS)
|
||||
else:
|
||||
r = json.loads(self.daemon.get({'name': lbry_name}))
|
||||
if r['code'] == 200:
|
||||
path = r['result']['path'].encode('utf-8')
|
||||
extension = os.path.splitext(path)[1]
|
||||
if extension in ['mp4', 'flv', 'mov', 'ogv']:
|
||||
webbrowser.get('safari').open(UI_ADDRESS + "/view?name=" + lbry_name)
|
||||
else:
|
||||
webbrowser.get('safari').open('file://' + path)
|
||||
else:
|
||||
webbrowser.get('safari').open('http://lbry.io/get')
|
||||
|
||||
|
||||
def main(args):
|
||||
if len(args) == 0:
|
||||
args.append('lbry://wonderfullife')
|
||||
if len(args) != 1:
|
||||
args = ['lbry://lbry']
|
||||
|
||||
daemon = xmlrpclib.ServerProxy('http://localhost:7080/')
|
||||
|
||||
try:
|
||||
daemon.is_running()
|
||||
|
||||
if len(args) > 1:
|
||||
exit(1)
|
||||
|
||||
if args[0][7:] == 'lbry':
|
||||
daemon.render_gui()
|
||||
|
||||
elif args[0][7:] == 'settings':
|
||||
r = daemon.get_settings()
|
||||
html = "<body>" + json.dumps(r) + "</body>"
|
||||
daemon.render_html(html)
|
||||
|
||||
else:
|
||||
r = daemon.get(args[0][7:])
|
||||
if r[0] == 200:
|
||||
path = r[1]['path']
|
||||
if path[0] != '/':
|
||||
path = '/' + path
|
||||
|
||||
filename = os.path.basename(path)
|
||||
extension = os.path.splitext(filename)[1]
|
||||
|
||||
if extension in ['mp4', 'flv', 'mov']:
|
||||
html = render_video(path)
|
||||
daemon.render_html(html)
|
||||
else:
|
||||
webbrowser.get('safari').open('file://' + str(path))
|
||||
|
||||
else:
|
||||
webbrowser.get('safari').open('http://lbry.io/get')
|
||||
|
||||
except:
|
||||
webbrowser.get('safari').open('http://lbry.io/get')
|
||||
name = args[0][7:]
|
||||
LBRYURIHandler().handle(lbry_name=name)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
70
lbrynet/lbrynet_daemon/LBRYDaemonControl.py
Normal file
70
lbrynet/lbrynet_daemon/LBRYDaemonControl.py
Normal file
|
@ -0,0 +1,70 @@
|
|||
import argparse
|
||||
import logging
|
||||
import tempfile
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from StringIO import StringIO
|
||||
from zipfile import ZipFile
|
||||
from urllib import urlopen
|
||||
|
||||
from twisted.web import server, static
|
||||
from twisted.internet import reactor, defer
|
||||
from jsonrpc.proxy import JSONRPCProxy
|
||||
|
||||
from lbrynet.lbrynet_daemon.LBRYDaemon import LBRYDaemon, LBRYindex, LBRYDaemonWeb, LBRYFileRender
|
||||
from lbrynet.conf import API_CONNECTION_STRING, API_INTERFACE, API_ADDRESS, API_PORT, DEFAULT_WALLET
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
|
||||
def stop():
|
||||
def _disp_shutdown():
|
||||
log.info("Shutting down lbrynet-daemon from command line")
|
||||
|
||||
def _disp_not_running():
|
||||
log.info("Attempt to shut down lbrynet-daemon from command line when daemon isn't running")
|
||||
|
||||
d = defer.Deferred(None)
|
||||
d.addCallback(lambda _: JSONRPCProxy.from_url(API_CONNECTION_STRING).stop())
|
||||
d.addCallbacks(lambda _: _disp_shutdown(), lambda _: _disp_not_running())
|
||||
d.callback(None)
|
||||
|
||||
|
||||
def start():
|
||||
parser = argparse.ArgumentParser(description="Launch lbrynet-daemon")
|
||||
parser.add_argument("--wallet",
|
||||
help="lbrycrd or lbryum, default lbryum",
|
||||
type=str,
|
||||
default=DEFAULT_WALLET)
|
||||
parser.add_argument("--update",
|
||||
help="True or false, default true",
|
||||
type=str,
|
||||
default="True")
|
||||
|
||||
log.info("Starting lbrynet-daemon from command line")
|
||||
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
url = urlopen("https://rawgit.com/lbryio/lbry-web-ui/master/dist.zip")
|
||||
z = ZipFile(StringIO(url.read()))
|
||||
z.extractall(tmpdir)
|
||||
|
||||
|
||||
args = parser.parse_args()
|
||||
daemon = LBRYDaemon()
|
||||
daemon.setup(args.wallet, args.update)
|
||||
|
||||
root = LBRYindex(tmpdir)
|
||||
root.putChild("css", static.File(os.path.join(tmpdir, "css")))
|
||||
root.putChild("font", static.File(os.path.join(tmpdir, "font")))
|
||||
root.putChild("img", static.File(os.path.join(tmpdir, "img")))
|
||||
root.putChild("js", static.File(os.path.join(tmpdir, "js")))
|
||||
root.putChild(API_ADDRESS, daemon)
|
||||
root.putChild("webapi", LBRYDaemonWeb())
|
||||
root.putChild("view", LBRYFileRender())
|
||||
reactor.listenTCP(API_PORT, server.Site(root), interface=API_INTERFACE)
|
||||
|
||||
reactor.run()
|
||||
|
||||
shutil.rmtree(tmpdir)
|
|
@ -1,19 +1,23 @@
|
|||
import json
|
||||
import logging
|
||||
import os
|
||||
|
||||
from datetime import datetime
|
||||
from twisted.internet import defer
|
||||
from twisted.internet.task import LoopingCall
|
||||
|
||||
from lbrynet.core.Error import InvalidStreamInfoError, InsufficientFundsError
|
||||
from lbrynet.core.PaymentRateManager import PaymentRateManager
|
||||
from lbrynet.core.StreamDescriptor import download_sd_blob
|
||||
from lbrynet.lbryfilemanager.LBRYFileDownloader import ManagedLBRYFileDownloaderFactory
|
||||
from lbrynet.conf import DEFAULT_TIMEOUT
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class GetStream(object):
|
||||
def __init__(self, sd_identifier, session, wallet, lbry_file_manager, max_key_fee, pay_key=True, data_rate=0.5):
|
||||
def __init__(self, sd_identifier, session, wallet, lbry_file_manager, max_key_fee, pay_key=True, data_rate=0.5,
|
||||
timeout=DEFAULT_TIMEOUT):
|
||||
self.wallet = wallet
|
||||
self.resolved_name = None
|
||||
self.description = None
|
||||
|
@ -30,8 +34,25 @@ class GetStream(object):
|
|||
self.max_key_fee = max_key_fee
|
||||
self.stream_info = None
|
||||
self.stream_info_manager = None
|
||||
self.d = defer.Deferred(None)
|
||||
self.timeout = timeout
|
||||
self.timeout_counter = 0
|
||||
self.download_path = None
|
||||
self.checker = LoopingCall(self.check_status)
|
||||
|
||||
|
||||
def check_status(self):
|
||||
self.timeout_counter += 1
|
||||
|
||||
if self.download_path and os.path.isfile(self.download_path):
|
||||
self.checker.stop()
|
||||
return defer.succeed(True)
|
||||
|
||||
elif self.timeout_counter >= self.timeout:
|
||||
log.info("Timeout downloading " + str(self.stream_info))
|
||||
self.checker.stop()
|
||||
self.d.cancel()
|
||||
|
||||
def start(self, stream_info):
|
||||
self.stream_info = stream_info
|
||||
if 'stream_hash' in self.stream_info.keys():
|
||||
|
@ -49,28 +70,29 @@ class GetStream(object):
|
|||
self.stream_hash = self.stream_info['stream_hash']
|
||||
|
||||
else:
|
||||
print 'InvalidStreamInfoError'
|
||||
log.error("InvalidStreamInfoError in autofetcher: ", stream_info)
|
||||
raise InvalidStreamInfoError(self.stream_info)
|
||||
|
||||
if self.key_fee > self.max_key_fee:
|
||||
if self.pay_key:
|
||||
print "Key fee (" + str(self.key_fee) + ") above limit of " + str(
|
||||
self.max_key_fee) + ", didn't download lbry://" + str(self.resolved_name)
|
||||
log.info("Key fee (" + str(self.key_fee) + ") above limit of " + str(
|
||||
self.max_key_fee) + ", didn't download lbry://" + str(self.resolved_name))
|
||||
return defer.fail(None)
|
||||
else:
|
||||
pass
|
||||
|
||||
d = defer.Deferred(None)
|
||||
d.addCallback(lambda _: download_sd_blob(self.session, self.stream_hash, self.payment_rate_manager))
|
||||
d.addCallback(self.sd_identifier.get_metadata_for_sd_blob)
|
||||
d.addCallback(lambda metadata: (next(factory for factory in metadata.factories if isinstance(factory, ManagedLBRYFileDownloaderFactory)), metadata))
|
||||
d.addCallback(lambda (factory, metadata): factory.make_downloader(metadata, [self.data_rate, True], self.payment_rate_manager))
|
||||
d.addErrback(lambda err: err.trap(defer.CancelledError))
|
||||
d.addErrback(lambda err: log.error("An exception occurred attempting to load the stream descriptor: %s", err.getTraceback()))
|
||||
d.addCallback(self._start_download)
|
||||
d.callback(None)
|
||||
self.checker.start(1)
|
||||
|
||||
return d
|
||||
self.d.addCallback(lambda _: download_sd_blob(self.session, self.stream_hash, self.payment_rate_manager))
|
||||
self.d.addCallback(self.sd_identifier.get_metadata_for_sd_blob)
|
||||
self.d.addCallback(lambda metadata: (next(factory for factory in metadata.factories if isinstance(factory, ManagedLBRYFileDownloaderFactory)), metadata))
|
||||
self.d.addCallback(lambda (factory, metadata): factory.make_downloader(metadata, [self.data_rate, True], self.payment_rate_manager))
|
||||
self.d.addErrback(lambda err: err.trap(defer.CancelledError))
|
||||
self.d.addErrback(lambda err: log.error("An exception occurred attempting to load the stream descriptor: %s", err.getTraceback()))
|
||||
self.d.addCallback(self._start_download)
|
||||
self.d.callback(None)
|
||||
|
||||
return self.d
|
||||
|
||||
def _start_download(self, downloader):
|
||||
def _pay_key_fee():
|
||||
|
@ -78,7 +100,7 @@ class GetStream(object):
|
|||
reserved_points = self.wallet.reserve_points(self.key_fee_address, self.key_fee)
|
||||
if reserved_points is None:
|
||||
return defer.fail(InsufficientFundsError())
|
||||
print 'Key fee: ' + str(self.key_fee) + ' | ' + str(self.key_fee_address)
|
||||
log.info("Key fee: " + str(self.key_fee) + " | " + str(self.key_fee_address))
|
||||
return self.wallet.send_points_to_address(reserved_points, self.key_fee)
|
||||
return defer.succeed(None)
|
||||
|
||||
|
@ -89,7 +111,8 @@ class GetStream(object):
|
|||
|
||||
downloader.start()
|
||||
|
||||
print "Downloading", self.stream_hash, "-->", os.path.join(downloader.download_directory, downloader.file_name)
|
||||
self.download_path = os.path.join(downloader.download_directory, downloader.file_name)
|
||||
d.addCallback(lambda _: log.info("Downloading " + str(self.stream_hash) + " --> " + str(self.download_path)))
|
||||
|
||||
return d
|
||||
|
||||
|
@ -117,15 +140,16 @@ class FetcherDaemon(object):
|
|||
self.is_running = True
|
||||
self.search = LoopingCall(self._looped_search)
|
||||
self.search.start(1)
|
||||
log.info("Starting autofetcher")
|
||||
else:
|
||||
print "Autofetcher is already running"
|
||||
log.info("Autofetcher is already running")
|
||||
|
||||
def stop(self):
|
||||
if self.is_running:
|
||||
self.search.stop()
|
||||
self.is_running = False
|
||||
else:
|
||||
print "Autofetcher isn't running, there's nothing to stop"
|
||||
log.info("Autofetcher isn't running, there's nothing to stop")
|
||||
|
||||
def check_if_running(self):
|
||||
if self.is_running:
|
||||
|
@ -157,19 +181,15 @@ class FetcherDaemon(object):
|
|||
return d
|
||||
|
||||
def get_new_streams_in_tx(claims, t, blockhash):
|
||||
#claims = self.wallet.get_claims_for_tx(t['txid'])
|
||||
# if self.first_run:
|
||||
# # claims = self.rpc_conn.getclaimsfortx("96aca2c60efded5806b7336430c5987b9092ffbea9c6ed444e3bf8e008993e11")
|
||||
# # claims = self.rpc_conn.getclaimsfortx("cc9c7f5225ecb38877e6ca7574d110b23214ac3556b9d65784065ad3a85b4f74")
|
||||
# self.first_run = False
|
||||
rtn = []
|
||||
if claims:
|
||||
for claim in claims:
|
||||
if claim not in self.seen:
|
||||
msg = "[" + str(datetime.now()) + "] New claim | lbry://" + str(claim['name']) + \
|
||||
" | stream hash: " + str(json.loads(claim['value'])['stream_hash'])
|
||||
log.info(msg)
|
||||
if self.verbose:
|
||||
print msg
|
||||
log.debug(msg)
|
||||
rtn.append((claim['name'], t))
|
||||
self.seen.append(claim)
|
||||
else:
|
||||
|
@ -179,8 +199,6 @@ class FetcherDaemon(object):
|
|||
|
||||
d.addCallback(lambda streams: defer.DeferredList(
|
||||
[self.wallet.get_stream_info_from_txid(name, t) for name, t in streams]))
|
||||
# if len(rtn):
|
||||
# return defer.DeferredList([self.wallet.get_stream_info_for_name(name, txid=t) for name, t in rtn])
|
||||
return d
|
||||
|
||||
def _download_claims(self, claims):
|
||||
|
@ -204,12 +222,12 @@ class FetcherDaemon(object):
|
|||
for l in conf:
|
||||
if l.startswith("maxkey="):
|
||||
settings["maxkey"] = float(l[7:].rstrip('\n'))
|
||||
print "Autofetcher using max key price of", settings["maxkey"], ", to start call start_fetcher()"
|
||||
conf.close()
|
||||
else:
|
||||
print "Autofetcher using default max key price of 0.0"
|
||||
print "To change this create the file:"
|
||||
print str(self.autofetcher_conf)
|
||||
print "Example contents of conf file:"
|
||||
print "maxkey=1.0"
|
||||
conf = open(self.autofetcher_conf, "w")
|
||||
conf.write("maxkey=10.0")
|
||||
conf.close()
|
||||
settings["maxkey"] = 10.0
|
||||
log.info("No autofetcher conf file found, making one with max key fee of 10.0")
|
||||
|
||||
self.max_key_fee = settings["maxkey"]
|
||||
|
|
|
@ -33,14 +33,16 @@ class Publisher(object):
|
|||
self.sd_hash = None
|
||||
self.tx_hash = None
|
||||
self.content_license = None
|
||||
self.author = None
|
||||
self.sources = None
|
||||
|
||||
def start(self, name, file_path, bid, title=None, description=None, thumbnail=None,
|
||||
key_fee=None, key_fee_address=None, content_license=None):
|
||||
key_fee=None, key_fee_address=None, content_license=None, author=None, sources=None):
|
||||
|
||||
def _show_result():
|
||||
message = "[" + str(datetime.now()) + "] Published " + self.file_name + " --> lbry://" + \
|
||||
str(self.publish_name) + " with txid: " + str(self.tx_hash)
|
||||
print message
|
||||
log.info(message)
|
||||
return defer.succeed(message)
|
||||
|
||||
self.publish_name = name
|
||||
|
@ -52,6 +54,8 @@ class Publisher(object):
|
|||
self.key_fee = key_fee
|
||||
self.key_fee_address = key_fee_address
|
||||
self.content_license = content_license
|
||||
self.author = author
|
||||
self.sources = sources
|
||||
|
||||
d = self._check_file_path(self.file_path)
|
||||
d.addCallback(lambda _: create_lbry_file(self.session, self.lbry_file_manager,
|
||||
|
@ -104,10 +108,11 @@ class Publisher(object):
|
|||
return d
|
||||
|
||||
def _claim_name(self):
|
||||
d = self.wallet.claim_name(self.publish_name, self.sd_hash, self.bid_amount,
|
||||
d = self.wallet.claim_name(self.publish_name, {'sd_hash': self.sd_hash}, self.bid_amount,
|
||||
description=self.description, key_fee=self.key_fee,
|
||||
key_fee_address=self.key_fee_address, thumbnail=self.thumbnail,
|
||||
content_license=self.content_license)
|
||||
content_license=self.content_license, author=self.author,
|
||||
sources=self.sources)
|
||||
|
||||
def set_tx_hash(tx_hash):
|
||||
self.tx_hash = tx_hash
|
||||
|
@ -122,6 +127,6 @@ class Publisher(object):
|
|||
else:
|
||||
d = defer.succeed(True)
|
||||
error_message = err.getErrorMessage()
|
||||
print message % (str(self.file_name), str(self.publish_name), error_message)
|
||||
log.error(error_message)
|
||||
log.error(message, str(self.file_name), str(self.publish_name), err.getTraceback())
|
||||
return d
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "Restarting lbrynet-daemon"
|
||||
lbrynet-daemon
|
|
@ -1,50 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
lbrycrd_directory="/Users/${SUDO_USER}/Library/Application Support/lbrycrd"
|
||||
|
||||
current_version=$(git ls-remote https://github.com/jackrobison/lbrynet-app.git | grep HEAD | cut -f 1)
|
||||
|
||||
if [ -d "$lbrycrd_directory" ]; then
|
||||
if [ -f "${lbrycrd_directory}/lbry_app_version.txt" ]; then
|
||||
if grep -Fxq "$current_version" "${lbrycrd_directory}/lbry_app_version.txt"; then
|
||||
echo "LBRY version $current_version is up to date"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! brew list berkeley-db4 &>/dev/null; then
|
||||
echo "Installing berkeley-db4"
|
||||
sudo -u ${SUDO_USER} brew install https://rawgit.com/jackrobison/homebrew/master/Library/Formula/berkeley-db4.rb &>/dev/null
|
||||
sudo -u ${SUDO_USER} brew link --force berkeley-db4 &>/dev/null
|
||||
else
|
||||
echo "berkeley-db4 already installed"
|
||||
fi
|
||||
|
||||
tmp=$(mktemp -d)
|
||||
cd $tmp
|
||||
|
||||
echo "Downloading LBRY update"
|
||||
git clone --depth 1 https://github.com/jackrobison/lbrynet-app.git &>/dev/null
|
||||
cd lbrynet-app
|
||||
unzip LBRY.app.zip &>/dev/null
|
||||
unzip LBRYURIHandler.app.zip &>/dev/null
|
||||
unzip LBRY\ Updater.app.zip &>/dev/null
|
||||
|
||||
echo "Installing update"
|
||||
|
||||
mkdir -p "$lbrycrd_directory"
|
||||
echo $current_version > "${lbrycrd_directory}/lbry_app_version.txt"
|
||||
|
||||
rm -rf /Applications/LBRY.app &>/dev/null
|
||||
rm -rf /Applications/LBRYURIHandler.app &>/dev/null
|
||||
rm -rf /Applications/LBRY\ Updater.app &>/dev/null
|
||||
|
||||
mv -f LBRY.app /Applications
|
||||
mv -f LBRYURIHandler.app /Applications
|
||||
mv -f LBRY\ Updater.app /Applications
|
||||
|
||||
echo "Cleaning up"
|
||||
|
||||
cd ../../
|
||||
rm -rf $tmp
|
|
@ -1,163 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if ! which brew &>/dev/null; then
|
||||
echo "Installing brew..."
|
||||
sudo -u ${SUDO_USER} ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null &>/dev/null
|
||||
else
|
||||
echo "Updating brew..."
|
||||
sudo -u ${SUDO_USER} brew update &>/dev/null
|
||||
fi
|
||||
|
||||
if ! brew list mpfr &>/dev/null; then
|
||||
echo "Installing mpfr..."
|
||||
sudo -u ${SUDO_USER} brew install mpfr &>/dev/null
|
||||
else
|
||||
echo "mpfr already installed..."
|
||||
fi
|
||||
|
||||
if ! brew list libmpc &>/dev/null; then
|
||||
echo "Installing libmpc..."
|
||||
sudo -u ${SUDO_USER} brew install libmpc &>/dev/null
|
||||
else
|
||||
echo "libmpc already installed..."
|
||||
fi
|
||||
|
||||
if ! brew list openssl &>/dev/null; then
|
||||
echo "Installing openssl..."
|
||||
sudo -u ${SUDO_USER} brew install openssl &>/dev/null
|
||||
sudo -u ${SUDO_USER} brew link --force openssl &>/dev/null
|
||||
else
|
||||
echo "openssl already installed..."
|
||||
fi
|
||||
|
||||
if ! which pip &>/dev/null; then
|
||||
echo "Installing pip..."
|
||||
sudo easy_install pip &>/dev/null
|
||||
else
|
||||
echo "pip already installed"
|
||||
fi
|
||||
|
||||
if ! python -c 'import gmpy' &>/dev/null; then
|
||||
echo "Installing gmpy..."
|
||||
sudo pip install gmpy &>/dev/null
|
||||
else
|
||||
echo "gmpy already installed..."
|
||||
fi
|
||||
|
||||
if ! python -c 'import service_identity' &>/dev/null; then
|
||||
echo "Installing service_identity..."
|
||||
sudo pip install service_identity &>/dev/null
|
||||
else
|
||||
echo "gmpy already installed..."
|
||||
fi
|
||||
|
||||
if ! python -c 'import rumps' &>/dev/null; then
|
||||
echo "Installing rumps..."
|
||||
sudo pip install rumps &>/dev/null
|
||||
else
|
||||
echo "rumps already installed..."
|
||||
fi
|
||||
|
||||
if ! python -c "import six; exit(0) if six.__version__ == '1.9.0' else exit(1)" &>/dev/null; then
|
||||
echo "Installing six 1.9.0 for python..."
|
||||
curl -O https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz &>/dev/null
|
||||
tar xf six-1.9.0.tar.gz &>/dev/null
|
||||
cd six-1.9.0
|
||||
sudo python setup.py install &>/dev/null
|
||||
cd ..
|
||||
rm -rf six-1.9.0
|
||||
rm six-1.9.0.tar.gz
|
||||
fi
|
||||
|
||||
lbrynet_directory="/Users/${SUDO_USER}/Library/Application Support/lbrynet"
|
||||
lbryum_current_version=$(git ls-remote https://github.com/lbryio/lbryum.git | grep HEAD | cut -f 1)
|
||||
|
||||
if [ -d "$lbrynet_directory" ]; then
|
||||
if [ -f "${lbrynet_directory}/lbryum_version.txt" ]; then
|
||||
if grep -Fxq "$lbryum_current_version" "${lbrynet_directory}/lbryum_version.txt"; then
|
||||
echo "LBRYum version $lbryum_current_version is up to date"
|
||||
else
|
||||
tmp=$(mktemp -d)
|
||||
cd $tmp
|
||||
|
||||
echo "Downloading LBRYum update..."
|
||||
|
||||
git clone --depth 1 https://github.com/lbryio/lbryum.git &>/dev/null
|
||||
cd lbryum
|
||||
|
||||
echo "Installing update..."
|
||||
sudo python setup.py install &>/dev/null
|
||||
mkdir -p "$lbrynet_directory"
|
||||
echo $lbryum_current_version > "${lbrynet_directory}/lbryum_version.txt"
|
||||
|
||||
echo "Cleaning up..."
|
||||
|
||||
cd ../../
|
||||
rm -rf $tmp
|
||||
fi
|
||||
else
|
||||
tmp=$(mktemp -d)
|
||||
cd $tmp
|
||||
|
||||
echo "Downloading LBRYum..."
|
||||
|
||||
git clone --depth 1 https://github.com/lbryio/lbryum.git &>/dev/null
|
||||
cd lbryum
|
||||
|
||||
echo "Installing..."
|
||||
sudo python setup.py install &>/dev/null
|
||||
mkdir -p "$lbrynet_directory"
|
||||
echo $lbryum_current_version > "${lbrynet_directory}/lbryum_version.txt"
|
||||
|
||||
echo "Cleaning up..."
|
||||
|
||||
cd ../../
|
||||
rm -rf $tmp
|
||||
fi
|
||||
fi
|
||||
|
||||
lbrynet_current_version=$(git ls-remote https://github.com/lbryio/lbry.git | grep HEAD | cut -f 1)
|
||||
|
||||
if [ -d "$lbrynet_directory" ]; then
|
||||
if [ -f "${lbrynet_directory}/lbrynet_version.txt" ]; then
|
||||
if grep -Fxq "$lbrynet_current_version" "${lbrynet_directory}/lbrynet_version.txt"; then
|
||||
echo "LBRYnet version $lbrynet_current_version is up to date"
|
||||
else
|
||||
tmp=$(mktemp -d)
|
||||
cd $tmp
|
||||
|
||||
echo "Downloading LBRYnet update"
|
||||
|
||||
git clone --depth 1 https://github.com/lbryio/lbry.git &>/dev/null
|
||||
cd lbry
|
||||
|
||||
echo "Installing update..."
|
||||
sudo python setup.py install &>/dev/null
|
||||
mkdir -p "$lbrynet_directory"
|
||||
echo $lbrynet_current_version > "${lbrynet_directory}/lbrynet_version.txt"
|
||||
|
||||
echo "Cleaning up..."
|
||||
|
||||
cd ../../
|
||||
rm -rf $tmp
|
||||
fi
|
||||
else
|
||||
tmp=$(mktemp -d)
|
||||
cd $tmp
|
||||
|
||||
echo "Downloading LBRYnet..."
|
||||
|
||||
git clone --depth 1 https://github.com/lbryio/lbry.git &>/dev/null
|
||||
cd lbry
|
||||
|
||||
echo "Installing..."
|
||||
sudo python setup.py install &>/dev/null
|
||||
mkdir -p "$lbrynet_directory"
|
||||
echo $lbrynet_current_version > "${lbrynet_directory}/lbrynet_version.txt"
|
||||
|
||||
echo "Cleaning up..."
|
||||
|
||||
cd ../../
|
||||
rm -rf $tmp
|
||||
fi
|
||||
fi
|
|
@ -4,7 +4,9 @@ import os
|
|||
APP = [os.path.join('lbrynet', 'lbrynet_daemon', 'Apps', 'LBRYURIHandler.py')]
|
||||
DATA_FILES = []
|
||||
OPTIONS = {'argv_emulation': True,
|
||||
'packages': ['jsonrpc'],
|
||||
'plist': {
|
||||
'LSUIElement': True,
|
||||
'CFBundleURLTypes': [
|
||||
{
|
||||
'CFBundleURLTypes': 'LBRYURIHandler',
|
||||
|
|
Loading…
Reference in a new issue