예제 #1
0
    def open_season_info(self, prev_window=None, tvshow_id=None,
                         season=None, tvshow=None, dbid=None):
        """
        open season info, deal with window stack
        needs *season AND (*tvshow_id OR *tvshow)
        """
        xbmc.executebuiltin("ActivateWindow(busydialog)")
        from dialogs import DialogSeasonInfo
        dbid = int(dbid) if dbid and int(dbid) > 0 else None
        if not tvshow_id:
            params = {"query": tvshow,
                      "language": SETTING("language")}
            response = TheMovieDB.get_data(url="search/tv",
                                           params=params,
                                           cache_days=30)
            if response["results"]:
                tvshow_id = str(response['results'][0]['id'])
            else:
                params = {"query": re.sub('\(.*?\)', '', tvshow),
                          "language": SETTING("language")}
                response = TheMovieDB.get_data(url="search/tv",
                                               params=params,
                                               cache_days=30)
                if response["results"]:
                    tvshow_id = str(response['results'][0]['id'])

        season_class = DialogSeasonInfo.get_window(self.window_type)
        dialog = season_class(INFO_DIALOG_FILE,
                              ADDON_PATH,
                              id=tvshow_id,
                              season=season,
                              dbid=dbid)
        xbmc.executebuiltin("Dialog.Close(busydialog)")
        self.open_dialog(dialog, prev_window)
예제 #2
0
    def open_season_info(self, tvshow_id=None, season=None, tvshow=None, dbid=None):
        """
        open season info, deal with window stack
        needs *season AND (*tvshow_id OR *tvshow)
        """
        busy.show_busy()
        from dialogs.DialogSeasonInfo import DialogSeasonInfo
        if not tvshow_id:
            params = {"query": tvshow,
                      "language": addon.setting("language")}
            response = tmdb.get_data(url="search/tv",
                                     params=params,
                                     cache_days=30)
            if response["results"]:
                tvshow_id = str(response['results'][0]['id'])
            else:
                params = {"query": re.sub('\(.*?\)', '', tvshow),
                          "language": addon.setting("language")}
                response = tmdb.get_data(url="search/tv",
                                         params=params,
                                         cache_days=30)
                if response["results"]:
                    tvshow_id = str(response['results'][0]['id'])

        dialog = DialogSeasonInfo(INFO_XML,
                                  addon.PATH,
                                  id=tvshow_id,
                                  season=max(0, season),
                                  dbid=int(dbid) if dbid and int(dbid) > 0 else None)
        busy.hide_busy()
        self.open_infodialog(dialog)
예제 #3
0
    def open_season_info(self, prev_window=None, tvshow_id=None,
                         season=None, tvshow=None, dbid=None):
        """
        open season info, deal with window stack
        needs *season AND (*tvshow_id OR *tvshow)
        """
        self.show_busy()
        from dialogs import DialogSeasonInfo
        dbid = int(dbid) if dbid and int(dbid) > 0 else None
        if not tvshow_id:
            params = {"query": tvshow,
                      "language": addon.setting("language")}
            response = TheMovieDB.get_data(url="search/tv",
                                           params=params,
                                           cache_days=30)
            if response["results"]:
                tvshow_id = str(response['results'][0]['id'])
            else:
                params = {"query": re.sub('\(.*?\)', '', tvshow),
                          "language": addon.setting("language")}
                response = TheMovieDB.get_data(url="search/tv",
                                               params=params,
                                               cache_days=30)
                if response["results"]:
                    tvshow_id = str(response['results'][0]['id'])

        season_class = DialogSeasonInfo.get_window(windows.DialogXML)
        dialog = season_class(INFO_XML,
                              addon.PATH,
                              id=tvshow_id,
                              season=season,
                              dbid=dbid)
        self.hide_busy()
        self.open_dialog(dialog, prev_window)
예제 #4
0
 def open_episode_info(self,
                       prev_window=None,
                       tvshow_id=None,
                       season=None,
                       episode=None,
                       tvshow=None,
                       dbid=None):
     """
     open season info, deal with window stack
     needs (*tvshow_id OR *tvshow) AND *season AND *episode
     """
     from dialogs import DialogEpisodeInfo
     ep_class = DialogEpisodeInfo.get_window(self.window_type)
     if not tvshow_id and tvshow:
         params = {"query": tvshow, "language": SETTING("language")}
         response = TheMovieDB.get_data(url="search/tv",
                                        params=params,
                                        cache_days=30)
         if response["results"]:
             tvshow_id = str(response['results'][0]['id'])
     dialog = ep_class(INFO_DIALOG_FILE,
                       ADDON_PATH,
                       show_id=tvshow_id,
                       season=season,
                       episode=episode,
                       dbid=dbid)
     self.open_dialog(dialog, prev_window)
예제 #5
0
def get_media_meta_movie_id():
    global _year_, _media_type_
    if _title_ == "":
        return ""
    params = {"query": _title_, "language": "ru", "include_adult": True}
    if _year_ != "":
        params["year"] = int(_year_)
    try:
        response = tmdb.get_data(url="search/%s" % (get_media_category()),
                                 params=params,
                                 cache_days=1)
    except:
        try:
            params = {k: encode_(v) for k, v in params.iteritems() if v}
            xbmc.log("url=" +
                     ("search/%s?%s&" %
                      (get_media_category(), urllib.urlencode(params))))
            response = tmdb.get_tmdb_data(
                url="search/%s?%s&" %
                (get_media_category(), urllib.urlencode(params)),
                cache_days=1)
        except:
            return None
    if response and (not (response == "Empty")):
        if len(response['results']) > 0:
            return select_media(response["results"])
        else:
            return None
    else:
        return None
    def open_season_info(self,
                         prev_window=None,
                         tvshow_id=None,
                         season=None,
                         tvshow=None,
                         dbid=None):
        """
        open season info, deal with window stack
        needs *season AND (*tvshow_id OR *tvshow)
        """
        self.show_busy()
        from dialogs import DialogSeasonInfo
        dbid = int(dbid) if dbid and int(dbid) > 0 else None
        if not tvshow_id:
            params = {"query": tvshow, "language": addon.setting("language")}
            response = TheMovieDB.get_data(url="search/tv",
                                           params=params,
                                           cache_days=30)
            if response["results"]:
                tvshow_id = str(response['results'][0]['id'])
            else:
                params = {
                    "query": re.sub('\(.*?\)', '', tvshow),
                    "language": addon.setting("language")
                }
                response = TheMovieDB.get_data(url="search/tv",
                                               params=params,
                                               cache_days=30)
                if response["results"]:
                    tvshow_id = str(response['results'][0]['id'])

        season_class = DialogSeasonInfo.get_window(windows.DialogXML)
        dialog = season_class(INFO_XML,
                              addon.PATH,
                              id=tvshow_id,
                              season=season,
                              dbid=dbid)
        self.hide_busy()
        self.open_dialog(dialog, prev_window)
예제 #7
0
    def open_season_info(self,
                         prev_window=None,
                         tvshow_id=None,
                         season=None,
                         tvshow=None,
                         dbid=None):
        """
        open season info, deal with window stack
        needs *season AND (*tvshow_id OR *tvshow)
        """
        xbmc.executebuiltin("ActivateWindow(busydialog)")
        from dialogs import DialogSeasonInfo
        dbid = int(dbid) if dbid and int(dbid) > 0 else None
        if not tvshow_id:
            params = {"query": tvshow, "language": SETTING("language")}
            response = TheMovieDB.get_data(url="search/tv",
                                           params=params,
                                           cache_days=30)
            if response["results"]:
                tvshow_id = str(response['results'][0]['id'])
            else:
                params = {
                    "query": re.sub('\(.*?\)', '', tvshow),
                    "language": SETTING("language")
                }
                response = TheMovieDB.get_data(url="search/tv",
                                               params=params,
                                               cache_days=30)
                if response["results"]:
                    tvshow_id = str(response['results'][0]['id'])

        season_class = DialogSeasonInfo.get_window(self.window_type)
        dialog = season_class(INFO_DIALOG_FILE,
                              ADDON_PATH,
                              id=tvshow_id,
                              season=season,
                              dbid=dbid)
        xbmc.executebuiltin("Dialog.Close(busydialog)")
        self.open_dialog(dialog, prev_window)
예제 #8
0
    def open_season_info(self,
                         tvshow_id=None,
                         season=None,
                         tvshow=None,
                         dbid=None):
        """
        open season info, deal with window stack
        needs *season AND (*tvshow_id OR *tvshow)
        """
        busy.show_busy()
        from dialogs.DialogSeasonInfo import DialogSeasonInfo
        if not tvshow_id:
            params = {"query": tvshow, "language": addon.setting("language")}
            response = tmdb.get_data(url="search/tv",
                                     params=params,
                                     cache_days=30)
            if response["results"]:
                tvshow_id = str(response['results'][0]['id'])
            else:
                params = {
                    "query": re.sub('\(.*?\)', '', tvshow),
                    "language": addon.setting("language")
                }
                response = tmdb.get_data(url="search/tv",
                                         params=params,
                                         cache_days=30)
                if response["results"]:
                    tvshow_id = str(response['results'][0]['id'])

        dialog = DialogSeasonInfo(
            INFO_XML,
            addon.PATH,
            id=tvshow_id,
            season=max(0, season),
            dbid=int(dbid) if dbid and int(dbid) > 0 else None)
        busy.hide_busy()
        self.open_infodialog(dialog)
예제 #9
0
 def open_episode_info(self, prev_window=None, tvshow_id=None, season=None,
                       episode=None, tvshow=None, dbid=None):
     """
     open season info, deal with window stack
     needs (*tvshow_id OR *tvshow) AND *season AND *episode
     """
     from dialogs import DialogEpisodeInfo
     ep_class = DialogEpisodeInfo.get_window(self.window_type)
     if not tvshow_id and tvshow:
         params = {"query": tvshow,
                   "language": SETTING("language")}
         response = TheMovieDB.get_data(url="search/tv",
                                        params=params,
                                        cache_days=30)
         if response["results"]:
             tvshow_id = str(response['results'][0]['id'])
     dialog = ep_class(INFO_DIALOG_FILE,
                       ADDON_PATH,
                       show_id=tvshow_id,
                       season=season,
                       episode=episode,
                       dbid=dbid)
     self.open_dialog(dialog, prev_window)