Skip to content

Commit

Permalink
Merge pull request #24 from lbryio/development
Browse files Browse the repository at this point in the history
fix daemon directories for linux
  • Loading branch information
Jack Robison committed Mar 28, 2016
2 parents c99d7ce + 200d239 commit f4fd424
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 19 deletions.
4 changes: 2 additions & 2 deletions lbrynet/lbrynet_daemon/Apps/LBRYURIHandler.py
Expand Up @@ -51,9 +51,9 @@ def handle(self, lbry_name):
try:
status = json.loads(self.daemon.is_running())['result']
except:
pass
status = None

if lbry_process:
if lbry_process or status:
self.check_status()
started = False
else:
Expand Down
13 changes: 9 additions & 4 deletions lbrynet/lbrynet_daemon/LBRYDaemon.py
Expand Up @@ -121,11 +121,16 @@ def _set_vars(wallet_type, check_for_updates):
self.wallet_dir = os.path.join(get_path(FOLDERID.RoamingAppData, UserHandle.current), "lbrycrd")
elif sys.platform == "darwin":
self.download_directory = os.path.join(os.path.expanduser("~"), 'Downloads')
# self.wallet_dir = os.path.join(os.path.expanduser("~"), "Library/Application Support/lbrycrd")
self.wallet_dir = user_data_dir("LBRY")
if wallet_type == "lbrycrd":
self.wallet_dir = user_data_dir("lbrycrd")
else:
self.wallet_dir = user_data_dir("LBRY")
else:
self.wallet_dir = os.path.join(os.path.expanduser("~"), ".lbrycrd")
self.download_directory = os.path.join(os.path.expanduser("~"), 'Downloads')
if wallet_type == "lbrycrd":
self.wallet_dir = os.path.join(os.path.expanduser("~"), ".lbrycrd")
else:
self.wallet_dir = os.path.join(os.path.expanduser("~"), ".lbryum")
self.download_directory = os.getcwd()
self.daemon_conf = os.path.join(self.wallet_dir, 'daemon_settings.conf')
self.wallet_conf = os.path.join(self.wallet_dir, "lbrycrd.conf")
self.wallet_user = None
Expand Down
38 changes: 25 additions & 13 deletions lbrynet/lbrynet_daemon/LBRYDaemonControl.py
Expand Up @@ -42,29 +42,41 @@ def start():
help="True or false, default true",
type=str,
default="True")
parser.add_argument("--ui",
help="temp or path, default temp, path is the path of the dist folder",
default="temp")

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()
download_ui = True

if args.ui != "temp" and os.path.isdir(args.ui):
download_ui = False
ui_dir = args.ui
log.info("Using user specified UI directory: " + str(ui_dir))

if args.ui == "temp" or download_ui:
log.info("Downloading current web ui to temp directory")
ui_dir = tempfile.mkdtemp()
url = urlopen("https://rawgit.com/lbryio/lbry-web-ui/master/dist.zip")
z = ZipFile(StringIO(url.read()))
z.extractall(ui_dir)

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 = LBRYindex(ui_dir)
root.putChild("css", static.File(os.path.join(ui_dir, "css")))
root.putChild("font", static.File(os.path.join(ui_dir, "font")))
root.putChild("img", static.File(os.path.join(ui_dir, "img")))
root.putChild("js", static.File(os.path.join(ui_dir, "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.listenTCP(API_PORT, server.Site(root), interface=API_INTERFACE)
reactor.run()

shutil.rmtree(tmpdir)

if download_ui:
shutil.rmtree(ui_dir)

0 comments on commit f4fd424

Please sign in to comment.