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])
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}),

View file

@ -1,19 +1,19 @@
<?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>
<import addon="xbmc.python" version="2.14.0"/>
</requires>
<extension point="xbmc.python.pluginsource" library="addon.py">
<provides>executable</provides>
</extension>
<extension point="xbmc.service" library="service.py">
</extension>
<extension point="xbmc.addon.metadata">
<platform>linux</platform>
<summary lang="en">Run moonlight</summary>
<description lang="en">Run moonlight</description>
<license>GNU General Public License, v2</license>
<language></language>
<email>gustavobenn@hotmail.com</email>
</extension>
<import addon="xbmc.python" version="2.14.0"/>
</requires>
<extension point="xbmc.python.pluginsource" library="addon.py">
<provides>executable</provides>
</extension>
<extension point="xbmc.service" library="service.py">
</extension>
<extension point="xbmc.addon.metadata">
<platform>linux</platform>
<summary lang="en">Run moonlight</summary>
<description lang="en">Run moonlight</description>
<license>GNU General Public License, v2</license>
<language></language>
<email>gustavobenn@hotmail.com</email>
</extension>
</addon>

View file

@ -68,6 +68,8 @@ do
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"
fi