enable setting lbrycrdd path in gui conf, disable launching lbrycrdd by default in linux gui, change running instructions, put linux gui conf in users home directory

This commit is contained in:
Jimmy Kiselak 2015-10-02 16:38:57 -04:00
parent f2867542b1
commit 964db2a779
5 changed files with 142 additions and 67 deletions

121
RUNNING
View file

@ -1,52 +1,97 @@
To install LBRYnet and lbrynet-console, see INSTALL How to watch It's a Wonderful Life via LBRY
lbrynet-console is a console application which makes use of the LBRYnet to share files. Quickest quick guide
--------------------
In particular, lbrynet-console splits files into encrypted chunks of data compatible with Create a directory called lbry, and go into that directory
LBRYnet, groups all metadata into a 'stream descriptor file' which can be sent directly to Download the file https://raw.githubusercontent.com/lbryio/lbry-setup/master/lbry_setup.sh and run it in that directory
others wishing to obtain the file, or can be itself turned into a chunk compatible with Once it's done building, type:
LBRYnet and downloaded via LBRYnet by anyone knowing its sha384 hashsum. lbrynet-console ./lbrycrd/src/lbrycrdd -server -daemon -gen
also acts as a client whichreads a stream descriptor file, downloads the chunks of data lbrynet-gui
specified by the hash sums found in the stream descriptor file, decrypts them according to A window should show up with an entry box
metadata found in the stream, and reconstructs the original file. lbrynet-console features Type wonderfullife into the box, hit go, and choose to stream or save
a server so that clients can connect to it and download the chunks and other data gotten To stop lbrycrdd:
from files created locally and files that have been downloaded from LBRYnet. ./lbrycrd/src/lbrycrd-cli stop
lbrynet-console also has a plugin system. There are two plugins: a live stream proof of Slightly longer install guide
concept which is currently far behind the development of the rest of the application and -----------------------------
therefore will not run, and a plugin which attempts to determine which chunks on the
network should be downloaded in order for the application to turn a profit. It will run,
but its usefulness is extremely limited.
Passing '--help' to lbrynet-console will cause it to print out a quick help message Acquire the LBRYcrd source code from https://github.com/lbryio/lbrycrd
describing other command line options to the application. cd lbrycrd
sudo apt-get install build-essential libtool autotools-dev autoconf pkg-config libssl-dev libboost-all-dev libdb-dev libdb++-dev libqt4-dev libprotobuf-dev protobuf-compiler
./autogen.sh
./configure --with-incompatible-bdb
make
Once the application has been started, the user is presented with a numbered list of When make has completed, create the directory where LBRYcrd data will be stored. ~/.lbrycrd is where LBRYcrd will look by default and so is recommended.
actions which looks something like this: mkdir ~/.lbrycrd
vim ~/.lbrycrd/lbrycrd.conf
Add the following lines to enable the RPC interface, which will be used by lbrynet-console.
... rpcuser=rpcuser
[2] Toggle whether an LBRY File is running rpcpassword=rpcpassword
[3] Create an LBRY File from file
[4] Publish a stream descriptor file to the DHT for an LBRY File
...
To perform an action, type the desired number and then hit enter. For example, if you wish (use a long random password if your computer is on a network anyone else has access to)
to create an LBRY file from a file as described in the beginning of this document, type 3 and
hit enter.
If the application needs more input in order to for the action to be taken, the application cd ..
will continue to print prompts for input until it has received what it needs.
For example, when creating an LBRY file from a file, the application needs to know which file Acquire the LBRYnet source code from https://github.com/lbryio/lbry
it's supposed to use to create the LBRY file, so the user will be prompted for it: cd lbry
sudo apt-get install libgmp3-dev build-essential python-dev python-pip
File name: (with virtualenv)
python-virtualenv
virtualenv .
source bin/activate
python setup.py install
The user should input the desired file name and hit enter, at which point the application to deactivate the virtualenv later:
will go about splitting the file and making it available on the network. deactivate
Some actions will produce sub-menus of actions, which work the same way. to reactivate it, go to the directory in which you created it and:
source bin/activate
A more detailed user guide is available at doc.lbry.io (without virtualenv)
python setup.py build bdist_egg
sudo python setup.py install
Any issues may be reported to jimmy@lbry.io Slightly longer running guide
-----------------------------
In order to use lbrynet, lbyrcrdd must be running.
If you ran the easy install script, the lbrycrd folder will be in the directory you ran lbry_setup.sh from. Otherwise it is the root of the cloned lbrycrd repository. Go to that directory.
./src/lbrycrdd -server -daemon -gen
It will take a few minutes for your client to download the whole block chain.
Once it has caught up, it will start mining coins. If you don't want to mine, leave off the '-gen' flag.
lbrycrdd must be running in order for lbrynet to function.
To shut lbrycrdd down: from the lbrycrd directory, run
./src/lbrycrd-cli stop
Running lbrynet-console
In your terminal:
lbrynet-console
You should now be presented with a list of options.
Watch It's a Wonderful Life via LBRY
Choose the option labeled Add a stream from a short name by typing the number next to it and pressing the enter key.
You will be prompted for a name. Type in "wonderfullife" and hit enter.
After a few seconds, you will prompted to choose what you want to do with the file.
Select the option labeled Open the file with VLC media player.
You will be shown some options related to the file which you do not care about. Type 'n' and hit enter.
You will be prompted to choose if you really want to download this file. Type 'y' and hit enter.
To shut it down, type ctrl-c at any time or enter the option to shut down from the main menu.
Running lbrynet-gui
In your terminal:
lbrynet-gui
A window should pop up with an entry box. Type 'wonderfullife' into the box, hit go, and then choose to save it or stream it.
Enjoy!
Any questions or problems, email jimmy@lbry.io

View file

@ -39,8 +39,8 @@ class LBRYcrdWallet(object):
"""This class implements the LBRYWallet interface for the LBRYcrd payment system""" """This class implements the LBRYWallet interface for the LBRYcrd payment system"""
implements(ILBRYWallet) implements(ILBRYWallet)
def __init__(self, rpc_user, rpc_pass, rpc_url, rpc_port, start_lbrycrdd=False, def __init__(self, rpc_user, rpc_pass, rpc_url, rpc_port, wallet_dir=None, wallet_conf=None,
wallet_dir=None, wallet_conf=None): lbrycrdd_path=None):
self.rpc_conn_string = "http://%s:%s@%s:%s" % (rpc_user, rpc_pass, rpc_url, str(rpc_port)) self.rpc_conn_string = "http://%s:%s@%s:%s" % (rpc_user, rpc_pass, rpc_url, str(rpc_port))
self.next_manage_call = None self.next_manage_call = None
self.wallet_balance = Decimal(0.0) self.wallet_balance = Decimal(0.0)
@ -53,17 +53,17 @@ class LBRYcrdWallet(object):
# incremental_amount(float)) # incremental_amount(float))
self.max_expected_payment_time = datetime.timedelta(minutes=3) self.max_expected_payment_time = datetime.timedelta(minutes=3)
self.stopped = True self.stopped = True
self.start_lbrycrdd = start_lbrycrdd
self.started_lbrycrdd = False self.started_lbrycrdd = False
self.wallet_dir = wallet_dir self.wallet_dir = wallet_dir
self.wallet_conf = wallet_conf self.wallet_conf = wallet_conf
self.lbrycrdd = None self.lbrycrdd = None
self.manage_running = False self.manage_running = False
self.lbrycrdd_path = lbrycrdd_path
def start(self): def start(self):
def make_connection(): def make_connection():
if self.start_lbrycrdd is True: if self.lbrycrdd_path is not None:
self._start_daemon() self._start_daemon()
self._get_info() self._get_info()
log.info("Connected!") log.info("Connected!")
@ -91,7 +91,7 @@ class LBRYcrdWallet(object):
d = self.manage() d = self.manage()
d.addErrback(log_stop_error) d.addErrback(log_stop_error)
if self.start_lbrycrdd is True: if self.lbrycrdd_path is not None:
d.addCallback(lambda _: self._stop_daemon()) d.addCallback(lambda _: self._stop_daemon())
d.addErrback(log_stop_error) d.addErrback(log_stop_error)
return d return d
@ -296,16 +296,21 @@ class LBRYcrdWallet(object):
def _start_daemon(self): def _start_daemon(self):
try:
if os.name == "nt": if os.name == "nt":
si = subprocess.STARTUPINFO si = subprocess.STARTUPINFO
si.dwFlags = subprocess.STARTF_USESHOWWINDOW si.dwFlags = subprocess.STARTF_USESHOWWINDOW
si.wShowWindow = subprocess.SW_HIDE si.wShowWindow = subprocess.SW_HIDE
self.lbrycrdd = subprocess.Popen(["lbrycrdd.exe", "-datadir=%s" % self.wallet_dir, self.lbrycrdd = subprocess.Popen([self.lbrycrdd_path, "-datadir=%s" % self.wallet_dir,
"-conf=%s" % self.wallet_conf], startupinfo=si) "-conf=%s" % self.wallet_conf], startupinfo=si)
else: else:
self.lbrycrdd = subprocess.Popen(["./lbrycrdd", "-datadir=%s" % self.wallet_dir, self.lbrycrdd = subprocess.Popen([self.lbrycrdd_path, "-datadir=%s" % self.wallet_dir,
"-conf=%s" % self.wallet_conf]) "-conf=%s" % self.wallet_conf])
self.started_lbrycrdd = True self.started_lbrycrdd = True
except OSError:
import traceback
log.error("Couldn't launch lbrycrdd at path %s: %s", self.lbrycrdd_path, traceback.format_exc())
raise ValueError("Couldn't launch lbrycrdd. Tried %s" % self.lbrycrdd_path)
tries = 0 tries = 0
while tries < 5: while tries < 5:

View file

@ -19,6 +19,7 @@ from lbrynet.lbryfile.client.LBRYFileDownloader import LBRYFileSaverFactory, LBR
from lbrynet.lbryfile.client.LBRYFileOptions import add_lbry_file_to_sd_identifier from lbrynet.lbryfile.client.LBRYFileOptions import add_lbry_file_to_sd_identifier
import os import os
import requests import requests
import shutil
from twisted.internet import threads, defer, task from twisted.internet import threads, defer, task
@ -51,7 +52,12 @@ class LBRYDownloader(object):
self.stream_frames = [] self.stream_frames = []
self.default_blob_data_payment_rate = MIN_BLOB_DATA_PAYMENT_RATE self.default_blob_data_payment_rate = MIN_BLOB_DATA_PAYMENT_RATE
self.use_upnp = False self.use_upnp = False
if os.name == "nt":
self.start_lbrycrdd = True self.start_lbrycrdd = True
self.lbrycrdd_path = "lbrycrdd.exe"
else:
self.start_lbrycrdd = False
self.lbrycrdd_path = "./lbrycrdd"
self.delete_blobs_on_remove = True self.delete_blobs_on_remove = True
self.blob_request_payment_rate_manager = None self.blob_request_payment_rate_manager = None
@ -111,14 +117,20 @@ class LBRYDownloader(object):
def _load_configuration_file(self): def _load_configuration_file(self):
def get_configuration(): def get_configuration():
if not os.path.exists("lbry.conf"): if os.name == "nt":
lbry_conf_path = "lbry.conf"
if not os.path.exists(lbry_conf_path):
log.debug("Could not read lbry.conf") log.debug("Could not read lbry.conf")
return "" return ""
else: else:
lbry_conf = open("lbry.conf") lbry_conf_path = os.path.join(os.path.expanduser("~"), ".lbrynetgui.conf")
log.debug("Loading configuration options from lbry.conf") if not os.path.exists(lbry_conf_path):
clean_conf_path = os.path.join(os.path.dirname(__file__), "lbry.conf")
shutil.copy(clean_conf_path, lbry_conf_path)
lbry_conf = open(lbry_conf_path)
log.debug("Loading configuration options from %s", lbry_conf_path)
lines = lbry_conf.readlines() lines = lbry_conf.readlines()
log.debug("lbry.conf file contents:\n%s", str(lines)) log.debug("%s file contents:\n%s", lbry_conf_path, str(lines))
return lines return lines
d = threads.deferToThread(get_configuration) d = threads.deferToThread(get_configuration)
@ -209,6 +221,8 @@ class LBRYDownloader(object):
raise ValueError("start_lbrycrdd must be set to True or False. Got %s" % field_value) raise ValueError("start_lbrycrdd must be set to True or False. Got %s" % field_value)
log.debug("Setting start_lbrycrdd to %s", str(start_lbrycrdd)) log.debug("Setting start_lbrycrdd to %s", str(start_lbrycrdd))
self.start_lbrycrdd = start_lbrycrdd self.start_lbrycrdd = start_lbrycrdd
elif field_name == "lbrycrdd_path":
self.lbrycrdd_path = field_value
elif field_name == "download_directory": elif field_name == "download_directory":
log.debug("Setting download_directory to %s", str(field_value)) log.debug("Setting download_directory to %s", str(field_value))
self.download_directory = field_value self.download_directory = field_value
@ -257,9 +271,12 @@ class LBRYDownloader(object):
self.wallet_rpc_port = int(l[8:-1]) self.wallet_rpc_port = int(l[8:-1])
def _get_session(self): def _get_session(self):
wallet = LBRYcrdWallet(self.wallet_user, self.wallet_password, "127.0.0.1", self.wallet_rpc_port, lbrycrdd_path = None
start_lbrycrdd=self.start_lbrycrdd, wallet_dir=self.wallet_dir, if self.start_lbrycrdd is True:
wallet_conf=self.wallet_conf) lbrycrdd_path = self.lbrycrdd_path
wallet = LBRYcrdWallet(self.wallet_user, self.wallet_password, "127.0.0.1",
self.wallet_rpc_port, wallet_dir=self.wallet_dir,
wallet_conf=self.wallet_conf, lbrycrdd_path=lbrycrdd_path)
peer_port = None peer_port = None
if self.run_server: if self.run_server:
peer_port = self.peer_port peer_port = self.peer_port

View file

@ -30,15 +30,22 @@
# Turn on or off the server, which uploads encrypted chunks of data # Turn on or off the server, which uploads encrypted chunks of data
# to other clients on the network. # to other clients on the network.
# #
# run_server = true # run_server = True
# ===== start_lbrycrdd ===== # ===== start_lbrycrdd =====
# Whether to launch an lbyrcrdd server to use to send and receive # Whether to launch an lbyrcrdd server to use to send and receive
# LBC and to look up names regisered on the LBRYcrd network. # LBC and to look up names regisered on the LBRYcrd network.
# Defaults to True on Windows and False on Linux.
# #
# start_lbrycrdd = True # start_lbrycrdd = True/False
# ===== lbrycrdd_path =====
# If start_lbrycrdd is set to True, the path the application will
# use to try to run lbrycrdd. On Windows, the default path will
# be "lbrycrdd.exe". On Linux, the default path will be "./lbrycrdd".
#
# lbrycrdd_path = /path/to/lbrycrdd
# ===== wallet_dir ===== # ===== wallet_dir =====
# The directory which the lbrycrdd instance will be given as the # The directory which the lbrycrdd instance will be given as the

View file

@ -38,6 +38,7 @@ setup(name='lbrynet',
'lbrynet/lbrynet_gui/drop_down.gif', 'lbrynet/lbrynet_gui/drop_down.gif',
'lbrynet/lbrynet_gui/show_options.gif', 'lbrynet/lbrynet_gui/show_options.gif',
'lbrynet/lbrynet_gui/hide_options.gif', 'lbrynet/lbrynet_gui/hide_options.gif',
'lbrynet/lbrynet_gui/lbry.conf',
] ]
) )
] ]