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,16 +48,16 @@ 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)
xbmc.sleep(100) xbmc.sleep(100)
xbmcplugin.addDirectoryItem(handle=addon_handle, xbmcplugin.addDirectoryItem(handle=addon_handle,
url=build_url({"mode": "stream", "app": name}), url=build_url({"mode": "stream", "app": name}),

View file

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

View file

@ -67,6 +67,8 @@ do
if [ "$MOONLIGHT_APP" != "" ]; then if [ "$MOONLIGHT_APP" != "" ]; then
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"