From 2afdf031e9c8a37be0dc46395e931922ad024751 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Wed, 17 Feb 2016 14:21:45 -0200 Subject: [PATCH] Fix code indentation and move keys to addon home. --- script.moonlight/addon.py | 9 +++++---- script.moonlight/addon.xml | 32 ++++++++++++++++---------------- script.moonlight/bin/service.sh | 2 ++ 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/script.moonlight/addon.py b/script.moonlight/addon.py index 9f460ac..a0e7f79 100644 --- a/script.moonlight/addon.py +++ b/script.moonlight/addon.py @@ -15,6 +15,7 @@ base_url = sys.argv[0] addon_handle = int(sys.argv[1]) args = urlparse.parse_qs(sys.argv[2][1:]) addon = xbmcaddon.Addon() +addon_base_path = xbmc.translatePath(addon.getAddonInfo('profile')).decode('utf-8') xbmcplugin.setContent(addon_handle, "files") def build_url(query): @@ -27,7 +28,7 @@ def index(): if address == "0.0.0.0": address = gs.discover_server() - if not gs.connect_server(address): + if not gs.connect_server(address, os.path.join(addon_base_path, "keys")): dialog = xbmcgui.Dialog() dialog.ok("Error", "Failed connect to server (%s)" % (address)) return @@ -47,16 +48,16 @@ def index(): return for appId, name in gs.applist(): - base_path = xbmc.translatePath(addon.getAddonInfo('profile')).decode('utf-8') + "/images" + base_path = os.path.join(addon_base_path, "images") if not os.path.exists(base_path): os.makedirs(base_path) - poster_path = base_path + "/" + str(appId) + ".png" + poster_path = os.path.join(base_path, str(appId) + ".png") if not os.path.isfile(poster_path): gs.poster(appId, base_path) - xbmc.sleep(100) + xbmc.sleep(100) xbmcplugin.addDirectoryItem(handle=addon_handle, url=build_url({"mode": "stream", "app": name}), diff --git a/script.moonlight/addon.xml b/script.moonlight/addon.xml index 179b06d..fab8685 100644 --- a/script.moonlight/addon.xml +++ b/script.moonlight/addon.xml @@ -1,19 +1,19 @@  - + - - - - executable - - - - - linux - Run moonlight - Run moonlight - GNU General Public License, v2 - - gustavobenn@hotmail.com - + + + + executable + + + + + linux + Run moonlight + Run moonlight + GNU General Public License, v2 + + gustavobenn@hotmail.com + \ No newline at end of file diff --git a/script.moonlight/bin/service.sh b/script.moonlight/bin/service.sh index 33c6b9d..c0de7b7 100644 --- a/script.moonlight/bin/service.sh +++ b/script.moonlight/bin/service.sh @@ -67,6 +67,8 @@ do if [ "$MOONLIGHT_APP" != "" ]; then MOONLIGHT_ARG="$MOONLIGHT_ARG -app \"${MOONLIGHT_APP}\"" fi + + MOONLIGHT_ARG="$MOONLIGHT_ARG -keydir \"${ADDON_HOME}/keys\"" if [ "$MOON_SERVER_IP" != "0.0.0.0" ]; then MOONLIGHT_ARG="$MOONLIGHT_ARG $MOON_SERVER_IP"