|
@@ -340,6 +340,8 @@ def play_episode(episode_id=0, ask_playlist=0):
|
|
|
@return:
|
|
|
"""
|
|
|
|
|
|
+ EXTERNAL_PLAYER = False
|
|
|
+
|
|
|
show_busy_dialog()
|
|
|
if episode_id == 0:
|
|
|
return empty()
|
|
@@ -362,7 +364,7 @@ def play_episode(episode_id=0, ask_playlist=0):
|
|
|
episode_result = __api__.__get__("get/episode", __data__={
|
|
|
"id": episode_id,
|
|
|
"withParents": 1,
|
|
|
- "withPlaylist": 30 if ret else 0
|
|
|
+ "withPlaylist": 30 if ret and not EXTERNAL_PLAYER else 0
|
|
|
})
|
|
|
|
|
|
if not episode_result:
|
|
@@ -370,13 +372,6 @@ def play_episode(episode_id=0, ask_playlist=0):
|
|
|
PLUGIN.dialog("Fehler beim verarbeiten der Antwort.")
|
|
|
return empty()
|
|
|
|
|
|
- item = prepare_movies_to_list([episode_result["data"]["season"]["movie"]])
|
|
|
- item = item[0]
|
|
|
- item["is_playable"] = True
|
|
|
-
|
|
|
- playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
|
|
- playlist.clear()
|
|
|
-
|
|
|
play_port = None
|
|
|
try:
|
|
|
server = __PlayServer__()
|
|
@@ -407,72 +402,92 @@ def play_episode(episode_id=0, ask_playlist=0):
|
|
|
|
|
|
raise
|
|
|
|
|
|
- # Main Episode
|
|
|
- episode = episode_result["data"]
|
|
|
- li = copy.copy(item)
|
|
|
- li["properties"] = {
|
|
|
- "MovieID": unicode(episode["id"])
|
|
|
- }
|
|
|
+ item = prepare_movies_to_list([episode_result["data"]["season"]["movie"]])
|
|
|
+ item = item[0]
|
|
|
+ item["is_playable"] = True
|
|
|
+
|
|
|
+ playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
|
|
+ playlist.clear()
|
|
|
+
|
|
|
+ if EXTERNAL_PLAYER and ret:
|
|
|
+ output("[PLAY] Will generate playlist")
|
|
|
+
|
|
|
+ path = "http://127.0.0.1:%s/playlist/%s/Playlist.m3u" % (play_port, episode_id)
|
|
|
+
|
|
|
+ li = copy.copy(item)
|
|
|
+ li = PLUGIN._listitemify(li).as_xbmc_listitem()
|
|
|
+ playlist.add(path, li)
|
|
|
|
|
|
- if episode["title"] == "Mainepisode":
|
|
|
- li["info"]["tagline"] = ""
|
|
|
else:
|
|
|
- tagline = unicode("%s - %s" % (episode_result["data"]["season"]["movie"]["title"], episode["title"] if episode_result["data"]["season"]["title"] == "Default" else (episode_result["data"]["season"]["title"] + " - %s. %s" % (episode["number"], episode["title"]))))
|
|
|
|
|
|
- if SWITCH_TAGLINE:
|
|
|
- title = li["label"]
|
|
|
- li["label"] = tagline
|
|
|
- li["info"]["title"] = tagline
|
|
|
- li["info"]["tagline"] = title
|
|
|
+ # Main Episode
|
|
|
+ episode = episode_result["data"]
|
|
|
+ li = copy.copy(item)
|
|
|
+ li["properties"] = {
|
|
|
+ "MovieID": unicode(episode["id"])
|
|
|
+ }
|
|
|
+
|
|
|
+ if episode["title"] == "Mainepisode":
|
|
|
+ li["info"]["tagline"] = ""
|
|
|
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"]:
|
|
|
- li = copy.copy(item)
|
|
|
- li["properties"] = {
|
|
|
- "MovieID": unicode(episode["id"])
|
|
|
- }
|
|
|
-
|
|
|
- if episode["title"] == "Mainepisode":
|
|
|
- li["info"]["tagline"] = ""
|
|
|
+ tagline = unicode("%s - %s" % (episode_result["data"]["season"]["movie"]["title"], episode["title"] if episode_result["data"]["season"]["title"] == "Default" else (episode_result["data"]["season"]["title"] + " - %s. %s" % (episode["number"], episode["title"]))))
|
|
|
+
|
|
|
+ if SWITCH_TAGLINE:
|
|
|
+ title = li["label"]
|
|
|
+ li["label"] = tagline
|
|
|
+ li["info"]["title"] = tagline
|
|
|
+ li["info"]["tagline"] = title
|
|
|
else:
|
|
|
- tagline = unicode("%s - %s" % (episode_result["data"]["season"]["movie"]["title"], episode["title"] if episode_result["data"]["season"]["title"] == "Default" else (episode_result["data"]["season"]["title"] + " - %s. %s" % (episode["number"], episode["title"]))))
|
|
|
+ li["info"]["tagline"] = tagline
|
|
|
+
|
|
|
+ tit = unicode("%s" % (episode_result["data"]["season"]["title"] if episode_result["data"]["season"]["title"] == "Default" else ("%s. %s" % (episode["number"], episode["title"]))))
|
|
|
+ li["path"] = path = "http://127.0.0.1:%s/play/%s/%s.mkv" % (play_port, episode["id"], urllib.quote(tit))
|
|
|
+ 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"]:
|
|
|
+ li = copy.copy(item)
|
|
|
+ li["properties"] = {
|
|
|
+ "MovieID": unicode(episode["id"])
|
|
|
+ }
|
|
|
|
|
|
- if SWITCH_TAGLINE:
|
|
|
- title = li["label"]
|
|
|
- li["label"] = tagline
|
|
|
- li["info"]["title"] = tagline
|
|
|
- li["info"]["tagline"] = title
|
|
|
+ if episode["title"] == "Mainepisode":
|
|
|
+ li["info"]["tagline"] = ""
|
|
|
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")
|
|
|
- offset = read_watchtime(episode_id)
|
|
|
- if offset > 0:
|
|
|
- ret = PLUGIN.yesno("Soll das Video bei Position %s fortgesetzt werden?" % format_seconds_to_hhmmss(offset))
|
|
|
- if ret == 0:
|
|
|
- save_watchtime(offset, 0)
|
|
|
- offset = 0
|
|
|
+ tagline = unicode("%s - %s" % (episode_result["data"]["season"]["movie"]["title"], episode["title"] if episode_result["data"]["season"]["title"] == "Default" else (episode_result["data"]["season"]["title"] + " - %s. %s" % (episode["number"], episode["title"]))))
|
|
|
|
|
|
+ if SWITCH_TAGLINE:
|
|
|
+ title = li["label"]
|
|
|
+ li["label"] = tagline
|
|
|
+ li["info"]["title"] = tagline
|
|
|
+ li["info"]["tagline"] = title
|
|
|
+ else:
|
|
|
+ li["info"]["tagline"] = tagline
|
|
|
+
|
|
|
+ tit = unicode("%s" % (episode_result["data"]["season"]["title"] if episode_result["data"]["season"]["title"] == "Default" else ("%s. %s" % (episode["number"], episode["title"]))))
|
|
|
+ li["path"] = path = "http://127.0.0.1:%s/play/%s/%s.mkv" % (play_port, episode["id"], urllib.quote(tit))
|
|
|
+ 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")
|
|
|
+ offset = read_watchtime(episode_id)
|
|
|
if offset > 0:
|
|
|
- first.setProperty("StartOffset", "%s" % offset)
|
|
|
+ ret = PLUGIN.yesno("Soll das Video bei Position %s fortgesetzt werden?" % format_seconds_to_hhmmss(offset))
|
|
|
+ if ret == 0:
|
|
|
+ save_watchtime(offset, 0)
|
|
|
+ offset = 0
|
|
|
+
|
|
|
+ if offset > 0:
|
|
|
+ first.setProperty("StartOffset", "%s" % offset)
|
|
|
|
|
|
player = xbmc.Player()
|
|
|
player.play(playlist)
|