本文整理匯總了Python中resources.lib.TheMovieDB.set_rating方法的典型用法代碼示例。如果您正苦於以下問題:Python TheMovieDB.set_rating方法的具體用法?Python TheMovieDB.set_rating怎麽用?Python TheMovieDB.set_rating使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類resources.lib.TheMovieDB
的用法示例。
在下文中一共展示了TheMovieDB.set_rating方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: movie_context_menu
# 需要導入模塊: from resources.lib import TheMovieDB [as 別名]
# 或者: from resources.lib.TheMovieDB import set_rating [as 別名]
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)
示例2: context_menu
# 需要導入模塊: from resources.lib import TheMovieDB [as 別名]
# 或者: from resources.lib.TheMovieDB import set_rating [as 別名]
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: set_rating_dialog
# 需要導入模塊: from resources.lib import TheMovieDB [as 別名]
# 或者: from resources.lib.TheMovieDB import set_rating [as 別名]
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()
示例4: set_rating_dialog
# 需要導入模塊: from resources.lib import TheMovieDB [as 別名]
# 或者: from resources.lib.TheMovieDB import set_rating [as 別名]
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()
示例5: tvshow_context_menu
# 需要導入模塊: from resources.lib import TheMovieDB [as 別名]
# 或者: from resources.lib.TheMovieDB import set_rating [as 別名]
def tvshow_context_menu(self, control_id):
tvshow_id = self.FocusedItem(control_id).getProperty("id")
dbid = self.FocusedItem(control_id).getVideoInfoTag().getDbId()
credit_id = self.FocusedItem(control_id).getProperty("credit_id")
options = [addon.LANG(32169)]
if credit_id:
options.append(addon.LANG(32147))
index = xbmcgui.Dialog().contextmenu(list=options)
if index == 0:
rating = utils.input_userrating()
if rating == -1:
return None
tmdb.set_rating(media_type="tvshow",
media_id=tvshow_id,
rating=rating,
dbid=dbid)
xbmc.sleep(2000)
tmdb.get_tvshow(tvshow_id=tvshow_id,
cache_days=0)
if index == 1:
self.open_credit_dialog(credit_id=credit_id)
示例6: context_menu
# 需要導入模塊: from resources.lib import TheMovieDB [as 別名]
# 或者: from resources.lib.TheMovieDB import set_rating [as 別名]
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)]
index = xbmcgui.Dialog().contextmenu(list=listitems)
if index == 0:
# HACK until we can get userrating from listitem via python
rating = utils.get_infolabel("listitem.userrating")
rating = utils.input_userrating(preselect=int(rating) if rating.isdigit() else -1)
if rating == -1:
return None
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 index == 1:
tmdb.change_fav_status(media_id=item_id,
media_type=self.type,
status="true")
elif index == 2:
self.list_dialog(item_id)
elif index == 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)
示例7: start_info_actions
# 需要導入模塊: from resources.lib import TheMovieDB [as 別名]
# 或者: from resources.lib.TheMovieDB import set_rating [as 別名]
#.........這裏部分代碼省略.........
addon.clear_global('infodialogs.active')
elif info == 'extendedtvinfo':
if addon.get_global('infodialogs.active'):
return None
addon.set_global('infodialogs.active', "true")
wm.open_tvshow_info(tmdb_id=params.get("id"),
tvdb_id=params.get("tvdb_id"),
dbid=params.get("dbid"),
imdb_id=params.get("imdb_id"),
name=params.get("name"))
addon.clear_global('infodialogs.active')
elif info == 'seasoninfo':
if addon.get_global('infodialogs.active'):
return None
addon.set_global('infodialogs.active', "true")
wm.open_season_info(tvshow=params.get("tvshow"),
dbid=params.get("dbid"),
season=params.get("season"))
addon.clear_global('infodialogs.active')
elif info == 'extendedepisodeinfo':
if addon.get_global('infodialogs.active'):
return None
addon.set_global('infodialogs.active', "true")
wm.open_episode_info(tvshow=params.get("tvshow"),
tvshow_id=params.get("tvshow_id"),
dbid=params.get("dbid"),
episode=params.get("episode"),
season=params.get("season"))
addon.clear_global('infodialogs.active')
elif info == 'albuminfo':
if params.get("id"):
album_details = AudioDB.get_album_details(params.get("id"))
utils.dict_to_windowprops(album_details, params.get("prefix", ""))
elif info == 'artistdetails':
artist_details = AudioDB.get_artist_details(params["artistname"])
utils.dict_to_windowprops(artist_details, params.get("prefix", ""))
elif info == 'ratemedia':
media_type = params.get("type")
if not media_type:
return None
if params.get("id"):
tmdb_id = params["id"]
elif media_type == "movie":
tmdb_id = tmdb.get_movie_tmdb_id(imdb_id=params.get("imdb_id"),
dbid=params.get("dbid"),
name=params.get("name"))
elif media_type == "tv" and params.get("dbid"):
tvdb_id = local_db.get_imdb_id(media_type="tvshow",
dbid=params["dbid"])
tmdb_id = tmdb.get_show_tmdb_id(tvdb_id=tvdb_id)
else:
return False
rating = utils.input_userrating()
if rating == -1:
return None
tmdb.set_rating(media_type=media_type,
media_id=tmdb_id,
rating=rating,
dbid=params.get("dbid"))
elif info == 'action':
for builtin in params.get("id", "").split("$$"):
xbmc.executebuiltin(builtin)
elif info == "youtubevideo":
xbmc.executebuiltin("Dialog.Close(all,true)")
wm.play_youtube_video(params.get("id", ""))
elif info == 'playtrailer':
busy.show_busy()
if params.get("id"):
movie_id = params["id"]
elif int(params.get("dbid", -1)) > 0:
movie_id = local_db.get_imdb_id(media_type="movie",
dbid=params["dbid"])
elif params.get("imdb_id"):
movie_id = tmdb.get_movie_tmdb_id(params["imdb_id"])
else:
movie_id = ""
if movie_id:
trailers = tmdb.get_movie_videos(movie_id)
busy.hide_busy()
time.sleep(0.1)
if trailers:
wm.play_youtube_video(trailers[0]["key"])
elif params.get("title"):
wm.open_youtube_list(search_str=params["title"])
else:
busy.hide_busy()
elif info == 'deletecache':
addon.clear_globals()
for rel_path in os.listdir(addon.DATA_PATH):
path = os.path.join(addon.DATA_PATH, rel_path)
try:
if os.path.isdir(path):
shutil.rmtree(path)
except Exception as e:
utils.log(e)
utils.notify("Cache deleted")
elif info == 'tmdbpassword':
addon.set_password_prompt("tmdb_password")
elif info == 'syncwatchlist':
pass