diff --git a/lbrynet/lbrynet_daemon/LBRYOSXStatusBar.py b/lbrynet/lbrynet_daemon/Apps/LBRYOSXStatusBar.py similarity index 100% rename from lbrynet/lbrynet_daemon/LBRYOSXStatusBar.py rename to lbrynet/lbrynet_daemon/Apps/LBRYOSXStatusBar.py diff --git a/lbrynet/lbrynet_daemon/Apps/LBRYURIHandler.py b/lbrynet/lbrynet_daemon/Apps/LBRYURIHandler.py new file mode 100644 index 000000000..eea94cb94 --- /dev/null +++ b/lbrynet/lbrynet_daemon/Apps/LBRYURIHandler.py @@ -0,0 +1,52 @@ +import os +import json +import webbrowser +import xmlrpclib, sys + +def render_video(path): + r = r'
' + 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 = "" + json.dumps(r) + "" + 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:]) diff --git a/lbrynet/lbrynet_daemon/Apps/__init__.py b/lbrynet/lbrynet_daemon/Apps/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/lbrynet/lbrynet_daemon/LBRYDaemon.py b/lbrynet/lbrynet_daemon/LBRYDaemon.py index 71f2c5cc8..1e68f0f76 100644 --- a/lbrynet/lbrynet_daemon/LBRYDaemon.py +++ b/lbrynet/lbrynet_daemon/LBRYDaemon.py @@ -152,8 +152,8 @@ class LBRYDaemon(xmlrpc.XMLRPC): d.addCallback(lambda _: self._setup_lbry_file_opener()) d.addCallback(lambda _: self._setup_query_handlers()) d.addCallback(lambda _: self._setup_server()) - d.addCallback(lambda _: self._update() if self.check_for_updates == "True" and sys.platform == "darwin" - else defer.succeed(None)) + # d.addCallback(lambda _: self._update() if self.check_for_updates == "True" and sys.platform == "darwin" + # else defer.succeed(None)) d.addCallback(lambda _: self._setup_fetcher()) d.addCallback(lambda _: _disp_startup()) d.callback(None) diff --git a/lbrynet/lbrynet_daemon/LBRYURIHandler/LBRYURIHandler.py b/lbrynet/lbrynet_daemon/LBRYURIHandler/LBRYURIHandler.py deleted file mode 100644 index 62ded697b..000000000 --- a/lbrynet/lbrynet_daemon/LBRYURIHandler/LBRYURIHandler.py +++ /dev/null @@ -1,59 +0,0 @@ -import os -import json -import webbrowser -import xmlrpclib, sys - - -def render_video(path): - r = r'
' - 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 = "" + json.dumps(r) + "" - 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:]) diff --git a/lbrynet/lbrynet_daemon/LBRYURIHandler/dist/LBRYURIHandler.app/Contents/Info.plist b/lbrynet/lbrynet_daemon/LBRYURIHandler/dist/LBRYURIHandler.app/Contents/Info.plist deleted file mode 100644 index 4f5993ff1..000000000 --- a/lbrynet/lbrynet_daemon/LBRYURIHandler/dist/LBRYURIHandler.app/Contents/Info.plist +++ /dev/null @@ -1,117 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleDisplayName - LBRYURIHandler - CFBundleDocumentTypes - - - CFBundleTypeOSTypes - - **** - fold - disk - - CFBundleTypeRole - Viewer - - - CFBundleExecutable - LBRYURIHandler - -CFBundleURLTypes - - - CFBundleURLName - LBRYURIHandler - CFBundleURLSchemes - - lbry - - - -NSUIElement - - - CFBundleIconFile - PythonApplet.icns - CFBundleIdentifier - org.pythonmac.unspecified.LBRYURIHandler - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - LBRYURIHandler - CFBundlePackageType - APPL - CFBundleShortVersionString - 0.0.0 - CFBundleSignature - ???? - CFBundleVersion - 0.0.0 - LSHasLocalizedDisplayName - - NSAppleScriptEnabled - - NSHumanReadableCopyright - Copyright not specified - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - PyMainFileNames - - __boot__ - - PyOptions - - alias - - argv_emulation - - emulate_shell_environment - - no_chdir - - prefer_ppc - - site_packages - - use_faulthandler - - use_pythonpath - - verbose - - - PyResourcePackages - - - PyRuntimeLocations - - @executable_path/../Frameworks/Python.framework/Versions/2.7/Python - - PythonInfoDict - - PythonExecutable - /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python - PythonLongVersion - 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12) -[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] - PythonShortVersion - 2.7 - py2app - - alias - - template - app - version - 0.9 - - - - diff --git a/lbrynet/lbrynet_daemon/LBRYURIHandler/setup.py b/lbrynet/lbrynet_daemon/LBRYURIHandler/setup.py deleted file mode 100644 index fbb83f5dc..000000000 --- a/lbrynet/lbrynet_daemon/LBRYURIHandler/setup.py +++ /dev/null @@ -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'], -) diff --git a/setup_osx.py b/setup_osx.py index 03490e622..052b51235 100644 --- a/setup_osx.py +++ b/setup_osx.py @@ -1,7 +1,7 @@ import os from setuptools import setup -APP = [os.path.join('lbrynet', 'lbrynet_daemon', 'LBRYOSXStatusBar.py')] +APP = [os.path.join('lbrynet', 'lbrynet_daemon', 'Apps', 'LBRYOSXStatusBar.py')] DATA_FILES = [] OPTIONS = { 'argv_emulation': True, diff --git a/setup_uri_handler.py b/setup_uri_handler.py new file mode 100644 index 000000000..37a38826e --- /dev/null +++ b/setup_uri_handler.py @@ -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'], +) \ No newline at end of file