add missing commits

This commit is contained in:
Jack 2016-03-17 22:50:15 -04:00
parent ef62b0e746
commit e3225f7123
20 changed files with 341 additions and 314 deletions

6
.gitignore vendored
View file

@ -17,3 +17,9 @@ lbrynet.egg-info/PKG-INFO
/build /build
/dist /dist
*.so
*.pem
*.decTest

BIN
app.icns Normal file

Binary file not shown.

View file

@ -294,7 +294,7 @@ class LBRYWallet(object):
value = result['value'] value = result['value']
try: try:
value_dict = json.loads(value) value_dict = json.loads(value)
except ValueError: 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'] 'content_license']
@ -395,7 +395,7 @@ class LBRYWallet(object):
if 'name' in claim and str(claim['name']) == name and 'value' in claim: if 'name' in claim and str(claim['name']) == name and 'value' in claim:
try: try:
value_dict = json.loads(claim['value']) value_dict = json.loads(claim['value'])
except ValueError: except (ValueError, TypeError):
return None return None
if 'stream_hash' in value_dict and str(value_dict['stream_hash']) == sd_hash: if 'stream_hash' in value_dict and str(value_dict['stream_hash']) == sd_hash:
if 'is controlling' in claim and claim['is controlling']: if 'is controlling' in claim and claim['is controlling']:
@ -835,6 +835,7 @@ class LBRYumWallet(LBRYWallet):
self.wallet = None self.wallet = None
self.cmd_runner = None self.cmd_runner = None
self.first_run = False self.first_run = False
self.printed_retrieving_headers = False
def _start(self): def _start(self):
@ -843,15 +844,20 @@ class LBRYumWallet(LBRYWallet):
def setup_network(): def setup_network():
self.config = SimpleConfig() self.config = SimpleConfig()
self.network = Network(self.config) self.network = Network(self.config)
alert.info("Starting the wallet...")
return defer.succeed(self.network.start()) return defer.succeed(self.network.start())
d = setup_network() d = setup_network()
def check_started(): def check_started():
if self.network.is_connecting(): if self.network.is_connecting():
if not self.printed_retrieving_headers and self.network.blockchain.retrieving_headers:
alert.info("Running the wallet for the first time...this may take a moment.")
self.printed_retrieving_headers = True
return False return False
start_check.stop() start_check.stop()
if self.network.is_connected(): if self.network.is_connected():
alert.info("Wallet started.")
network_start_d.callback(True) network_start_d.callback(True)
else: else:
network_start_d.errback(ValueError("Failed to connect to network.")) network_start_d.errback(ValueError("Failed to connect to network."))
@ -917,7 +923,9 @@ class LBRYumWallet(LBRYWallet):
return d return d
def get_block(self, blockhash): def get_block(self, blockhash):
return defer.fail(NotImplementedError()) cmd = known_commands['getblock']
func = getattr(self.cmd_runner, cmd.name)
return threads.deferToThread(func, blockhash)
def get_most_recent_blocktime(self): def get_most_recent_blocktime(self):
header = self.network.get_header(self.network.get_local_height()) header = self.network.get_header(self.network.get_local_height())
@ -930,7 +938,9 @@ class LBRYumWallet(LBRYWallet):
return d return d
def get_name_claims(self): def get_name_claims(self):
return defer.fail(NotImplementedError()) cmd = known_commands['getnameclaims']
func = getattr(self.cmd_runner, cmd.name)
return threads.deferToThread(func)
def check_first_run(self): def check_first_run(self):
return defer.succeed(self.first_run) return defer.succeed(self.first_run)
@ -941,13 +951,38 @@ class LBRYumWallet(LBRYWallet):
return threads.deferToThread(func, txid) return threads.deferToThread(func, txid)
def _send_name_claim(self, name, val, amount): def _send_name_claim(self, name, val, amount):
return defer.fail(NotImplementedError()) def send_claim(address):
cmd = known_commands['claimname']
func = getattr(self.cmd_runner, cmd.name)
return threads.deferToThread(func, address, amount, name, val)
d = self.get_new_address()
d.addCallback(send_claim)
d.addCallback(self._broadcast_transaction)
return d
def _get_decoded_tx(self, raw_tx): def _get_decoded_tx(self, raw_tx):
return defer.fail(NotImplementedError()) tx = Transaction(raw_tx)
decoded_tx = {}
decoded_tx['vout'] = []
for output in tx.outputs():
out = {}
out['value'] = output[2]
decoded_tx['vout'].append(out)
return decoded_tx
def _send_abandon(self, txid, address, amount): def _send_abandon(self, txid, address, amount):
return defer.fail(NotImplementedError()) cmd = known_commands['abandonclaim']
func = getattr(self.cmd_runner, cmd.name)
d = threads.deferToThread(func, txid, address, amount)
d.addCallback(self._broadcast_transaction)
return d
def _broadcast_transaction(self, raw_tx):
cmd = known_commands['broadcast']
func = getattr(self.cmd_runner, cmd.name)
d = threads.deferToThread(func, raw_tx)
d.addCallback(self._save_wallet)
return d
def _do_send_many(self, payments_to_send): def _do_send_many(self, payments_to_send):
log.warning("Doing send many. payments to send: %s", str(payments_to_send)) log.warning("Doing send many. payments to send: %s", str(payments_to_send))
@ -970,6 +1005,11 @@ class LBRYumWallet(LBRYWallet):
def _get_balance_for_address(self, address): def _get_balance_for_address(self, address):
return defer.succeed(Decimal(self.wallet.get_addr_received(address))/COIN) return defer.succeed(Decimal(self.wallet.get_addr_received(address))/COIN)
def get_nametrie(self):
cmd = known_commands['getclaimtrie']
func = getattr(self.cmd_runner, cmd.name)
return threads.deferToThread(func)
def _save_wallet(self, val): def _save_wallet(self, val):
d = threads.deferToThread(self.wallet.storage.write) d = threads.deferToThread(self.wallet.storage.write)
d.addCallback(lambda _: val) d.addCallback(lambda _: val)

View file

@ -96,8 +96,9 @@ class CryptStreamDownloader(object):
self.starting = True self.starting = True
self.completed = False self.completed = False
self.finished_deferred = defer.Deferred() self.finished_deferred = defer.Deferred()
fd = self.finished_deferred
d = self._start() d = self._start()
d.addCallback(lambda _: self.finished_deferred) d.addCallback(lambda _: fd)
return d return d
def stop(self, err=None): def stop(self, err=None):

View file

@ -99,7 +99,10 @@ class Bencode(Encoding):
""" """
if len(data) == 0: if len(data) == 0:
raise DecodeError, 'Cannot decode empty string' raise DecodeError, 'Cannot decode empty string'
return self._decodeRecursive(data)[0] try:
return self._decodeRecursive(data)[0]
except ValueError as e:
raise DecodeError, e.message
@staticmethod @staticmethod
def _decodeRecursive(data, startIndex=0): def _decodeRecursive(data, startIndex=0):

View file

@ -0,0 +1,108 @@
import rumps
import xmlrpclib
import os
import webbrowser
import subprocess
import argparse
class DaemonStatusBarApp(rumps.App):
def __init__(self):
icon_path = 'app.icns'
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.timer(1)
def alert_daemon_start(self):
daemon = xmlrpclib.ServerProxy("http://localhost:7080/")
try:
start_msg = daemon.is_running()
if isinstance(start_msg, str):
rumps.notification(title='LBRY', subtitle='', message=str(start_msg), sound=True)
update_info = daemon.check_for_new_version()
update_msg = ""
for p in update_info:
if not p[0]:
update_msg += p[1] + "\n"
if update_msg:
update_msg += "\n Try running the installer again to fix this"
rumps.notification(title='LBRY', subtitle='', message=update_msg, sound=True)
except:
pass
@rumps.clicked('Open')
def get_ui(self):
daemon = xmlrpclib.ServerProxy("http://localhost:7080/")
try:
daemon.is_running()
webbrowser.open("lbry://lbry")
except:
try:
rumps.notification(title='LBRY', subtitle='', 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):
daemon = xmlrpclib.ServerProxy("http://localhost:7080/")
try:
daemon.is_running()
webbrowser.open("lbry://settings")
except:
rumps.notification(title='LBRY', subtitle='', 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()
r = round(float(balance), 2)
try:
rumps.notification(title='LBRY', subtitle='', message=str("Your balance is %.2f LBC" % r), sound=False)
except:
rumps.alert(title='LBRY', message=str("Your balance is %.2f LBC" % r))
except:
try:
rumps.notification(title='LBRY', subtitle='', 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):
daemon = xmlrpclib.ServerProxy("http://localhost:7080/")
try:
daemon.stop()
except:
pass
rumps.quit_application()
def main():
parser = argparse.ArgumentParser(description="Launch lbrynet status bar application")
parser.add_argument("--startdaemon",
help="true or false, default true",
type=str,
default="true")
args = parser.parse_args()
if str(args.startdaemon).lower() == "true":
daemon = xmlrpclib.ServerProxy('http://localhost:7080')
try:
daemon.is_running()
except:
subprocess.Popen("screen -dmS lbrynet bash -c "
"'PYTHONPATH=$PYTHONPATH:`cat /Users/${USER}/Library/Application\ Support/lbrynet/.python_path`; "
"PATH=$PATH:`cat /Users/${USER}/Library/Application\ Support/lbrynet/.lbry_bin_path`; "
"lbrynet-daemon --update=False'", shell=True)
status_app = DaemonStatusBarApp()
status_app.run()
if __name__ == '__main__':
main()

View file

@ -0,0 +1,52 @@
import os
import json
import webbrowser
import xmlrpclib, sys
def render_video(path):
r = r'<center><video src="' + path + r'" controls autoplay width="960" height="720"></center>'
return r
def main(args):
if len(args) == 0:
args.append('lbry://wonderfullife')
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:])
path = r['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.open('file://' + str(path))
except:
webbrowser.open('http://lbry.io/get')
if __name__ == "__main__":
main(sys.argv[1:])

View file

View file

@ -1,19 +0,0 @@
import xmlrpclib
def main():
daemon = xmlrpclib.ServerProxy("http://localhost:7080/")
try:
b = daemon.get_balance()
is_running = True
except:
is_running = False
if is_running:
daemon.stop()
print "LBRYnet daemon stopped"
else:
print "LBRYnet daemon wasn't running"
if __name__ == '__main__':
main()

View file

@ -1,15 +0,0 @@
import rumps
import xmlrpclib
import os
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"]
@rumps.clicked('Quit')
def clean_quit(self):
d = xmlrpclib.ServerProxy('http://localhost:7080')
d.stop()
rumps.quit_application()

View file

@ -1,59 +0,0 @@
import os
import json
import webbrowser
import xmlrpclib, sys
def render_video(path):
r = r'<center><video src="' + path + r'" controls autoplay width="960" height="720"></center>'
return r
def main(args):
if len(args) == 0:
args.append('lbry://wonderfullife')
daemon = xmlrpclib.ServerProxy('http://localhost:7080/')
try:
balance = daemon.get_balance()
is_running = True
if len(args) > 1:
print 'Too many args', args
elif is_running:
if args[0][7:] == 'lbry':
daemon.render_gui()
elif args[0][7:] == 'settings':
r = daemon.get_settings()
html = "<body>" + json.dumps(r) + "</body>"
r = daemon.render_html(html)
else:
if float(balance) > 0.0:
r = daemon.get(args[0][7:])
print r
path = r['path']
if path[0] != '/':
path = '/' + path
print path
filename = path.split('/')[len(path.split('/')) - 1]
extension = path.split('.')[len(path.split('.')) - 1]
if extension in ['mp4', 'flv', 'mov']:
html = render_video(path)
daemon.render_html(html)
else:
webbrowser.open('file://' + str(path))
except:
webbrowser.open('http://lbry.io/get')
is_running = False
if __name__ == "__main__":
main(sys.argv[1:])

View file

@ -1,117 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>LBRYURIHandler</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeOSTypes</key>
<array>
<string>****</string>
<string>fold</string>
<string>disk</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>LBRYURIHandler</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>LBRYURIHandler</string>
<key>CFBundleURLSchemes</key>
<array>
<string>lbry</string>
</array>
</dict>
</array>
<key>NSUIElement</key>
<true/>
<key>CFBundleIconFile</key>
<string>PythonApplet.icns</string>
<key>CFBundleIdentifier</key>
<string>org.pythonmac.unspecified.LBRYURIHandler</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>LBRYURIHandler</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0.0.0</string>
<key>LSHasLocalizedDisplayName</key>
<false/>
<key>NSAppleScriptEnabled</key>
<false/>
<key>NSHumanReadableCopyright</key>
<string>Copyright not specified</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>PyMainFileNames</key>
<array>
<string>__boot__</string>
</array>
<key>PyOptions</key>
<dict>
<key>alias</key>
<false/>
<key>argv_emulation</key>
<true/>
<key>emulate_shell_environment</key>
<false/>
<key>no_chdir</key>
<false/>
<key>prefer_ppc</key>
<false/>
<key>site_packages</key>
<false/>
<key>use_faulthandler</key>
<false/>
<key>use_pythonpath</key>
<false/>
<key>verbose</key>
<false/>
</dict>
<key>PyResourcePackages</key>
<array>
</array>
<key>PyRuntimeLocations</key>
<array>
<string>@executable_path/../Frameworks/Python.framework/Versions/2.7/Python</string>
</array>
<key>PythonInfoDict</key>
<dict>
<key>PythonExecutable</key>
<string>/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python</string>
<key>PythonLongVersion</key>
<string>2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]</string>
<key>PythonShortVersion</key>
<string>2.7</string>
<key>py2app</key>
<dict>
<key>alias</key>
<false/>
<key>template</key>
<string>app</string>
<key>version</key>
<string>0.9</string>
</dict>
</dict>
</dict>
</plist>

View file

@ -1,19 +0,0 @@
"""
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app
"""
from setuptools import setup
APP = ['LBRYURIHandler.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
echo "Restarting lbrynet-daemon" echo "Restarting lbrynet-daemon"
sudo lbrynet-daemon lbrynet-daemon

View file

@ -59,7 +59,7 @@ else
fi fi
if ! python -c "import six; exit(0) if six.__version__ == '1.9.0' else exit(1)" &>/dev/null; then 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 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 tar xf six-1.9.0.tar.gz &>/dev/null
cd six-1.9.0 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 fi
lbrynet_directory="/Users/${SUDO_USER}/Library/Application Support/lbrynet" 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) lbrynet_current_version=$(git ls-remote https://github.com/lbryio/lbry.git | grep HEAD | cut -f 1)
@ -86,12 +131,12 @@ if [ -d "$lbrynet_directory" ]; then
git clone --depth 1 https://github.com/lbryio/lbry.git &>/dev/null git clone --depth 1 https://github.com/lbryio/lbry.git &>/dev/null
cd lbry cd lbry
echo "Installing update" echo "Installing update..."
sudo python setup.py install &>/dev/null sudo python setup.py install &>/dev/null
mkdir -p "$lbrynet_directory" mkdir -p "$lbrynet_directory"
echo $lbrynet_current_version > "${lbrynet_directory}/lbrynet_version.txt" echo $lbrynet_current_version > "${lbrynet_directory}/lbrynet_version.txt"
echo "Cleaning up" echo "Cleaning up..."
cd ../../ cd ../../
rm -rf $tmp rm -rf $tmp
@ -100,63 +145,17 @@ if [ -d "$lbrynet_directory" ]; then
tmp=$(mktemp -d) tmp=$(mktemp -d)
cd $tmp cd $tmp
echo "Downloading LBRYnet update" echo "Downloading LBRYnet..."
git clone --depth 1 https://github.com/lbryio/lbry.git &>/dev/null git clone --depth 1 https://github.com/lbryio/lbry.git &>/dev/null
cd lbry cd lbry
echo "Installing update" echo "Installing..."
sudo python setup.py install &>/dev/null sudo python setup.py install &>/dev/null
mkdir -p "$lbrynet_directory" mkdir -p "$lbrynet_directory"
echo $lbrynet_current_version > "${lbrynet_directory}/lbrynet_version.txt" echo $lbrynet_current_version > "${lbrynet_directory}/lbrynet_version.txt"
echo "Cleaning up" 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"
cd ../../ cd ../../
rm -rf $tmp rm -rf $tmp

View file

@ -2,29 +2,31 @@
import ez_setup import ez_setup
ez_setup.use_setuptools() ez_setup.use_setuptools()
from setuptools import setup, find_packages 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.LBRYDaemon:stop']
if sys.platform == 'darwin':
console_scripts.append('lbrynet-daemon-status = lbrynet.lbrynet_daemon.LBRYOSXStatusBar:main')
setup(name='lbrynet', setup(name='lbrynet',
version='0.0.4', version='0.0.4',
packages=find_packages(), 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'], 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={ entry_points={'console_scripts': console_scripts},
'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',
]
},
data_files=[ data_files=[
('lbrynet/lbrynet_console/plugins', ('lbrynet/lbrynet_console/plugins',
[ [

22
setup_osx.py Normal file
View file

@ -0,0 +1,22 @@
import os
from setuptools import setup
APP = [os.path.join('lbrynet', 'lbrynet_daemon', 'Apps', 'LBRYOSXStatusBar.py')]
DATA_FILES = []
OPTIONS = {
'argv_emulation': True,
'iconfile': 'app.icns',
'plist': {
'LSUIElement': True,
},
'includes': ['rumps']
}
setup(
name='LBRY',
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)

22
setup_uri_handler.py Normal file
View file

@ -0,0 +1,22 @@
from setuptools import setup
import os
APP = [os.path.join('lbrynet', 'lbrynet_daemon', 'Apps', 'LBRYURIHandler.py')]
DATA_FILES = []
OPTIONS = {'argv_emulation': True,
'plist': {
'CFBundleURLTypes': [
{
'CFBundleURLTypes': 'LBRYURIHandler',
'CFBundleURLSchemes': ['lbry']
}
]
}
}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)

View file

@ -7,7 +7,7 @@ import os
import sys import sys
from cx_Freeze import setup, Executable from cx_Freeze import setup, Executable
import requests.certs
def find_data_file(filename): def find_data_file(filename):
if getattr(sys, 'frozen', False): if getattr(sys, 'frozen', False):
@ -48,9 +48,9 @@ bdist_msi_options = {
build_exe_options = { build_exe_options = {
'include_msvcr': True, 'include_msvcr': True,
'includes': [], 'includes': [],
'packages': ['os', 'twisted', 'miniupnpc', 'unqlite', 'seccure', 'packages': ['six', 'os', 'twisted', 'miniupnpc', 'unqlite', 'seccure',
'requests', 'bitcoinrpc', 'txjsonrpc', 'win32api', 'Crypto', 'requests', 'bitcoinrpc', 'txjsonrpc', 'win32api', 'Crypto',
'gmpy', 'yapsy'], 'gmpy', 'yapsy', 'lbryum', 'google.protobuf'],
'excludes': ['zope.interface._zope_interface_coptimizations'], 'excludes': ['zope.interface._zope_interface_coptimizations'],
'include_files': [os.path.join('lbrynet', 'lbrynet_gui', 'close.gif'), 'include_files': [os.path.join('lbrynet', 'lbrynet_gui', 'close.gif'),
os.path.join('lbrynet', 'lbrynet_gui', 'close1.png'), os.path.join('lbrynet', 'lbrynet_gui', 'close1.png'),
@ -63,6 +63,7 @@ build_exe_options = {
os.path.join('lbrynet', 'lbrynet_gui', 'show_options.gif'), os.path.join('lbrynet', 'lbrynet_gui', 'show_options.gif'),
os.path.join('lbrycrdd.exe'), # Not included in repo os.path.join('lbrycrdd.exe'), # Not included in repo
os.path.join('lbrycrd-cli.exe'), # Not included in repo os.path.join('lbrycrd-cli.exe'), # Not included in repo
(requests.certs.where(), 'cacert.pem'),
], ],
'namespace_packages': ['zope']} 'namespace_packages': ['zope']}

View file

@ -7,9 +7,8 @@ from slackclient import SlackClient
def get_conf(): def get_conf():
f = open('testbot.conf', 'r') f = open('testbot.conf', 'r')
token = f.readline().replace('\n', '') token = f.readline().replace('\n', '')
channel = f.readline().replace('\n', '')
f.close() f.close()
return token, channel return token
def test_lbrynet(lbry, slack, channel): def test_lbrynet(lbry, slack, channel):
logfile = open('lbrynet_test_log.txt', 'a') logfile = open('lbrynet_test_log.txt', 'a')
@ -48,10 +47,11 @@ def test_lbrynet(lbry, slack, channel):
lbry.delete_lbry_file('test.jpg') lbry.delete_lbry_file('test.jpg')
logfile.close() logfile.close()
token, channel = get_conf() token = get_conf()
sc = SlackClient(token) sc = SlackClient(token)
sc.rtm_connect() 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' print 'Connected to slack'
daemon = xmlrpclib.ServerProxy("http://localhost:7080") daemon = xmlrpclib.ServerProxy("http://localhost:7080")