本文整理匯總了Python中resources.lib.TheMovieDB.multi_search方法的典型用法代碼示例。如果您正苦於以下問題:Python TheMovieDB.multi_search方法的具體用法?Python TheMovieDB.multi_search怎麽用?Python TheMovieDB.multi_search使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類resources.lib.TheMovieDB
的用法示例。
在下文中一共展示了TheMovieDB.multi_search方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: fetch_data
# 需要導入模塊: from resources.lib import TheMovieDB [as 別名]
# 或者: from resources.lib.TheMovieDB import multi_search [as 別名]
def fetch_data(self, force=False): # TODO: rewrite
sort_by = self.sort + "." + self.order
temp = "tv" if self.type == "tv" else "movies"
if self.mode == "search":
self.filter_label = addon.LANG(32146) % self.search_str if self.search_str else ""
return tmdb.multi_search(search_str=self.search_str,
page=self.page,
cache_days=0 if force else 2)
elif self.mode == "list":
return tmdb.get_list_movies(list_id=self.list_id,
force=force)
elif self.mode == "favorites":
self.filter_label = addon.LANG(32144) if self.type == "tv" else addon.LANG(32134)
return tmdb.get_fav_items(media_type=temp,
sort_by=sort_by,
page=self.page)
elif self.mode == "rating":
self.filter_label = addon.LANG(32145) if self.type == "tv" else addon.LANG(32135)
return tmdb.get_rated_media_items(media_type=temp,
sort_by=sort_by,
page=self.page,
cache_days=0)
else:
self.set_filter_label()
params = {"sort_by": sort_by,
"language": addon.setting("LanguageID"),
"page": self.page,
"include_adult": include_adult}
filters = {item["type"]: item["id"] for item in self.filters}
response = tmdb.get_data(url="discover/%s" % (self.type),
params=utils.merge_dicts(params, filters),
cache_days=0 if force else 2)
if not response["results"]:
utils.notify(addon.LANG(284))
return None
if self.type == "movie":
itemlist = tmdb.handle_movies(results=response["results"],
local_first=False,
sortkey=None)
else:
itemlist = tmdb.handle_tvshows(results=response["results"],
local_first=False,
sortkey=None)
itemlist.set_totals(response["total_results"])
itemlist.set_total_pages(response["total_pages"])
return itemlist