forked from LBRYCommunity/lbry-sdk
Merge branch 'development' of github.com:lbryio/lbry into development
This commit is contained in:
commit
96c8d1f68b
8 changed files with 212 additions and 108 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -17,3 +17,9 @@ lbrynet.egg-info/PKG-INFO
|
|||
/build
|
||||
|
||||
/dist
|
||||
|
||||
*.so
|
||||
|
||||
*.pem
|
||||
|
||||
*.decTest
|
||||
|
|
|
@ -1006,7 +1006,7 @@ class LBRYumWallet(LBRYWallet):
|
|||
return defer.succeed(Decimal(self.wallet.get_addr_received(address))/COIN)
|
||||
|
||||
def get_nametrie(self):
|
||||
cmd = known_commands['getnametrie']
|
||||
cmd = known_commands['getclaimtrie']
|
||||
func = getattr(self.cmd_runner, cmd.name)
|
||||
return threads.deferToThread(func)
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ from lbrynet.lbryfile.StreamDescriptor import LBRYFileStreamType
|
|||
from lbrynet.lbryfile.client.LBRYFileDownloader import LBRYFileSaverFactory, LBRYFileOpenerFactory
|
||||
from lbrynet.lbryfile.client.LBRYFileOptions import add_lbry_file_to_sd_identifier
|
||||
from lbrynet.lbrynet_daemon.LBRYDownloader import GetStream, FetcherDaemon
|
||||
# from lbrynet.lbrynet_daemon.LBRYOSXStatusBar import DaemonStatusBarApp
|
||||
from lbrynet.lbrynet_daemon.LBRYPublisher import Publisher
|
||||
from lbrynet.core.utils import generate_id
|
||||
from lbrynet.lbrynet_console.LBRYSettings import LBRYSettings
|
||||
|
@ -16,7 +15,7 @@ from lbrynet.conf import MIN_BLOB_DATA_PAYMENT_RATE, DEFAULT_MAX_SEARCH_RESULTS,
|
|||
from lbrynet.core.StreamDescriptor import StreamDescriptorIdentifier, download_sd_blob
|
||||
from lbrynet.core.Session import LBRYSession
|
||||
from lbrynet.core.PTCWallet import PTCWallet
|
||||
from lbrynet.core.LBRYcrdWallet import LBRYcrdWallet
|
||||
from lbrynet.core.LBRYcrdWallet import LBRYcrdWallet, LBRYumWallet
|
||||
from lbrynet.lbryfilemanager.LBRYFileManager import LBRYFileManager
|
||||
from lbrynet.lbryfile.LBRYFileMetadataManager import DBLBRYFileMetadataManager, TempLBRYFileMetadataManager
|
||||
from twisted.web import xmlrpc, server
|
||||
|
@ -26,9 +25,11 @@ from decimal import Decimal
|
|||
from StringIO import StringIO
|
||||
from zipfile import ZipFile
|
||||
from urllib import urlopen
|
||||
import os, sys, json, binascii, webbrowser, xmlrpclib, subprocess, logging
|
||||
|
||||
import os, sys, json, binascii, webbrowser, xmlrpclib, subprocess, logging, argparse
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
# logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
|
||||
# TODO add login credentials in a conf file
|
||||
|
@ -46,8 +47,8 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
LBRYnet daemon
|
||||
"""
|
||||
|
||||
def setup(self):
|
||||
def _set_vars():
|
||||
def setup(self, wallet_type, check_for_updates):
|
||||
def _set_vars(wallet_type, check_for_updates):
|
||||
self.fetcher = None
|
||||
self.current_db_revision = 1
|
||||
self.run_server = True
|
||||
|
@ -57,6 +58,7 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
self.db_dir = os.path.join(os.path.expanduser("~"), ".lbrynet")
|
||||
else:
|
||||
self.db_dir = os.path.join(os.path.expanduser("~"), "Library/Application Support/lbrynet")
|
||||
# from lbrynet.lbrynet_daemon.LBRYOSXStatusBar import DaemonStatusBarApp
|
||||
# self.status_app = DaemonStatusBarApp()
|
||||
self.blobfile_dir = os.path.join(self.db_dir, "blobfiles")
|
||||
self.peer_port = 3333
|
||||
|
@ -93,10 +95,10 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
self.lbry_file_metadata_manager = None
|
||||
self.lbry_file_manager = None
|
||||
self.settings = LBRYSettings(self.db_dir)
|
||||
self.wallet_type = "lbrycrd"
|
||||
self.wallet_type = wallet_type
|
||||
self.check_for_updates = check_for_updates
|
||||
self.lbrycrd_conf = os.path.join(self.wallet_dir, "lbrycrd.conf")
|
||||
self.autofetcher_conf = os.path.join(self.wallet_dir, "autofetcher.conf")
|
||||
self.files = []
|
||||
self.created_data_dir = False
|
||||
if not os.path.exists(self.db_dir):
|
||||
os.mkdir(self.db_dir)
|
||||
|
@ -117,11 +119,14 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
else:
|
||||
print "Started LBRYnet daemon"
|
||||
print "The daemon can be shut down by running 'stop-lbrynet-daemon' in a terminal"
|
||||
log.info('[' + str(datetime.now()) + '] Started lbrynet-daemon')
|
||||
|
||||
return defer.succeed(None)
|
||||
|
||||
log.info('[' + str(datetime.now()) + '] Starting lbrynet-daemon')
|
||||
|
||||
d = defer.Deferred()
|
||||
d.addCallback(lambda _: _set_vars())
|
||||
d.addCallback(lambda _: _set_vars(wallet_type, check_for_updates))
|
||||
d.addCallback(lambda _: threads.deferToThread(self._setup_data_directory))
|
||||
d.addCallback(lambda _: self._check_db_migration())
|
||||
d.addCallback(lambda _: self._get_settings())
|
||||
|
@ -134,8 +139,8 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
d.addCallback(lambda _: self._setup_query_handlers())
|
||||
d.addCallback(lambda _: self._setup_server())
|
||||
if sys.platform == "darwin":
|
||||
d.addCallback(lambda _: self._update())
|
||||
# d.addCallback(lambda _: self.status_app.run())
|
||||
d.addCallback(lambda _: self._update() if self.check_for_updates == "True" else defer.succeed(None))
|
||||
# d.addCallback(lambda _: defer.succeed(self.status_app.run()))
|
||||
d.addCallback(lambda _: self._setup_fetcher())
|
||||
d.addCallback(lambda _: _disp_startup())
|
||||
d.callback(None)
|
||||
|
@ -397,6 +402,8 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
|
||||
def get_wallet():
|
||||
if self.wallet_type == "lbrycrd":
|
||||
print "Using lbrycrd wallet"
|
||||
log.info("Using lbrycrd wallet")
|
||||
lbrycrdd_path = None
|
||||
if self.start_lbrycrdd is True:
|
||||
lbrycrdd_path = self.lbrycrdd_path
|
||||
|
@ -404,8 +411,17 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
lbrycrdd_path = self.default_lbrycrdd_path
|
||||
d = defer.succeed(LBRYcrdWallet(self.db_dir, wallet_dir=self.wallet_dir, wallet_conf=self.lbrycrd_conf,
|
||||
lbrycrdd_path=lbrycrdd_path))
|
||||
else:
|
||||
elif self.wallet_type == "lbryum":
|
||||
print "Using lbryum wallet"
|
||||
log.info("Using lbryum wallet")
|
||||
d = defer.succeed(LBRYumWallet(self.db_dir))
|
||||
elif self.wallet_type == "ptc":
|
||||
print "Using PTC wallet"
|
||||
log.info("Using PTC wallet")
|
||||
d = defer.succeed(PTCWallet(self.db_dir))
|
||||
else:
|
||||
d = defer.fail()
|
||||
|
||||
d.addCallback(lambda wallet: {"wallet": wallet})
|
||||
return d
|
||||
|
||||
|
@ -530,9 +546,11 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
path = os.path.join(self.blobfile_dir, stream_hash)
|
||||
if os.path.isfile(path):
|
||||
print "[" + str(datetime.now()) + "] Search for lbry_file, returning: " + stream_hash
|
||||
log.info("[" + str(datetime.now()) + "] Search for lbry_file, returning: " + stream_hash)
|
||||
return defer.succeed(_get_lbry_file(path))
|
||||
else:
|
||||
print "[" + str(datetime.now()) + "] Search for lbry_file didn't return anything"
|
||||
log.info("[" + str(datetime.now()) + "] Search for lbry_file didn't return anything")
|
||||
return defer.succeed(False)
|
||||
|
||||
d = self._resolve_name(name)
|
||||
|
@ -578,8 +596,10 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
def _check_est(d, name):
|
||||
if type(d.result) is float:
|
||||
print '[' + str(datetime.now()) + '] Cost est for lbry://' + name + ': ' + str(d.result) + 'LBC'
|
||||
log.info('[' + str(datetime.now()) + '] Cost est for lbry://' + name + ': ' + str(d.result) + 'LBC')
|
||||
else:
|
||||
print '[' + str(datetime.now()) + '] Timeout estimating cost for lbry://' + name + ', using key fee'
|
||||
log.info('[' + str(datetime.now()) + '] Timeout estimating cost for lbry://' + name + ', using key fee')
|
||||
d.cancel()
|
||||
return defer.succeed(None)
|
||||
|
||||
|
@ -636,6 +656,7 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
|
||||
self.fetcher.start()
|
||||
print '[' + str(datetime.now()) + '] Start autofetcher'
|
||||
log.info('[' + str(datetime.now()) + '] Start autofetcher')
|
||||
return 'Started autofetching'
|
||||
|
||||
def xmlrpc_stop_fetcher(self):
|
||||
|
@ -645,6 +666,7 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
|
||||
self.fetcher.stop()
|
||||
print '[' + str(datetime.now()) + '] Stop autofetcher'
|
||||
log.info('[' + str(datetime.now()) + '] Stop autofetcher')
|
||||
return 'Stopped autofetching'
|
||||
|
||||
def xmlrpc_fetcher_status(self):
|
||||
|
@ -669,6 +691,7 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
"""
|
||||
|
||||
def _disp_shutdown():
|
||||
log.info('Shutting down lbrynet daemon')
|
||||
print 'Shutting down lbrynet daemon'
|
||||
|
||||
d = self._shutdown()
|
||||
|
@ -711,7 +734,6 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
"""
|
||||
|
||||
def _disp(info):
|
||||
log.debug('[' + str(datetime.now()) + ']' + ' Resolved info: ' + str(info['stream_hash']))
|
||||
print '[' + str(datetime.now()) + ']' + ' Resolved info: ' + str(info['stream_hash'])
|
||||
return info
|
||||
|
||||
|
@ -813,13 +835,6 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
@return:
|
||||
"""
|
||||
|
||||
#def _return_d(x):
|
||||
# d = defer.Deferred()
|
||||
# d.addCallback(lambda _: x)
|
||||
# d.callback(None)
|
||||
|
||||
# return d
|
||||
|
||||
def _clean(n):
|
||||
t = []
|
||||
for i in n:
|
||||
|
@ -861,9 +876,13 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
|
||||
def _disp(results):
|
||||
print '[' + str(datetime.now()) + '] Found ' + str(len(results)) + ' results'
|
||||
log.info('[' + str(datetime.now()) + '] Search results: ')
|
||||
for r in results:
|
||||
log.info(str(r))
|
||||
return results
|
||||
|
||||
print '[' + str(datetime.now()) + '] Search nametrie: ' + search
|
||||
log.info('[' + str(datetime.now()) + '] Search nametrie: ' + search)
|
||||
|
||||
d = self.session.wallet.get_nametrie()
|
||||
d.addCallback(lambda trie: [claim for claim in trie if claim['name'].startswith(search) and 'txid' in claim])
|
||||
|
@ -944,6 +963,9 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
else:
|
||||
content_license = None
|
||||
|
||||
log.info('[' + str(datetime.now()) + '] Publish: ', name, file_path, bid, title, description, thumbnail,
|
||||
key_fee, key_fee_address, content_license)
|
||||
|
||||
p = Publisher(self.session, self.lbry_file_manager, self.session.wallet)
|
||||
d = p.start(name, file_path, bid, title, description, thumbnail, key_fee, key_fee_address, content_license)
|
||||
|
||||
|
@ -981,6 +1003,15 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
|
||||
return d
|
||||
|
||||
def xmlrpc_get_new_address(self):
|
||||
def _disp(address):
|
||||
print "[" + str(datetime.now()) + "] Got new wallet address: " + address
|
||||
return address
|
||||
|
||||
d = self.session.wallet.get_new_address()
|
||||
d.addCallback(_disp)
|
||||
return d
|
||||
|
||||
# def xmlrpc_update_name(self, metadata):
|
||||
# def _disp(x):
|
||||
# print x
|
||||
|
@ -1042,17 +1073,28 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Launch lbrynet-daemon")
|
||||
parser.add_argument("--wallet",
|
||||
help="lbrycrd or lbryum, default lbryum",
|
||||
type=str,
|
||||
default="lbryum")
|
||||
parser.add_argument("--update",
|
||||
help="True or false, default true",
|
||||
type=str,
|
||||
default="True")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
d = xmlrpclib.ServerProxy('http://localhost:7080')
|
||||
d.stop()
|
||||
daemon = xmlrpclib.ServerProxy("http://localhost:7080")
|
||||
daemon.stop()
|
||||
except:
|
||||
pass
|
||||
|
||||
daemon = LBRYDaemon()
|
||||
daemon.setup()
|
||||
reactor.listenTCP(7080, server.Site(daemon))
|
||||
daemon.setup(args.wallet, args.update)
|
||||
reactor.listenTCP(7080, server.Site(daemon), interface='localhost')
|
||||
reactor.run()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
main()
|
|
@ -4,12 +4,11 @@ import xmlrpclib
|
|||
def main():
|
||||
daemon = xmlrpclib.ServerProxy("http://localhost:7080/")
|
||||
try:
|
||||
b = daemon.get_balance()
|
||||
is_running = True
|
||||
status = daemon.is_running()
|
||||
except:
|
||||
is_running = False
|
||||
status = False
|
||||
|
||||
if is_running:
|
||||
if status:
|
||||
daemon.stop()
|
||||
print "LBRYnet daemon stopped"
|
||||
else:
|
||||
|
|
|
@ -1,15 +1,71 @@
|
|||
import rumps
|
||||
import xmlrpclib
|
||||
import os
|
||||
import webbrowser
|
||||
|
||||
|
||||
class DaemonStatusBarApp(rumps.App):
|
||||
def __init__(self):
|
||||
super(DaemonStatusBarApp, self).__init__("LBRYnet", icon=os.path.join(os.path.expanduser("~"), "Downloads/lbryio//web/img/fav/apple-touch-icon.png"), quit_button=None)
|
||||
self.menu = ["Quit"]
|
||||
icon_path = os.path.join(os.path.expanduser("~"), "Downloads/lbryio/web/img/fav/apple-touch-icon.png")
|
||||
if os.path.isfile(icon_path):
|
||||
rumps.App.__init__(self, name="LBRY", icon=icon_path, quit_button=None,
|
||||
menu=["Open", "Preferences", "View balance", "Quit"])
|
||||
else:
|
||||
rumps.App.__init__(self, name="LBRY", title="LBRY", quit_button=None,
|
||||
menu=["Open", "Preferences", "View balance", "Quit"])
|
||||
|
||||
@rumps.clicked('Open')
|
||||
def get_ui(self):
|
||||
try:
|
||||
daemon = xmlrpclib.ServerProxy('http://localhost:7080')
|
||||
daemon.is_running()
|
||||
webbrowser.open("lbry://lbry")
|
||||
except:
|
||||
try:
|
||||
rumps.notification(title='LBRY', subtitle='status', message="Couldn't connect to lbrynet daemon", sound=True)
|
||||
except:
|
||||
rumps.alert(title='LBRY', message="Couldn't connect to lbrynet daemon")
|
||||
|
||||
@rumps.clicked("Preferences")
|
||||
def prefs(self, _):
|
||||
try:
|
||||
daemon = xmlrpclib.ServerProxy('http://localhost:7080')
|
||||
daemon.is_running()
|
||||
webbrowser.open("lbry://settings")
|
||||
except:
|
||||
rumps.notification(title='LBRY', subtitle='status', message="Couldn't connect to lbrynet daemon", sound=True)
|
||||
|
||||
@rumps.clicked("View balance")
|
||||
def disp_balance(self):
|
||||
daemon = xmlrpclib.ServerProxy('http://localhost:7080')
|
||||
try:
|
||||
balance = daemon.get_balance()
|
||||
try:
|
||||
rumps.notification(title='LBRY', subtitle='status', message="Your balance is " + str(balance), sound=False)
|
||||
except:
|
||||
rumps.alert(title='LBRY', message="Your balance is " + str(balance))
|
||||
|
||||
except:
|
||||
try:
|
||||
rumps.notification(title='LBRY', subtitle='status', message="Couldn't connect to lbrynet daemon", sound=True)
|
||||
except:
|
||||
rumps.alert(title='LBRY', message="Couldn't connect to lbrynet daemon")
|
||||
|
||||
@rumps.clicked('Quit')
|
||||
def clean_quit(self):
|
||||
d = xmlrpclib.ServerProxy('http://localhost:7080')
|
||||
d.stop()
|
||||
daemon = xmlrpclib.ServerProxy('http://localhost:7080')
|
||||
try:
|
||||
daemon.stop()
|
||||
except:
|
||||
pass
|
||||
|
||||
rumps.quit_application()
|
||||
|
||||
|
||||
def main():
|
||||
status_app = DaemonStatusBarApp()
|
||||
status_app.run()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -59,7 +59,7 @@ else
|
|||
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"
|
||||
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
|
||||
|
@ -70,6 +70,51 @@ if ! python -c "import six; exit(0) if six.__version__ == '1.9.0' else exit(1)"
|
|||
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 -b development --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 -b development --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)
|
||||
|
||||
|
@ -83,15 +128,15 @@ if [ -d "$lbrynet_directory" ]; then
|
|||
|
||||
echo "Downloading LBRYnet update"
|
||||
|
||||
git clone --depth 1 https://github.com/lbryio/lbry.git &>/dev/null
|
||||
git clone -b development --depth 1 https://github.com/lbryio/lbry.git &>/dev/null
|
||||
cd lbry
|
||||
|
||||
echo "Installing update"
|
||||
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"
|
||||
echo "Cleaning up..."
|
||||
|
||||
cd ../../
|
||||
rm -rf $tmp
|
||||
|
@ -100,63 +145,17 @@ if [ -d "$lbrynet_directory" ]; then
|
|||
tmp=$(mktemp -d)
|
||||
cd $tmp
|
||||
|
||||
echo "Downloading LBRYnet update"
|
||||
echo "Downloading LBRYnet..."
|
||||
|
||||
git clone --depth 1 https://github.com/lbryio/lbry.git &>/dev/null
|
||||
git clone -b development --depth 1 https://github.com/lbryio/lbry.git &>/dev/null
|
||||
cd lbry
|
||||
|
||||
echo "Installing update"
|
||||
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
|
||||
|
||||
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 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"
|
||||
echo "Cleaning up..."
|
||||
|
||||
cd ../../
|
||||
rm -rf $tmp
|
||||
|
|
36
setup.py
36
setup.py
|
@ -2,29 +2,31 @@
|
|||
|
||||
import ez_setup
|
||||
ez_setup.use_setuptools()
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
import sys
|
||||
|
||||
console_scripts = ['lbrynet-console = lbrynet.lbrynet_console.LBRYConsole:launch_lbry_console',
|
||||
'lbrynet-stdin-uploader = lbrynet.lbrynet_console.LBRYStdinUploader:launch_stdin_uploader',
|
||||
'lbrynet-stdout-downloader = lbrynet.lbrynet_console.LBRYStdoutDownloader:launch_stdout_downloader',
|
||||
'lbrynet-create-network = lbrynet.create_network:main',
|
||||
'lbrynet-launch-node = lbrynet.dht.node:main',
|
||||
'lbrynet-launch-rpc-node = lbrynet.rpc_node:main',
|
||||
'lbrynet-rpc-node-cli = lbrynet.node_rpc_cli:main',
|
||||
'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.LBRYDaemonStopper:main']
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
console_scripts.append('lbrynet-daemon-status = lbrynet.lbrynet_daemon.LBRYOSXStatusBar:main')
|
||||
|
||||
|
||||
setup(name='lbrynet',
|
||||
version='0.0.4',
|
||||
packages=find_packages(),
|
||||
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'],
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'lbrynet-console = lbrynet.lbrynet_console.LBRYConsole:launch_lbry_console',
|
||||
'lbrynet-stdin-uploader = lbrynet.lbrynet_console.LBRYStdinUploader:launch_stdin_uploader',
|
||||
'lbrynet-stdout-downloader = lbrynet.lbrynet_console.LBRYStdoutDownloader:launch_stdout_downloader',
|
||||
'lbrynet-create-network = lbrynet.create_network:main',
|
||||
'lbrynet-launch-node = lbrynet.dht.node:main',
|
||||
'lbrynet-launch-rpc-node = lbrynet.rpc_node:main',
|
||||
'lbrynet-rpc-node-cli = lbrynet.node_rpc_cli:main',
|
||||
'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.LBRYDaemonStopper:main',
|
||||
]
|
||||
},
|
||||
entry_points={'console_scripts': console_scripts},
|
||||
data_files=[
|
||||
('lbrynet/lbrynet_console/plugins',
|
||||
[
|
||||
|
|
|
@ -7,9 +7,8 @@ from slackclient import SlackClient
|
|||
def get_conf():
|
||||
f = open('testbot.conf', 'r')
|
||||
token = f.readline().replace('\n', '')
|
||||
channel = f.readline().replace('\n', '')
|
||||
f.close()
|
||||
return token, channel
|
||||
return token
|
||||
|
||||
def test_lbrynet(lbry, slack, channel):
|
||||
logfile = open('lbrynet_test_log.txt', 'a')
|
||||
|
@ -48,10 +47,11 @@ def test_lbrynet(lbry, slack, channel):
|
|||
lbry.delete_lbry_file('test.jpg')
|
||||
logfile.close()
|
||||
|
||||
token, channel = get_conf()
|
||||
token = get_conf()
|
||||
|
||||
sc = SlackClient(token)
|
||||
sc.rtm_connect()
|
||||
channel = [c['id'] for c in json.loads(sc.api_call('channels.list'))['channels'] if c['name'] == 'tech'][0]
|
||||
print 'Connected to slack'
|
||||
daemon = xmlrpclib.ServerProxy("http://localhost:7080")
|
||||
|
||||
|
|
Loading…
Reference in a new issue