本文整理匯總了Python中resources.lib.TheMovieDB類的典型用法代碼示例。如果您正苦於以下問題:Python TheMovieDB類的具體用法?Python TheMovieDB怎麽用?Python TheMovieDB使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了TheMovieDB類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: change_list_status
def change_list_status(self, control_id):
tmdb.change_fav_status(
media_id=self.info.get_property("id"),
media_type=self.TYPE_ALT,
status=str(not bool(self.states["favorite"])).lower(),
)
self.update_states()
示例2: context_menu
def context_menu(self, control_id):
item_id = self.FocusedItem(control_id).getProperty("id")
media_type = self.FocusedItem(control_id).getVideoInfoTag().getMediaType()
listitems = [addon.LANG(32169)] if media_type == "tvshow" else [addon.LANG(32113)]
if self.logged_in:
listitems += [addon.LANG(14076)]
if not self.type == "tv":
listitems += [addon.LANG(32107)]
if self.mode == "list":
listitems += [addon.LANG(32035)]
selection = xbmcgui.Dialog().contextmenu(list=listitems)
if selection == 0:
rating = utils.input_userrating()
if tmdb.set_rating(media_type="tv" if media_type == "tvshow" else "movie",
media_id=item_id,
rating=rating,
dbid=self.FocusedItem(control_id).getVideoInfoTag().getDbId()):
xbmc.sleep(2000)
self.update(force_update=True)
self.setCurrentListPosition(self.position)
elif selection == 1:
tmdb.change_fav_status(media_id=item_id,
media_type=self.type,
status="true")
elif selection == 2:
self.list_dialog(item_id)
elif selection == 3:
tmdb.change_list_status(list_id=self.list_id,
movie_id=item_id,
status=False)
self.update(force_update=True)
self.setCurrentListPosition(self.position)
示例3: get_episodes
def get_episodes(content):
shows = ItemList(content_type="episodes")
url = ""
if content == "shows":
url = 'calendars/shows/%s/14' % datetime.date.today()
elif content == "premieres":
url = 'calendars/shows/premieres/%s/14' % datetime.date.today()
results = get_data(url=url,
params={"extended": "full"},
cache_days=0.3)
count = 1
if not results:
return None
for day in results.iteritems():
for episode in day[1]:
ep = episode["episode"]
tv = episode["show"]
title = ep["title"] if ep["title"] else ""
label = u"{0} - {1}x{2}. {3}".format(tv["title"],
ep["season"],
ep["number"],
title)
show = VideoItem(label=label,
path=PLUGIN_BASE + 'extendedtvinfo&&tvdb_id=%s' % tv["ids"]["tvdb"])
show.set_infos({'title': title,
'aired': ep["first_aired"],
'season': ep["season"],
'episode': ep["number"],
'tvshowtitle': tv["title"],
'mediatype': "episode",
'year': tv.get("year"),
'duration': tv["runtime"] * 60 if tv["runtime"] else "",
'studio': tv["network"],
'plot': tv["overview"],
'country': tv["country"],
'status': tv["status"],
'trailer': tv["trailer"],
'imdbnumber': ep["ids"]["imdb"],
'rating': tv["rating"],
'genre': " / ".join(tv["genres"]),
'mpaa': tv["certification"]})
show.set_properties({'tvdb_id': ep["ids"]["tvdb"],
'id': ep["ids"]["tvdb"],
'imdb_id': ep["ids"]["imdb"],
'homepage': tv["homepage"]})
if tv["ids"].get("tmdb"):
art_info = tmdb.get_tvshow(tv["ids"]["tmdb"], light=True)
show.set_artwork(tmdb.get_image_urls(poster=art_info.get("poster_path"),
fanart=art_info.get("backdrop_path")))
shows.append(show)
count += 1
if count > 20:
break
return shows
示例4: __init__
def __init__(self, *args, **kwargs):
super(DialogEpisodeInfo, self).__init__(*args, **kwargs)
self.tvshow_id = kwargs.get('tvshow_id')
tv_info = tmdb.get_tvshow(self.tvshow_id, light=True)
data = tmdb.extended_episode_info(tvshow_id=self.tvshow_id,
season=kwargs.get('season'),
episode=kwargs.get('episode'))
if not data:
return None
self.info, self.lists, self.states = data
self.info.set_info("tvshowtitle", tv_info["name"])
image_info = imagetools.blur(self.info.get_art("thumb"))
self.info.update_properties(image_info)
示例5: add_to_list_button
def add_to_list_button(self, control_id):
busy.show_busy()
account_lists = tmdb.get_account_lists()
listitems = ["%s (%i)" % (i["name"], i["item_count"]) for i in account_lists]
listitems.insert(0, addon.LANG(32139))
listitems.append(addon.LANG(32138))
busy.hide_busy()
index = xbmcgui.Dialog().select(heading=addon.LANG(32136),
list=listitems)
if index == 0:
listname = xbmcgui.Dialog().input(heading=addon.LANG(32137),
type=xbmcgui.INPUT_ALPHANUM)
if not listname:
return None
list_id = tmdb.create_list(listname)
xbmc.sleep(1000)
tmdb.change_list_status(list_id=list_id,
movie_id=self.info.get_property("id"),
status=True)
elif index == len(listitems) - 1:
if tmdb.remove_list_dialog(tmdb.handle_lists(account_lists)):
self.update_states()
elif index > 0:
tmdb.change_list_status(account_lists[index - 1]["id"], self.info.get_property("id"), True)
self.update_states()
示例6: update_states
def update_states(self):
xbmc.sleep(2000) # delay because MovieDB takes some time to update
_, __, self.states = tmdb.extended_episode_info(tvshow_id=self.tvshow_id,
season=self.info.get_info("season"),
episode=self.info.get_info("episode"),
cache_time=0)
super(DialogEpisodeInfo, self).update_states()
示例7: set_rating_dialog
def set_rating_dialog(self, control_id):
rating = utils.input_userrating()
if tmdb.set_rating(media_type=self.TYPE_ALT,
media_id=self.get_identifier(),
rating=rating,
dbid=self.info.get("dbid")):
self.update_states()
示例8: __init__
def __init__(self, *args, **kwargs):
super(DialogActorInfo, self).__init__(*args, **kwargs)
data = tmdb.extended_actor_info(actor_id=kwargs.get('id'))
if not data:
return None
self.info, self.lists = data
self.info.update_properties(imagetools.blur(self.info.get_art("thumb")))
示例9: open_account_menu
def open_account_menu(self, control_id):
if self.type == "tv":
listitems = [addon.LANG(32145)]
if self.logged_in:
listitems.append(addon.LANG(32144))
else:
listitems = [addon.LANG(32135)]
if self.logged_in:
listitems.append(addon.LANG(32134))
wm.show_busy()
if self.logged_in:
account_lists = tmdb.get_account_lists()
listitems += ["%s (%i)" % (i["name"], i["item_count"]) for i in account_lists]
wm.hide_busy()
index = xbmcgui.Dialog().select(heading=addon.LANG(32136),
list=listitems)
if index == -1:
pass
elif index == 0:
self.sort = "created_at"
self.sort_label = addon.LANG(32157)
self.filters = []
self.reset("rating")
elif index == 1:
self.sort = "created_at"
self.sort_label = addon.LANG(32157)
self.filters = []
self.reset("favorites")
else:
self.close()
dialog = wm.open_video_list(filters=[],
mode="list",
list_id=account_lists[index - 2]["id"],
filter_label=account_lists[index - 2]["name"])
dialog.doModal()
示例10: update_states
def update_states(self):
xbmc.sleep(2000) # delay because MovieDB takes some time to update
info = tmdb.get_episode(tvshow_id=self.tvshow_id,
season=self.info.get_info("season"),
episode=self.info.get_info("episode"),
cache_days=0)
self.states = info.get("account_states")
super(DialogEpisodeInfo, self).update_states()
示例11: movie_context_menu
def movie_context_menu(self, control_id):
movie_id = self.FocusedItem(control_id).getProperty("id")
dbid = self.FocusedItem(control_id).getVideoInfoTag().getDbId()
options = [addon.LANG(32113)]
if self.logged_in:
options.append(addon.LANG(32083))
index = xbmcgui.Dialog().contextmenu(list=options)
if index == 0:
rating = utils.input_userrating()
if rating == -1:
return None
tmdb.set_rating(media_type="movie",
media_id=movie_id,
rating=rating,
dbid=dbid)
xbmc.sleep(2000)
tmdb.get_movie(movie_id=movie_id,
cache_days=0)
elif index == 1:
account_lists = tmdb.get_account_lists()
if not account_lists:
return False
listitems = ["%s (%i)" % (i["name"], i["item_count"]) for i in account_lists]
i = xbmcgui.Dialog().select(addon.LANG(32136), listitems)
if i > -1:
tmdb.change_list_status(list_id=account_lists[i]["id"],
movie_id=movie_id,
status=True)
示例12: set_rating_dialog
def set_rating_dialog(self, control_id):
preselect = int(self.states["rated"]["value"]) if (self.states and self.states.get("rated")) else -1
rating = utils.input_userrating(preselect=preselect)
if rating == -1:
return None
if tmdb.set_rating(
media_type=self.TYPE_ALT, media_id=self.get_identifier(), rating=rating, dbid=self.info.get_info("dbid")
):
self.setProperty("rated", str(rating) if rating > 0 else "")
self.update_states()
示例13: __init__
def __init__(self, *args, **kwargs):
super(DialogTVShowInfo, self).__init__(*args, **kwargs)
data = tmdb.extended_tvshow_info(tvshow_id=kwargs.get('tmdb_id', False),
dbid=self.dbid)
if not data:
return None
self.info, self.lists, self.states = data
if not self.info.get_info("dbid"):
self.info.set_art("poster", utils.get_file(self.info.get_art("poster")))
self.info.update_properties(imagetools.blur(self.info.get_art("poster")))
示例14: __init__
def __init__(self, *args, **kwargs):
super(DialogEpisodeInfo, self).__init__(*args, **kwargs)
self.tvshow_id = kwargs.get('tvshow_id')
data = tmdb.extended_episode_info(tvshow_id=self.tvshow_id,
season=kwargs.get('season'),
episode=kwargs.get('episode'))
if not data:
return None
self.info, self.lists, self.states = data
self.info.update_properties(imagetools.blur(self.info.get("thumb")))
示例15: set_actor_filter
def set_actor_filter(self, control_id):
result = xbmcgui.Dialog().input(heading=addon.LANG(16017),
type=xbmcgui.INPUT_ALPHANUM)
if not result or result == -1:
return None
response = tmdb.get_person_info(result)
if not response:
return None
self.add_filter(key="with_people",
value=response["id"],
label=response["name"])