Fix code indentation and move keys to addon home.

This commit is contained in:
Gustavo 2016-02-17 14:21:45 -02:00
parent 984fb7e7b9
commit 2afdf031e9
3 changed files with 23 additions and 20 deletions

View file

@ -15,6 +15,7 @@ base_url = sys.argv[0]
addon_handle = int(sys.argv[1]) addon_handle = int(sys.argv[1])
args = urlparse.parse_qs(sys.argv[2][1:]) args = urlparse.parse_qs(sys.argv[2][1:])
addon = xbmcaddon.Addon() addon = xbmcaddon.Addon()
addon_base_path = xbmc.translatePath(addon.getAddonInfo('profile')).decode('utf-8')
xbmcplugin.setContent(addon_handle, "files") xbmcplugin.setContent(addon_handle, "files")
def build_url(query): def build_url(query):
@ -27,7 +28,7 @@ def index():
if address == "0.0.0.0": if address == "0.0.0.0":
address = gs.discover_server() 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 = xbmcgui.Dialog()
dialog.ok("Error", "Failed connect to server (%s)" % (address)) dialog.ok("Error", "Failed connect to server (%s)" % (address))
return return
@ -47,12 +48,12 @@ def index():
return return
for appId, name in gs.applist(): 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): if not os.path.exists(base_path):
os.makedirs(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): if not os.path.isfile(poster_path):
gs.poster(appId, base_path) gs.poster(appId, base_path)

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.moonlight" name="Moonlight" version="1.0.2" provider-name="dead"> <addon id="script.moonlight" name="Moonlight" version="1.0.3" provider-name="dead">
<requires> <requires>
<import addon="xbmc.python" version="2.14.0"/> <import addon="xbmc.python" version="2.14.0"/>
</requires> </requires>

View file

@ -68,6 +68,8 @@ do
MOONLIGHT_ARG="$MOONLIGHT_ARG -app \"${MOONLIGHT_APP}\"" MOONLIGHT_ARG="$MOONLIGHT_ARG -app \"${MOONLIGHT_APP}\""
fi fi
MOONLIGHT_ARG="$MOONLIGHT_ARG -keydir \"${ADDON_HOME}/keys\""
if [ "$MOON_SERVER_IP" != "0.0.0.0" ]; then if [ "$MOON_SERVER_IP" != "0.0.0.0" ]; then
MOONLIGHT_ARG="$MOONLIGHT_ARG $MOON_SERVER_IP" MOONLIGHT_ARG="$MOONLIGHT_ARG $MOON_SERVER_IP"
fi fi