|
@@ -5,6 +5,7 @@ from consts import *
|
|
|
import datetime
|
|
|
import pprint
|
|
|
import copy
|
|
|
+import urllib
|
|
|
|
|
|
|
|
|
@PLUGIN.route("/empty/", name="empty", update=False, cache=True)
|
|
@@ -408,10 +409,7 @@ def play_episode(episode_id=0, ask_playlist=0):
|
|
|
|
|
|
# Main Episode
|
|
|
episode = episode_result["data"]
|
|
|
- path = "http://127.0.0.1:%s/play/%s/" % (play_port, episode["id"])
|
|
|
-
|
|
|
li = copy.copy(item)
|
|
|
- li["path"] = path
|
|
|
li["properties"] = {
|
|
|
"MovieID": unicode(episode["id"])
|
|
|
}
|
|
@@ -429,16 +427,14 @@ def play_episode(episode_id=0, ask_playlist=0):
|
|
|
else:
|
|
|
li["info"]["tagline"] = tagline
|
|
|
|
|
|
+ li["path"] = path = "http://127.0.0.1:%s/play/%s/%s.mkv" % (play_port, episode["id"], urllib.quote(li["label"]))
|
|
|
li = PLUGIN._listitemify(li).as_xbmc_listitem()
|
|
|
playlist.add(path, li)
|
|
|
|
|
|
# Playlist episodes
|
|
|
if "next_episodes" in episode_result["data"]:
|
|
|
for episode in episode_result["data"]["next_episodes"]:
|
|
|
- path = "http://127.0.0.1:%s/play/%s/" % (play_port, episode["id"])
|
|
|
-
|
|
|
li = copy.copy(item)
|
|
|
- li["path"] = path
|
|
|
li["properties"] = {
|
|
|
"MovieID": unicode(episode["id"])
|
|
|
}
|
|
@@ -456,9 +452,15 @@ def play_episode(episode_id=0, ask_playlist=0):
|
|
|
else:
|
|
|
li["info"]["tagline"] = tagline
|
|
|
|
|
|
+ li["path"] = path = "http://127.0.0.1:%s/play/%s/%s.mkv" % (play_port, episode["id"], urllib.quote(li["label"]))
|
|
|
li = PLUGIN._listitemify(li).as_xbmc_listitem()
|
|
|
playlist.add(path, li)
|
|
|
|
|
|
+ #ifdef DEBUG
|
|
|
+ for idx in range(playlist.size()):
|
|
|
+ output("[PLAY] %s - Item %s" % (idx, playlist[idx].getPath()))
|
|
|
+ #endif
|
|
|
+
|
|
|
first = playlist[0]
|
|
|
if first:
|
|
|
episode_id = first.getProperty("MovieID")
|
|
@@ -653,7 +655,7 @@ def account_logout():
|
|
|
return None
|
|
|
|
|
|
|
|
|
-@PLUGIN.route("/stop_playserver/", name="stop_playserver", cache=True)
|
|
|
+@PLUGIN.route("/stop_playserver/", name="stop_playserver", cache=False)
|
|
|
def stop_playserver():
|
|
|
server = get_storage("server")
|
|
|
if server is None or not ("port" in server) or server["port"] == 0:
|
|
@@ -661,7 +663,7 @@ def stop_playserver():
|
|
|
|
|
|
else:
|
|
|
try:
|
|
|
- client = socket.create_connection(("127.0.0.1", server["port"]), timeout=5)
|
|
|
+ client = socket.create_connection(("127.0.0.1", server["port"]), timeout=10)
|
|
|
if client:
|
|
|
client.send("GET /exit/ HTTP/1.1")
|
|
|
client.close()
|
|
@@ -671,10 +673,13 @@ def stop_playserver():
|
|
|
except:
|
|
|
PLUGIN.notify("Playserver konnte nicht beendet werden!")
|
|
|
output("[SERVER] Stop error: %s" % traceback.format_exc())
|
|
|
- __PlayServer__.__save___(0, 0)
|
|
|
+
|
|
|
+ finally:
|
|
|
+ __PlayServer__.__save__(0, 0)
|
|
|
|
|
|
return empty()
|
|
|
|
|
|
+
|
|
|
# Main
|
|
|
|
|
|
|
|
@@ -921,10 +926,16 @@ def main():
|
|
|
|
|
|
|
|
|
def __run():
|
|
|
+ output("==================================== START ====================================")
|
|
|
+
|
|
|
try:
|
|
|
PLUGIN.run()
|
|
|
- finally:
|
|
|
+ except:
|
|
|
hide_busy_dialog()
|
|
|
+ raise
|
|
|
+
|
|
|
+ finally:
|
|
|
+ output("==================================== END ====================================")
|
|
|
|
|
|
try:
|
|
|
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|