From b3cf5e86982df373b2d1ad5575f3a54242fd2894 Mon Sep 17 00:00:00 2001 From: Jack Date: Thu, 24 Mar 2016 20:46:24 -0400 Subject: [PATCH] add bundle identifier to uri handler --- lbrynet/lbrynet_daemon/Apps/LBRYURIHandler.py | 18 +++++++++++++----- setup_uri_handler.py | 1 + 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lbrynet/lbrynet_daemon/Apps/LBRYURIHandler.py b/lbrynet/lbrynet_daemon/Apps/LBRYURIHandler.py index ba62a78a4..9bab2e2d8 100644 --- a/lbrynet/lbrynet_daemon/Apps/LBRYURIHandler.py +++ b/lbrynet/lbrynet_daemon/Apps/LBRYURIHandler.py @@ -1,16 +1,24 @@ import os import json import webbrowser -import sys -from time import sleep import subprocess +import sys +from time import sleep from jsonrpc.proxy import JSONRPCProxy API_CONNECTION_STRING = "http://localhost:5279/lbryapi" UI_ADDRESS = "http://localhost:5279" +class Timeout(Exception): + def __init__(self, value): + self.parameter = value + + def __str__(self): + return repr(self.parameter) + + class LBRYURIHandler(object): def __init__(self): self.started_daemon = False @@ -28,18 +36,18 @@ class LBRYURIHandler(object): elif status: return True else: - exit(1) + raise Timeout("LBRY daemon is running, but connection timed out") except: if self.start_timeout < 30: sleep(1) self.start_timeout += 1 self.check_status() else: - exit(1) + raise Timeout("Timed out trying to start LBRY daemon") 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] + if 'LBRY.app' in d and 'LBRYURIHandler' not in d] try: status = json.loads(self.daemon.is_running())['result'] except: diff --git a/setup_uri_handler.py b/setup_uri_handler.py index 1a3c68700..e9ba6749c 100644 --- a/setup_uri_handler.py +++ b/setup_uri_handler.py @@ -7,6 +7,7 @@ OPTIONS = {'argv_emulation': True, 'packages': ['jsonrpc'], 'plist': { 'LSUIElement': True, + 'CFBundleIdentifier': 'io.lbry.LBRYURIHandler', 'CFBundleURLTypes': [ { 'CFBundleURLTypes': 'LBRYURIHandler',