|  | @@ -1,11 +1,15 @@
 | 
	
		
			
				|  |  |  # -*- coding: utf-8 -*-
 | 
	
		
			
				|  |  | +import base64
 | 
	
		
			
				|  |  | +import copy
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -from api import *
 | 
	
		
			
				|  |  |  from consts import *
 | 
	
		
			
				|  |  | +from utils import *
 | 
	
		
			
				|  |  | +from api import *
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  import datetime
 | 
	
		
			
				|  |  | -import pprint
 | 
	
		
			
				|  |  | -import copy
 | 
	
		
			
				|  |  | -import urllib
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +# xbmc.log(str(xbmc.getCondVisibility("System.GetBool(debug.showloginfo)")))
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @PLUGIN.route("/empty/", name="empty", update=False, cache=True)
 | 
	
	
		
			
				|  | @@ -38,12 +42,12 @@ def play_trailer(trailer_id="", age=""):
 | 
	
		
			
				|  |  |          xbmc.log("[YOUTUBE] Error: %s" % traceback.format_exc())
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          hide_busy_dialog()
 | 
	
		
			
				|  |  | -        PLUGIN.dialog("Es ist ein Fehler passiert bei YT:\n%s" % repr(e))
 | 
	
		
			
				|  |  | +        PLUGIN.dialog("Es ist ein Fehler passiert bei YT:\n%s" % str(e))
 | 
	
		
			
				|  |  |          return empty()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      if streams is False:
 | 
	
		
			
				|  |  |          hide_busy_dialog()
 | 
	
		
			
				|  |  | -        PLUGIN.dialog("Das Addon [B]plugin.video.youtube[/B] muss installiert sein")
 | 
	
		
			
				|  |  | +        PLUGIN.dialog("Das Addon [B]plugin.video.youtube[/B] muss installiert sein.")
 | 
	
		
			
				|  |  |          return empty()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      if not streams or len(streams) <= 0:
 | 
	
	
		
			
				|  | @@ -59,17 +63,31 @@ def play_trailer(trailer_id="", age=""):
 | 
	
		
			
				|  |  |          "is_playable": True
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    li = PLUGIN._listitemify(item).as_xbmc_listitem()
 | 
	
		
			
				|  |  | +    if stream["container"] == "mpd":
 | 
	
		
			
				|  |  | +        if not HAS_DRM_LIB:
 | 
	
		
			
				|  |  | +            hide_busy_dialog()
 | 
	
		
			
				|  |  | +            PLUGIN.dialog("Das Addon [B]inputstream.adaptive[/B] muss für diesen Trailer installiert sein.")
 | 
	
		
			
				|  |  | +            return empty()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if KODI_VERSION >= 19:
 | 
	
		
			
				|  |  | +            li.setProperty("inputstream", "inputstream.adaptive")
 | 
	
		
			
				|  |  | +        else:
 | 
	
		
			
				|  |  | +            li.setProperty("inputstreamaddon", "inputstream.adaptive")
 | 
	
		
			
				|  |  | +        li.setProperty("inputstream.adaptive.manifest_type", "mpd")
 | 
	
		
			
				|  |  | +        li.setMimeType("application/dash+xml")
 | 
	
		
			
				|  |  | +        li.setContentLookup(False)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    elif stream["container"] in ["ism", "hls", "rtmp"]:
 | 
	
		
			
				|  |  | +        hide_busy_dialog()
 | 
	
		
			
				|  |  | +        PLUGIN.dialog("Container [B]%s[/B] wird nicht abspielbar!" % stream["container"])
 | 
	
		
			
				|  |  | +        return empty()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
 | 
	
		
			
				|  |  |      playlist.clear()
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    li = PLUGIN._listitemify(item).as_xbmc_listitem()
 | 
	
		
			
				|  |  |      playlist.add(item["path"], li)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      player = xbmc.Player()
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    if False:
 | 
	
		
			
				|  |  | -        PLUGIN.notify("Trailer wird versucht abzuspielen!")
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      player.play(playlist)
 | 
	
		
			
				|  |  |      del player
 | 
	
		
			
				|  |  |      player = None
 | 
	
	
		
			
				|  | @@ -84,6 +102,8 @@ def view_actors(movie_id=0):
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      items = []
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    show_busy_dialog()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      movie_result = __api__.__get__("get/movie", __data__={
 | 
	
		
			
				|  |  |          "id": movie_id,
 | 
	
		
			
				|  |  |          "withActors": 1
 | 
	
	
		
			
				|  | @@ -101,11 +121,11 @@ def view_actors(movie_id=0):
 | 
	
		
			
				|  |  |          return empty()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      items = [
 | 
	
		
			
				|  |  | -        {
 | 
	
		
			
				|  |  | +        set_thumbnail({
 | 
	
		
			
				|  |  |              "label": unicode(entry["name"]),
 | 
	
		
			
				|  |  |              "path": PLUGIN.url_for(endpoint="view_actor",
 | 
	
		
			
				|  |  |                                     actor_id=entry['id'],
 | 
	
		
			
				|  |  | -                                   page=0),
 | 
	
		
			
				|  |  | +                                   page=1),
 | 
	
		
			
				|  |  |              "thumbnail": get_poster_url(entry["profile"]),
 | 
	
		
			
				|  |  |              "info": {
 | 
	
		
			
				|  |  |                  "count": entry["id"],
 | 
	
	
		
			
				|  | @@ -114,17 +134,21 @@ def view_actors(movie_id=0):
 | 
	
		
			
				|  |  |              "is_playable": False,
 | 
	
		
			
				|  |  |              "context_menu": misc_menu(),
 | 
	
		
			
				|  |  |              "replace_context_menu": True
 | 
	
		
			
				|  |  | -        } for idx, entry in enumerate(entries)
 | 
	
		
			
				|  |  | +        }) for idx, entry in enumerate(entries)
 | 
	
		
			
				|  |  |      ]
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    hide_busy_dialog()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      return items
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @PLUGIN.route("/view_actor/<actor_id>/<page>/", name="view_actor", cache=True, content_type="movies", view_mode=get_view("thumbnail"))
 | 
	
		
			
				|  |  | -def view_actor(actor_id=0, page=0):
 | 
	
		
			
				|  |  | +def view_actor(actor_id=0, page=1):
 | 
	
		
			
				|  |  |      if not actor_id or actor_id == 0:
 | 
	
		
			
				|  |  |          return empty()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    show_busy_dialog()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      items = []
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      actor_result = __api__.__get__("get/actor", __data__={
 | 
	
	
		
			
				|  | @@ -133,17 +157,26 @@ def view_actor(actor_id=0, page=0):
 | 
	
		
			
				|  |  |      })
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      if not actor_result:
 | 
	
		
			
				|  |  | +        hide_busy_dialog()
 | 
	
		
			
				|  |  |          return empty()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      items.extend(prepare_movies_to_list(actor_result["data"]["movies"]))
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    hide_busy_dialog()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      return items
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @PLUGIN.route("/search_trailer/<title>/<date>/<fanart>/<age>/", name="search_trailer", cache=False, content_type="episodes", view_mode=get_view("episode"))
 | 
	
		
			
				|  |  |  def search_trailer(title="", date="", fanart="", age=""):
 | 
	
		
			
				|  |  | +    if not HAS_YOUTUBE_LIB:
 | 
	
		
			
				|  |  | +        PLUGIN.dialog("Das Addon [B]plugin.video.youtube[/B] muss installiert sein.")
 | 
	
		
			
				|  |  | +        return empty()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      show_busy_dialog()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      if not title or not master_lock_access(age):
 | 
	
		
			
				|  |  | +        hide_busy_dialog()
 | 
	
		
			
				|  |  |          return empty()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      year = re.search("([0-9]{4})-.*", date)
 | 
	
	
		
			
				|  | @@ -152,26 +185,40 @@ def search_trailer(title="", date="", fanart="", age=""):
 | 
	
		
			
				|  |  |      else:
 | 
	
		
			
				|  |  |          year = ""
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    title = urllib.pathname2url("%s trailer german deutsch" % (title.replace(":", "")))
 | 
	
		
			
				|  |  | +    title = pathname2url("%s trailer german deutsch" % (title.replace(":", "")))
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    if DEBUG:
 | 
	
		
			
				|  |  | -        output("[YOUTUBE]: %s" % (YOUTUBE_SEARCH_URL % title))
 | 
	
		
			
				|  |  | +    search_url = YOUTUBE_SEARCH_URL % (random.choice(YOUTUBE_KEYS), title)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    #ifdef DEBUG
 | 
	
		
			
				|  |  | +    if DEBUG:
 | 
	
		
			
				|  |  | +        output("[YOUTUBE]: %s" % search_url)
 | 
	
		
			
				|  |  | +    #endif
 | 
	
		
			
				|  |  |      data = None
 | 
	
		
			
				|  |  |      try:
 | 
	
		
			
				|  |  | -        data = urllib2.urlopen(YOUTUBE_SEARCH_URL % title).read()
 | 
	
		
			
				|  |  | -    except Exception as e:
 | 
	
		
			
				|  |  | -        output(repr(e))
 | 
	
		
			
				|  |  | +        data = urllib_request.urlopen(search_url).read()
 | 
	
		
			
				|  |  | +    except urllib_request.HTTPError as e:
 | 
	
		
			
				|  |  | +        data = e.read()
 | 
	
		
			
				|  |  | +    except:
 | 
	
		
			
				|  |  | +        output("[YOUTUBE] Exception: %s" % traceback.format_exc())
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      if not data:
 | 
	
		
			
				|  |  |          hide_busy_dialog()
 | 
	
		
			
				|  |  |          PLUGIN.dialog("Fehler beim verarbeiten der Antwort.")
 | 
	
		
			
				|  |  |          return empty()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    obj = string_to_json(data)
 | 
	
		
			
				|  |  | -    if not obj or not ('items' in obj):
 | 
	
		
			
				|  |  | +    try:
 | 
	
		
			
				|  |  | +        obj = string_to_json(data)
 | 
	
		
			
				|  |  | +    except:
 | 
	
		
			
				|  |  | +        obj = None
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if not obj or 'items' not in obj:
 | 
	
		
			
				|  |  |          hide_busy_dialog()
 | 
	
		
			
				|  |  | -        PLUGIN.dialog("Es wurden keine Trailer gefunden")
 | 
	
		
			
				|  |  | +        if "error" in obj and len(obj["error"]["errors"]):
 | 
	
		
			
				|  |  | +            error = obj["error"]["errors"][0]
 | 
	
		
			
				|  |  | +            PLUGIN.dialog("Es ist ein Fehler passiert bei YT:\n%s" % error["reason"])
 | 
	
		
			
				|  |  | +        else:
 | 
	
		
			
				|  |  | +            PLUGIN.dialog("Es wurden keine Trailer gefunden")
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          return empty()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      entries = obj['items']
 | 
	
	
		
			
				|  | @@ -181,14 +228,14 @@ def search_trailer(title="", date="", fanart="", age=""):
 | 
	
		
			
				|  |  |          return empty()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      items = [
 | 
	
		
			
				|  |  | -        {
 | 
	
		
			
				|  |  | +        set_thumbnail({
 | 
	
		
			
				|  |  |              "label": unicode(entry['snippet']["title"]),
 | 
	
		
			
				|  |  |              "path": PLUGIN.url_for(endpoint="play_trailer",
 | 
	
		
			
				|  |  |                                     trailer_id=str(entry['id']['videoId']),
 | 
	
		
			
				|  |  |                                     age="0"),
 | 
	
		
			
				|  |  |              "thumbnail": entry['snippet']['thumbnails']['high']['url'].replace("https://", "http://"),
 | 
	
		
			
				|  |  |              "properties": {
 | 
	
		
			
				|  |  | -                "fanart_image": urllib.unquote(fanart) if fanart and fanart != "None" else "",
 | 
	
		
			
				|  |  | +                "fanart_image": urllib_parse.unquote(fanart) if fanart and fanart != "None" else "",
 | 
	
		
			
				|  |  |              },
 | 
	
		
			
				|  |  |              "info": {
 | 
	
		
			
				|  |  |                  "count": entry["id"]["videoId"],
 | 
	
	
		
			
				|  | @@ -197,7 +244,7 @@ def search_trailer(title="", date="", fanart="", age=""):
 | 
	
		
			
				|  |  |                  "premiered": entry['snippet']["publishedAt"][:10] if entry['snippet']["publishedAt"] else ""
 | 
	
		
			
				|  |  |              },
 | 
	
		
			
				|  |  |              "is_playable": False,
 | 
	
		
			
				|  |  | -        } for idx, entry in enumerate(entries)
 | 
	
		
			
				|  |  | +        }) for idx, entry in enumerate(entries)
 | 
	
		
			
				|  |  |      ]
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      hide_busy_dialog()
 | 
	
	
		
			
				|  | @@ -221,7 +268,7 @@ def watchlist_action(movie_id="0", action="add", refresh=0):
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      message = None
 | 
	
		
			
				|  |  |      if action == "add":
 | 
	
		
			
				|  |  | -        message = u"Eintrag wurde der Liste hinzugefügt"
 | 
	
		
			
				|  |  | +        message = "Eintrag wurde der Liste hinzugefuegt"
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      elif action == "remove":
 | 
	
		
			
				|  |  |          message = "Eintrag wurde aus der Liste entfernt"
 | 
	
	
		
			
				|  | @@ -235,11 +282,26 @@ def watchlist_action(movie_id="0", action="add", refresh=0):
 | 
	
		
			
				|  |  |      return empty()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -@PLUGIN.route("/view_list/<list_type>/<page>/<view_types>/<genre>/<min_year>/<max_year>/<query>/", name="view_list", update=False, cache=True, content_type="movies", view_mode=get_view("thumbnail"))
 | 
	
		
			
				|  |  | +class UrlBasedCache():
 | 
	
		
			
				|  |  | +    def __trunc__(self):
 | 
	
		
			
				|  |  | +        try:
 | 
	
		
			
				|  |  | +            request = PLUGIN.request
 | 
	
		
			
				|  |  | +        except:
 | 
	
		
			
				|  |  | +            return True
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        do_cache = not ("/view_list/watched/" in request.url)
 | 
	
		
			
				|  |  | +        if not do_cache:
 | 
	
		
			
				|  |  | +            output("[PLUGIN] Cache will be ignored for %s" % request.url)
 | 
	
		
			
				|  |  | +        return do_cache
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +@PLUGIN.route("/view_list/<list_type>/<page>/<view_types>/<genre>/<min_year>/<max_year>/<query>/", name="view_list", update=False, cache=UrlBasedCache(), content_type="movies", view_mode=get_view("thumbnail"))
 | 
	
		
			
				|  |  |  def view_list(list_type="new", view_types="0", page=1, genre="all", min_year=0, max_year=0, query=0):
 | 
	
		
			
				|  |  |      if str(view_types) == "2":
 | 
	
		
			
				|  |  |          PLUGIN.set_goto_top(False)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    show_busy_dialog()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      items = []
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      params = {
 | 
	
	
		
			
				|  | @@ -251,18 +313,23 @@ def view_list(list_type="new", view_types="0", page=1, genre="all", min_year=0,
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      if query != "0":
 | 
	
		
			
				|  |  | -        output("Search: %s" % query)
 | 
	
		
			
				|  |  | -        params["title"] = query
 | 
	
		
			
				|  |  | +        if sys.version_info.major < 3:
 | 
	
		
			
				|  |  | +            params["title"] = unicode(base64.b64decode(query), "utf-8").encode("utf-8")
 | 
	
		
			
				|  |  | +        else:
 | 
	
		
			
				|  |  | +            params["title"] = base64.b64decode(query)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      params["orderby"] = "updated_at|DESC"
 | 
	
		
			
				|  |  |      # params["orderby"] = "popularity|DESC"
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      if view_types != "0":
 | 
	
		
			
				|  |  | -        params["types"] = view_types
 | 
	
		
			
				|  |  | +        params["types"] = view_types.replace("%2C", ",")
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      if int(min_year) > 0 or int(max_year) > 0:
 | 
	
		
			
				|  |  |          params["year"] = "%s-%s" % (min_year, max_year)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    if genre != "all":
 | 
	
		
			
				|  |  | +        params["genres"] = genre
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      result = __api__.__get__("get/list", __data__=params)
 | 
	
		
			
				|  |  |      if not result:
 | 
	
		
			
				|  |  |          hide_busy_dialog()
 | 
	
	
		
			
				|  | @@ -303,6 +370,8 @@ def view_list(list_type="new", view_types="0", page=1, genre="all", min_year=0,
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          items.extend(pages)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    hide_busy_dialog()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      return items
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -311,6 +380,8 @@ def search_similars(movie_id=0, page=1, type=0):
 | 
	
		
			
				|  |  |      if not movie_id:
 | 
	
		
			
				|  |  |          return empty()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    show_busy_dialog()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      result = __api__.__get__("get/similars", __data__={
 | 
	
		
			
				|  |  |          "id": movie_id
 | 
	
		
			
				|  |  |      })
 | 
	
	
		
			
				|  | @@ -328,6 +399,8 @@ def search_similars(movie_id=0, page=1, type=0):
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      items.extend(prepare_movies_to_list(result["data"]["results"]))
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    hide_busy_dialog()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      return items
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -440,8 +513,8 @@ def play_episode(episode_id=0, ask_playlist=0):
 | 
	
		
			
				|  |  |              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))
 | 
	
		
			
				|  |  | +        tit = "File"  #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_parse.quote(tit))
 | 
	
		
			
				|  |  |          li = PLUGIN._listitemify(li).as_xbmc_listitem()
 | 
	
		
			
				|  |  |          playlist.add(path, li)
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -466,14 +539,15 @@ def play_episode(episode_id=0, ask_playlist=0):
 | 
	
		
			
				|  |  |                      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))
 | 
	
		
			
				|  |  | +                tit = "File"  #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_parse.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()))
 | 
	
		
			
				|  |  | +            path = playlist[idx].getPath() if hasattr(playlist[idx], "getPath") else playlist[idx].getfilename()
 | 
	
		
			
				|  |  | +            output("[PLAY] %s - Item %s" % (idx + 1, path))
 | 
	
		
			
				|  |  |          #endif
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          first = playlist[0]
 | 
	
	
		
			
				|  | @@ -493,9 +567,10 @@ def play_episode(episode_id=0, ask_playlist=0):
 | 
	
		
			
				|  |  |      player.play(playlist)
 | 
	
		
			
				|  |  |      del player
 | 
	
		
			
				|  |  |      player = None
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +    show_busy_dialog()
 | 
	
		
			
				|  |  |      xbmc.sleep(250)
 | 
	
		
			
				|  |  | -    xbmc.executebuiltin("XBMC.Action(FullScreen)")
 | 
	
		
			
				|  |  | +    xbmc.executebuiltin("Action(FullScreen)")
 | 
	
		
			
				|  |  | +    show_busy_dialog()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      return empty()
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -504,6 +579,7 @@ def play_episode(episode_id=0, ask_playlist=0):
 | 
	
		
			
				|  |  |  def seasons(movie_id=0):
 | 
	
		
			
				|  |  |      show_busy_dialog()
 | 
	
		
			
				|  |  |      if movie_id == 0:
 | 
	
		
			
				|  |  | +        hide_busy_dialog()
 | 
	
		
			
				|  |  |          return empty()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      movie_result = __api__.__get__("get/movie", __data__={
 | 
	
	
		
			
				|  | @@ -528,7 +604,7 @@ def seasons(movie_id=0):
 | 
	
		
			
				|  |  |          return empty()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      items = [
 | 
	
		
			
				|  |  | -        {
 | 
	
		
			
				|  |  | +        set_thumbnail({
 | 
	
		
			
				|  |  |              "label": unicode(season["title"]),
 | 
	
		
			
				|  |  |              "path": PLUGIN.url_for(endpoint="episodes", season_id=season['id']),
 | 
	
		
			
				|  |  |              "thumbnail": get_poster_url(season["posterurl"] if season["posterurl"] else season_result["data"]["posterurl"]),
 | 
	
	
		
			
				|  | @@ -546,7 +622,7 @@ def seasons(movie_id=0):
 | 
	
		
			
				|  |  |              },
 | 
	
		
			
				|  |  |              "context_menu": misc_menu(),
 | 
	
		
			
				|  |  |              "replace_context_menu": False
 | 
	
		
			
				|  |  | -        } for season in season_result["data"]["seasons"]
 | 
	
		
			
				|  |  | +        }) for season in season_result["data"]["seasons"]
 | 
	
		
			
				|  |  |      ]
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      hide_busy_dialog()
 | 
	
	
		
			
				|  | @@ -558,6 +634,7 @@ def seasons(movie_id=0):
 | 
	
		
			
				|  |  |  def episodes(season_id=0, dialog=True):
 | 
	
		
			
				|  |  |      show_busy_dialog()
 | 
	
		
			
				|  |  |      if season_id == 0:
 | 
	
		
			
				|  |  | +        hide_busy_dialog()
 | 
	
		
			
				|  |  |          return empty()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      episode_results = __api__.__get__("get/season", __data__={
 | 
	
	
		
			
				|  | @@ -572,7 +649,7 @@ def episodes(season_id=0, dialog=True):
 | 
	
		
			
				|  |  |          if not episode["id"]:
 | 
	
		
			
				|  |  |              continue
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        items.append({
 | 
	
		
			
				|  |  | +        items.append(set_thumbnail({
 | 
	
		
			
				|  |  |              "label": "%s. %s" % (episode["number"], unicode(episode["title"])),
 | 
	
		
			
				|  |  |              "path": PLUGIN.url_for(endpoint="play_episode",
 | 
	
		
			
				|  |  |                                     episode_id=episode['id'],
 | 
	
	
		
			
				|  | @@ -580,7 +657,7 @@ def episodes(season_id=0, dialog=True):
 | 
	
		
			
				|  |  |              "is_playable": False,
 | 
	
		
			
				|  |  |              "thumbnail": get_scene_url(episode["posterurl"] if episode["posterurl"] else None),
 | 
	
		
			
				|  |  |              "properties": {
 | 
	
		
			
				|  |  | -                # "fanart_image": get_backdrop_url(obj["data"]["movie"]['backdropurl']),
 | 
	
		
			
				|  |  | +                #"fanart_image": get_backdrop_url(episode_results["data"]['backdropurl']),
 | 
	
		
			
				|  |  |              },
 | 
	
		
			
				|  |  |              "info": {
 | 
	
		
			
				|  |  |                  "plot": unicode(episode["description"]) if episode["description"] else (unicode(episode_results["data"]["description"]) if episode_results["data"]["description"] else None),
 | 
	
	
		
			
				|  | @@ -593,31 +670,57 @@ def episodes(season_id=0, dialog=True):
 | 
	
		
			
				|  |  |              },
 | 
	
		
			
				|  |  |              "context_menu": misc_menu(episode_id=episode["id"]),
 | 
	
		
			
				|  |  |              "replace_context_menu": False
 | 
	
		
			
				|  |  | -        })
 | 
	
		
			
				|  |  | +        }))
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      hide_busy_dialog()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      return items
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -@PLUGIN.route("/mark_as_seen/<episodeid>/", name="mark_as_seen")
 | 
	
		
			
				|  |  | -def mark_as_seen(episodeid="0"):
 | 
	
		
			
				|  |  | +@PLUGIN.route("/mark_as_seen/<episodeid>/<seen>/", name="mark_as_seen")
 | 
	
		
			
				|  |  | +def mark_as_seen(episodeid="0", seen="0"):
 | 
	
		
			
				|  |  |      if not episodeid or episodeid == "0":
 | 
	
		
			
				|  |  | -        return None
 | 
	
		
			
				|  |  | +        return empty()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    show_busy_dialog()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if not save_watchtime(episodeid, time=0, seen=int(seen)):
 | 
	
		
			
				|  |  | +        hide_busy_dialog()
 | 
	
		
			
				|  |  | +        PLUGIN.notify("Fehler beim ausfuehren der Aktion!")
 | 
	
		
			
				|  |  | +    else:
 | 
	
		
			
				|  |  | +        hide_busy_dialog()
 | 
	
		
			
				|  |  | +        PLUGIN.notify("Eintrag wurde als %sgesehen markiert." % ("un" if not int(seen) else ""))
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      return None
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @PLUGIN.route("/account_status/", name="account_status")
 | 
	
		
			
				|  |  |  def account_status():
 | 
	
		
			
				|  |  | -    return empty()
 | 
	
		
			
				|  |  | +    userinfo_result = __api__.__get__("get/userinfo")
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if not userinfo_result:
 | 
	
		
			
				|  |  | +        hide_busy_dialog()
 | 
	
		
			
				|  |  | +        PLUGIN.dialog("Fehler beim verarbeiten der Antwort.")
 | 
	
		
			
				|  |  | +        return empty()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    data = userinfo_result["data"]
 | 
	
		
			
				|  |  | +    text = ""
 | 
	
		
			
				|  |  | +    if data and "abonnement" in data:
 | 
	
		
			
				|  |  | +        text += "[B]Laufzeit:[/B]\n\n"
 | 
	
		
			
				|  |  | +        text += "%s - %s" % (data["abonnement"]["start"]["date"], data["abonnement"]["end"]["date"])
 | 
	
		
			
				|  |  | +    else:
 | 
	
		
			
				|  |  | +        text = u"Keine Informationen bezüglich Laufzeit."
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    hide_busy_dialog()
 | 
	
		
			
				|  |  | +    PLUGIN.dialog(text)
 | 
	
		
			
				|  |  | +    return None
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @PLUGIN.route("/clear_password/", name="clear_password")
 | 
	
		
			
				|  |  |  def clear_password():
 | 
	
		
			
				|  |  |      clear_session()
 | 
	
		
			
				|  |  |      PLUGIN.set_setting("password", "")
 | 
	
		
			
				|  |  | -    return empty()
 | 
	
		
			
				|  |  | +    return None
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @PLUGIN.route("/clear_storage/", name="clear_storage")
 | 
	
	
		
			
				|  | @@ -627,29 +730,106 @@ def clear_storage():
 | 
	
		
			
				|  |  |      clear_session()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      PLUGIN.notify("Storage wurde geleert.")
 | 
	
		
			
				|  |  | -    return empty()
 | 
	
		
			
				|  |  | +    return None
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -@PLUGIN.route("/search/<is_actor>/", name="search", cache=False)
 | 
	
		
			
				|  |  | -def search(is_actor="0"):
 | 
	
		
			
				|  |  | -    is_actor = 0
 | 
	
		
			
				|  |  | +@PLUGIN.route("/fuckinghell/<is_actor>/", name="fuckinghell", cache=False)
 | 
	
		
			
				|  |  | +def fuckinghell(is_actor="0"):
 | 
	
		
			
				|  |  | +    is_actor = str(is_actor)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      title = "Schauspieler" if is_actor == "1" else "Film oder Serie"
 | 
	
		
			
				|  |  |      query = PLUGIN.keyboard('', "Nach %s Suchen" % title)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      if query:
 | 
	
		
			
				|  |  | -        return PLUGIN.redirect(PLUGIN.url_for(endpoint="view_list",
 | 
	
		
			
				|  |  | -                                              list_type="all",
 | 
	
		
			
				|  |  | -                                              view_types=VIEW_TYPES,
 | 
	
		
			
				|  |  | -                                              genre="all",
 | 
	
		
			
				|  |  | -                                              min_year=0,
 | 
	
		
			
				|  |  | -                                              max_year=0,
 | 
	
		
			
				|  |  | -                                              query=query,
 | 
	
		
			
				|  |  | -                                              page=1))
 | 
	
		
			
				|  |  | +        query = base64.b64encode(convert_to_bytes(query))
 | 
	
		
			
				|  |  | +        if is_actor == "1":
 | 
	
		
			
				|  |  | +            return PLUGIN.redirect(PLUGIN.url_for(endpoint="search_actors",
 | 
	
		
			
				|  |  | +                                                  query=query,
 | 
	
		
			
				|  |  | +                                                  page=1))
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        else:
 | 
	
		
			
				|  |  | +            return PLUGIN.redirect(PLUGIN.url_for(endpoint="view_list",
 | 
	
		
			
				|  |  | +                                                  list_type="all",
 | 
	
		
			
				|  |  | +                                                  view_types=VIEW_TYPES,
 | 
	
		
			
				|  |  | +                                                  genre="all",
 | 
	
		
			
				|  |  | +                                                  min_year=0,
 | 
	
		
			
				|  |  | +                                                  max_year=0,
 | 
	
		
			
				|  |  | +                                                  query=query,
 | 
	
		
			
				|  |  | +                                                  page=1))
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      return empty()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +@PLUGIN.route("/search_actors/<query>/<page>/", name="search_actors", cache=True, content_type="movies", view_mode=get_view("thumbnail"), goto_top=True)
 | 
	
		
			
				|  |  | +def search_actors(query="", page=1):
 | 
	
		
			
				|  |  | +    if not query:
 | 
	
		
			
				|  |  | +        return empty()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    show_busy_dialog()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if sys.version_info.major < 3:
 | 
	
		
			
				|  |  | +        encoded_query = unicode(base64.b64decode(query), "utf-8").encode("utf-8")
 | 
	
		
			
				|  |  | +    else:
 | 
	
		
			
				|  |  | +        encoded_query = base64.b64decode(query)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    result = __api__.__get__("get/actors", __data__={
 | 
	
		
			
				|  |  | +        "query": encoded_query,
 | 
	
		
			
				|  |  | +        "page": page,
 | 
	
		
			
				|  |  | +        "limit": MOVIES_PER_PAGE,
 | 
	
		
			
				|  |  | +        "extended": 0
 | 
	
		
			
				|  |  | +    })
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if not result:
 | 
	
		
			
				|  |  | +        hide_busy_dialog()
 | 
	
		
			
				|  |  | +        PLUGIN.notify("Fehler beim verarbeiten der Anfrage.")
 | 
	
		
			
				|  |  | +        return empty()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if result["data"]["total_results"] <= 0:
 | 
	
		
			
				|  |  | +        hide_busy_dialog()
 | 
	
		
			
				|  |  | +        PLUGIN.dialog(u"Leider wurden keine Einträge gefunden!")
 | 
	
		
			
				|  |  | +        return empty()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    items = []
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    actors = result["data"]["results"]
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    for actor in actors:
 | 
	
		
			
				|  |  | +        items.append(set_thumbnail({
 | 
	
		
			
				|  |  | +            "label": actor["name"].strip(),
 | 
	
		
			
				|  |  | +            "thumbnail": get_poster_url(actor["picture"]) if actor["picture"] else "",
 | 
	
		
			
				|  |  | +            "path": PLUGIN.url_for(endpoint="view_actor",
 | 
	
		
			
				|  |  | +                                   actor_id=actor["id"],
 | 
	
		
			
				|  |  | +                                   page=1),
 | 
	
		
			
				|  |  | +            "context_menu": misc_menu(),
 | 
	
		
			
				|  |  | +            "replace_context_menu": False
 | 
	
		
			
				|  |  | +        }))
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    total = result["data"]["total_pages"]
 | 
	
		
			
				|  |  | +    if total > 1:
 | 
	
		
			
				|  |  | +        pages = []
 | 
	
		
			
				|  |  | +        for pagenum in range(1, total + 1):
 | 
	
		
			
				|  |  | +            pages.append(
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    "label": ("[COLOR red][B][I]Seite %s von %s[/I][/B][/COLOR]" % (pagenum, total)) if int(pagenum) == int(page) else "Seite %s von %s" % (pagenum, total),
 | 
	
		
			
				|  |  | +                    "is_playable": False,
 | 
	
		
			
				|  |  | +                    "path": EMPTY_PATH if int(pagenum) == int(page) else PLUGIN.url_for(endpoint="search_actors",
 | 
	
		
			
				|  |  | +                                                                                        page=pagenum,
 | 
	
		
			
				|  |  | +                                                                                        query=query),
 | 
	
		
			
				|  |  | +                    "info": {
 | 
	
		
			
				|  |  | +                        "playcount": 1 if int(pagenum) == int(page) else 0,
 | 
	
		
			
				|  |  | +                        "tagline": "[B]%s[/B] bis [B]%s[/B]" % (unicode(pagenum * int(result["data"]["limit"])), unicode(min(pagenum * int(result["data"]["limit"]), total)))
 | 
	
		
			
				|  |  | +                    },
 | 
	
		
			
				|  |  | +                    "context_menu": misc_menu(),
 | 
	
		
			
				|  |  | +                    "replace_context_menu": False
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            )
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        items.extend(pages)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    hide_busy_dialog()
 | 
	
		
			
				|  |  | +    return items
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  @PLUGIN.route("/open_settings/", name="open_settings", cache=True)
 | 
	
		
			
				|  |  |  def open_settings():
 | 
	
		
			
				|  |  |      PLUGIN.open_settings()
 | 
	
	
		
			
				|  | @@ -673,8 +853,8 @@ def account_logout():
 | 
	
		
			
				|  |  |  @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:
 | 
	
		
			
				|  |  | -        PLUGIN.notify(u"Playserver läuft nicht!")
 | 
	
		
			
				|  |  | +    if server is None or "port" not in server or server["port"] == 0:
 | 
	
		
			
				|  |  | +        PLUGIN.notify("Playserver laeuft nicht!")
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      else:
 | 
	
		
			
				|  |  |          try:
 | 
	
	
		
			
				|  | @@ -695,7 +875,141 @@ def stop_playserver():
 | 
	
		
			
				|  |  |      return empty()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -# Main
 | 
	
		
			
				|  |  | +@PLUGIN.route("/view_filters/", name="view_filters", cache=True, content_type="files", view_mode=get_view("list"))
 | 
	
		
			
				|  |  | +def view_filters():
 | 
	
		
			
				|  |  | +    items = []
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    items.append({
 | 
	
		
			
				|  |  | +        "label": "Nach Genre",
 | 
	
		
			
				|  |  | +        "path": PLUGIN.url_for(endpoint="filter_genre"),
 | 
	
		
			
				|  |  | +    })
 | 
	
		
			
				|  |  | +    items.append({
 | 
	
		
			
				|  |  | +        "label": "Nach Jahr",
 | 
	
		
			
				|  |  | +        "path": PLUGIN.url_for(endpoint="filter_years"),
 | 
	
		
			
				|  |  | +    })
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    return items
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +@PLUGIN.route("/filter_genre/", name="filter_genre", cache=True, content_type="files", view_mode=get_view("list"))
 | 
	
		
			
				|  |  | +def filter_genre():
 | 
	
		
			
				|  |  | +    show_busy_dialog()
 | 
	
		
			
				|  |  | +    items = []
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    result = __api__.__get__("get/genres", __data__={
 | 
	
		
			
				|  |  | +        "page": 1,
 | 
	
		
			
				|  |  | +        "limit": 9999999
 | 
	
		
			
				|  |  | +    })
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if not result:
 | 
	
		
			
				|  |  | +        hide_busy_dialog()
 | 
	
		
			
				|  |  | +        PLUGIN.notify("Fehler beim verarbeiten der Anfrage.")
 | 
	
		
			
				|  |  | +        return empty()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if len(result["data"]) <= 0:
 | 
	
		
			
				|  |  | +        hide_busy_dialog()
 | 
	
		
			
				|  |  | +        PLUGIN.dialog(u"Leider wurden keine Genres gefunden!")
 | 
	
		
			
				|  |  | +        return empty()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    for genre in result["data"]:
 | 
	
		
			
				|  |  | +        items.append({
 | 
	
		
			
				|  |  | +            "label": "%s (%s)" % (genre["name"], genre["movies"]),
 | 
	
		
			
				|  |  | +            "path": PLUGIN.url_for(endpoint="view_list",
 | 
	
		
			
				|  |  | +                                   genre=genre["name"],
 | 
	
		
			
				|  |  | +                                   list_type="all",
 | 
	
		
			
				|  |  | +                                   view_types=VIEW_TYPES,
 | 
	
		
			
				|  |  | +                                   page=1,
 | 
	
		
			
				|  |  | +                                   query=0,
 | 
	
		
			
				|  |  | +                                   min_year=0,
 | 
	
		
			
				|  |  | +                                   max_year=0),
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    hide_busy_dialog()
 | 
	
		
			
				|  |  | +    return items
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +@PLUGIN.route("/filter_years_manually/", name="filter_years_manually", cache=False)
 | 
	
		
			
				|  |  | +def search():
 | 
	
		
			
				|  |  | +    query = PLUGIN.keyboard('', "Jahr eingeben")
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if query:
 | 
	
		
			
				|  |  | +        min_year = query
 | 
	
		
			
				|  |  | +        max_year = query
 | 
	
		
			
				|  |  | +        if "-" in query:
 | 
	
		
			
				|  |  | +            chunks = query.split("-")
 | 
	
		
			
				|  |  | +            min_year = chunks[0].strip()
 | 
	
		
			
				|  |  | +            max_year = chunks[1].strip()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if not min_year.isdigit() or not max_year.isdigit():
 | 
	
		
			
				|  |  | +            PLUGIN.dialog(u"Jahr nicht gültig!\nBeispiele:\n- 1950\n- 1900-1950")
 | 
	
		
			
				|  |  | +            return empty()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return PLUGIN.redirect(PLUGIN.url_for(endpoint="view_list",
 | 
	
		
			
				|  |  | +                                              genre="all",
 | 
	
		
			
				|  |  | +                                              list_type="all",
 | 
	
		
			
				|  |  | +                                              view_types=VIEW_TYPES,
 | 
	
		
			
				|  |  | +                                              page=1,
 | 
	
		
			
				|  |  | +                                              query=0,
 | 
	
		
			
				|  |  | +                                              min_year=min_year,
 | 
	
		
			
				|  |  | +                                              max_year=max_year))
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    return empty()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +@PLUGIN.route("/filter_years/", name="filter_years", cache=True, content_type="files", view_mode=get_view("list"), goto_top=False)
 | 
	
		
			
				|  |  | +def filter_years():
 | 
	
		
			
				|  |  | +    year = datetime.datetime.now().year
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    current_year = year
 | 
	
		
			
				|  |  | +    year_range = 0
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    items = []
 | 
	
		
			
				|  |  | +    while year - year_range >= 1949:
 | 
	
		
			
				|  |  | +        diff = current_year - year
 | 
	
		
			
				|  |  | +        if diff < 5:
 | 
	
		
			
				|  |  | +            year_range = 1
 | 
	
		
			
				|  |  | +        elif diff <= 10:
 | 
	
		
			
				|  |  | +            year_range = 5
 | 
	
		
			
				|  |  | +        else:
 | 
	
		
			
				|  |  | +            year_range = 10
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        min_year = (year - year_range + 1) if year_range != 1 else year
 | 
	
		
			
				|  |  | +        max_year = year
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        items.append({
 | 
	
		
			
				|  |  | +            "label": ("%s - %s" % (year - year_range + 1, year)) if year_range != 1 else str(year),
 | 
	
		
			
				|  |  | +            "path": PLUGIN.url_for(endpoint="view_list",
 | 
	
		
			
				|  |  | +                                   genre="all",
 | 
	
		
			
				|  |  | +                                   list_type="all",
 | 
	
		
			
				|  |  | +                                   view_types=VIEW_TYPES,
 | 
	
		
			
				|  |  | +                                   page=1,
 | 
	
		
			
				|  |  | +                                   query=0,
 | 
	
		
			
				|  |  | +                                   min_year=min_year,
 | 
	
		
			
				|  |  | +                                   max_year=max_year)
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        year -= year_range
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if year >= 1950:
 | 
	
		
			
				|  |  | +        diff = year - 1950
 | 
	
		
			
				|  |  | +        items.append({
 | 
	
		
			
				|  |  | +            "label": ("1950 - %s" % year) if diff > 1 else "1950",
 | 
	
		
			
				|  |  | +            "path": PLUGIN.url_for(endpoint="view_list",
 | 
	
		
			
				|  |  | +                                   genre="all",
 | 
	
		
			
				|  |  | +                                   list_type="all",
 | 
	
		
			
				|  |  | +                                   view_types=VIEW_TYPES,
 | 
	
		
			
				|  |  | +                                   page=1,
 | 
	
		
			
				|  |  | +                                   query=0,
 | 
	
		
			
				|  |  | +                                   min_year=1950,
 | 
	
		
			
				|  |  | +                                   max_year=year if diff > 1 else 1950)
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    items.append({
 | 
	
		
			
				|  |  | +        "label": "Jahr manuell eingeben",
 | 
	
		
			
				|  |  | +        "path": PLUGIN.url_for(endpoint="filter_years_manually"),
 | 
	
		
			
				|  |  | +    })
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    return items
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @PLUGIN.route("/updated_needed/", name="updated_needed", cache=True)
 | 
	
	
		
			
				|  | @@ -704,6 +1018,7 @@ def updated_needed():
 | 
	
		
			
				|  |  |      return items
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +# Main
 | 
	
		
			
				|  |  |  @PLUGIN.route("/", name="main", update=True, cache=False, content_type="files", view_mode=get_view("list"), goto_top=False)
 | 
	
		
			
				|  |  |  def main():
 | 
	
		
			
				|  |  |      items = []
 | 
	
	
		
			
				|  | @@ -738,19 +1053,18 @@ def main():
 | 
	
		
			
				|  |  |          if True:
 | 
	
		
			
				|  |  |              items.append({
 | 
	
		
			
				|  |  |                  "label": "Suche Film oder Serie",
 | 
	
		
			
				|  |  | -                "path": PLUGIN.url_for(endpoint="search",
 | 
	
		
			
				|  |  | -                                       is_actor=0),
 | 
	
		
			
				|  |  | +                "path": PLUGIN.url_for(endpoint="fuckinghell",
 | 
	
		
			
				|  |  | +                                       is_actor="0"),
 | 
	
		
			
				|  |  |                  "context_menu": [
 | 
	
		
			
				|  |  |                      ("", "")
 | 
	
		
			
				|  |  |                  ],
 | 
	
		
			
				|  |  |                  "replace_context_menu": True,
 | 
	
		
			
				|  |  |              })
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        if False:
 | 
	
		
			
				|  |  |              items.append({
 | 
	
		
			
				|  |  |                  "label": "Suche Schauspieler",
 | 
	
		
			
				|  |  | -                "path": PLUGIN.url_for(endpoint="search",
 | 
	
		
			
				|  |  | -                                       is_actor=1),
 | 
	
		
			
				|  |  | +                "path": PLUGIN.url_for(endpoint="fuckinghell",
 | 
	
		
			
				|  |  | +                                       is_actor="1"),
 | 
	
		
			
				|  |  |                  "context_menu": [
 | 
	
		
			
				|  |  |                      ("", "")
 | 
	
		
			
				|  |  |                  ],
 | 
	
	
		
			
				|  | @@ -761,8 +1075,6 @@ def main():
 | 
	
		
			
				|  |  |              if WATCHLIST_TOGETHER:
 | 
	
		
			
				|  |  |                  items.append({
 | 
	
		
			
				|  |  |                      "label": "Meine Liste",
 | 
	
		
			
				|  |  | -                    # "path": PLUGIN.url_for(endpoint="watchlist", page=1, type="0")
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |                      "path": PLUGIN.url_for(endpoint="view_list",
 | 
	
		
			
				|  |  |                                             list_type="watchlist",
 | 
	
		
			
				|  |  |                                             view_types=VIEW_TYPES,
 | 
	
	
		
			
				|  | @@ -776,7 +1088,6 @@ def main():
 | 
	
		
			
				|  |  |              else:
 | 
	
		
			
				|  |  |                  items.append({
 | 
	
		
			
				|  |  |                      "label": "Meine Filme",
 | 
	
		
			
				|  |  | -                    # "path": PLUGIN.url_for(endpoint="watchlist", page=1, type="1|3|4")
 | 
	
		
			
				|  |  |                      "path": PLUGIN.url_for(endpoint="view_list",
 | 
	
		
			
				|  |  |                                             list_type="watchlist-movies",
 | 
	
		
			
				|  |  |                                             view_types=VIEW_TYPES,
 | 
	
	
		
			
				|  | @@ -788,7 +1099,6 @@ def main():
 | 
	
		
			
				|  |  |                  })
 | 
	
		
			
				|  |  |                  items.append({
 | 
	
		
			
				|  |  |                      "label": "Meine Serien",
 | 
	
		
			
				|  |  | -                    # "path": PLUGIN.url_for(endpoint="watchlist", page=1, type="2|5")
 | 
	
		
			
				|  |  |                      "path": PLUGIN.url_for(endpoint="view_list",
 | 
	
		
			
				|  |  |                                             list_type="watchlist-shows",
 | 
	
		
			
				|  |  |                                             view_types=VIEW_TYPES,
 | 
	
	
		
			
				|  | @@ -850,7 +1160,7 @@ def main():
 | 
	
		
			
				|  |  |                                         max_year=0)
 | 
	
		
			
				|  |  |              })
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            if False:
 | 
	
		
			
				|  |  | +            if not HIDE_SERIES:
 | 
	
		
			
				|  |  |                  items.append({
 | 
	
		
			
				|  |  |                      "label": "UHD Serien",
 | 
	
		
			
				|  |  |                      "path": PLUGIN.url_for(endpoint="view_list",
 | 
	
	
		
			
				|  | @@ -858,8 +1168,8 @@ def main():
 | 
	
		
			
				|  |  |                                             list_type="uhd-shows",
 | 
	
		
			
				|  |  |                                             view_types="5",
 | 
	
		
			
				|  |  |                                             page=1,
 | 
	
		
			
				|  |  | -                                           min_year=0,
 | 
	
		
			
				|  |  |                                             query=0,
 | 
	
		
			
				|  |  | +                                           min_year=0,
 | 
	
		
			
				|  |  |                                             max_year=0)
 | 
	
		
			
				|  |  |                  })
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -878,7 +1188,7 @@ def main():
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if not HIDE_SERIES:
 | 
	
		
			
				|  |  |              items.append({
 | 
	
		
			
				|  |  | -                "label": "Serien",
 | 
	
		
			
				|  |  | +                "label": "HD Serien",
 | 
	
		
			
				|  |  |                  "path": PLUGIN.url_for(endpoint="view_list",
 | 
	
		
			
				|  |  |                                         genre="all",
 | 
	
		
			
				|  |  |                                         list_type="new-episodes",
 | 
	
	
		
			
				|  | @@ -914,6 +1224,11 @@ def main():
 | 
	
		
			
				|  |  |                                     max_year=0)
 | 
	
		
			
				|  |  |          })
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        items.append({
 | 
	
		
			
				|  |  | +            "label": "Filter",
 | 
	
		
			
				|  |  | +            "path": PLUGIN.url_for(endpoint="view_filters"),
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          if not HIDE_SETTINGS:
 | 
	
		
			
				|  |  |              items.append({
 | 
	
		
			
				|  |  |                  "label": "Einstellungen",
 | 
	
	
		
			
				|  | @@ -939,6 +1254,9 @@ def main():
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  # --------------------------------
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +__version__ = PLUGIN_VERSION
 | 
	
		
			
				|  |  | +__all__ = ["__run", "__output", "__version__"]
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  def __run():
 | 
	
		
			
				|  |  |      output("==================================== START ====================================")
 | 
	
	
		
			
				|  | @@ -954,7 +1272,7 @@ def __run():
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          try:
 | 
	
		
			
				|  |  |              os.chdir(os.path.dirname(os.path.abspath(__file__)))
 | 
	
		
			
				|  |  | -            if str(__file__).endswith(".py"):
 | 
	
		
			
				|  |  | +            if str(__file__).endswith(".py") and os.path.exists("%s.pyo" % __file__):
 | 
	
		
			
				|  |  |                  xbmc.sleep(100)
 | 
	
		
			
				|  |  |                  import glob
 | 
	
		
			
				|  |  |                  for file in glob.glob("framework/*.py"):
 | 
	
	
		
			
				|  | @@ -962,5 +1280,8 @@ def __run():
 | 
	
		
			
				|  |  |                  os.remove(__file__)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          except Exception as e:
 | 
	
		
			
				|  |  | +            #ifdef DEBUG
 | 
	
		
			
				|  |  |              if DEBUG:
 | 
	
		
			
				|  |  |                  output("Exception: %s" % repr(e))
 | 
	
		
			
				|  |  | +            #endif
 | 
	
		
			
				|  |  | +            pass
 |