• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python utilities.isEpisode函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中utilities.isEpisode函数的典型用法代码示例。如果您正苦于以下问题:Python isEpisode函数的具体用法?Python isEpisode怎么用?Python isEpisode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了isEpisode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: doManualRating

    def doManualRating(self, data):
        action = data['action']
        media_type = data['media_type']
        summaryInfo = None

        if not utilities.isValidMediaType(media_type):
            logger.debug("doManualRating(): Invalid media type '%s' passed for manual %s." % (media_type, action))
            return

        if not data['action'] in ['rate', 'unrate']:
            logger.debug("doManualRating(): Unknown action passed.")
            return

        logger.debug("Getting data for manual %s of %s: video_id: |%s| dbid: |%s|" % (action, media_type, data.get('video_id'), data.get('dbid')))

        id_type = utilities.parseIdToTraktIds(str(data['video_id']), media_type)[1]

        if not id_type:
            logger.debug("doManualRating(): Unrecognized id_type: |%s|-|%s|." % (media_type, data['video_id']))
            return
            
        ids = globals.traktapi.getIdLookup(data['video_id'], id_type)
        
        if not ids:
            logger.debug("doManualRating(): No Results for: |%s|-|%s|." % (media_type, data['video_id']))
            return
            
        trakt_id = dict(ids[0].keys)['trakt']
        if utilities.isEpisode(media_type):
            summaryInfo = globals.traktapi.getEpisodeSummary(trakt_id, data['season'], data['episode'])
            userInfo = globals.traktapi.getEpisodeRatingForUser(trakt_id, data['season'], data['episode'], 'trakt')
        elif utilities.isSeason(media_type):
            summaryInfo = globals.traktapi.getShowSummary(trakt_id)
            userInfo = globals.traktapi.getSeasonRatingForUser(trakt_id, data['season'], 'trakt')
        elif utilities.isShow(media_type):
            summaryInfo = globals.traktapi.getShowSummary(trakt_id)
            userInfo = globals.traktapi.getShowRatingForUser(trakt_id, 'trakt')
        elif utilities.isMovie(media_type):
            summaryInfo = globals.traktapi.getMovieSummary(trakt_id)
            userInfo = globals.traktapi.getMovieRatingForUser(trakt_id, 'trakt')

        if summaryInfo is not None:
            summaryInfo = summaryInfo.to_dict()
            summaryInfo['user'] = {'ratings': userInfo}
            if utilities.isEpisode(media_type):
                summaryInfo['season'] = data['season']
                summaryInfo['number'] = data['episode']
            elif utilities.isSeason(media_type):
                summaryInfo['season'] = data['season']

            if action == 'rate':
                if not 'rating' in data:
                    rateMedia(media_type, [summaryInfo])
                else:
                    rateMedia(media_type, [summaryInfo], rating=data['rating'])
        else:
            logger.debug("doManualRating(): Summary info was empty, possible problem retrieving data from Trakt.tv")
开发者ID:beljim,项目名称:tknorris-beta-repo,代码行数:57,代码来源:service.py


示例2: rateOnTrakt

def rateOnTrakt(rating, media_type, media):
	Debug("[Rating] Sending rating (%s) to trakt.tv" % rating)
	if utilities.isMovie(media_type):
		params = {}
		params['title'] = media['title']
		params['year'] = media['year']
		params['rating'] = rating
		params['tmdb_id'] = media['tmdb_id']
		params['imdb_id'] = media['imdb_id']

		data = globals.traktapi.rateMovie(params)

	elif utilities.isEpisode(media_type):
		params = {}
		params['title'] = media['show']['title']
		params['year'] = media['show']['year']
		params['season'] = media['episode']['season']
		params['episode'] = media['episode']['number']
		params['rating'] = rating
		params['tvdb_id'] = media['show']['tvdb_id']
		params['imdb_id'] = media['show']['imdb_id']

		data = globals.traktapi.rateEpisode(params)

	else:
		return

	if data != None:
		notification(utilities.getString(1201), utilities.getString(1167)) # Rating submitted successfully
开发者ID:chx0003,项目名称:script.trakt,代码行数:29,代码来源:rating.py


示例3: rateMedia

def rateMedia(media_type, summary_info):
	"""Launches the rating dialog"""
	if utilities.isMovie(media_type):
		if summary_info['rating'] or summary_info['rating_advanced']:
			Debug("[Rating] Movie has already been rated.")
			return

	elif utilities.isEpisode(media_type):
		if summary_info['episode']['rating'] or summary_info['episode']['rating_advanced']:
			Debug("[Rating] Episode has already been rated.")
			return

	else:
		return

	if not globals.traktapi.settings:
		globals.traktapi.getAccountSettings()
	rating_type = globals.traktapi.settings['viewing']['ratings']['mode']
	xbmc.executebuiltin('Dialog.Close(all, true)')

	gui = RatingDialog(
		"RatingDialog.xml",
		__addon__.getAddonInfo('path'),
		media_type=media_type,
		media=summary_info,
		rating_type=rating_type
	)

	gui.doModal()
	if gui.rating:
		rateOnTrakt(gui.rating, gui.media_type, gui.media)
	del gui
开发者ID:chx0003,项目名称:script.trakt,代码行数:32,代码来源:rating.py


示例4: onInit

	def onInit(self):
		lang = utils.getString
		mange_string = lang(2000) if utils.isMovie(self.media_type) else lang(2001)
		rate_string = lang(2030)
		if utils.isShow(self.media_type):
			rate_string = lang(2031)
		elif utils.isEpisode(self.media_type):
			rate_string = lang(2032)

		actions = [mange_string, lang(2010), lang(2020), rate_string, lang(2040), lang(2050), lang(2060), lang(2070)]
		keys = ["itemlists", "removefromlist", "addtolist", "rate", "togglewatched", "managelists", "updatetags", "sync"]

		l = self.getControl(ACTION_LIST)
		for i in range(len(actions)):
			if keys[i] in self.buttons:
				l.addItem(self.newListItem(actions[i], id=keys[i]))

		h = ((len(self.buttons)) * 46) - 6
		l.setHeight(h)

		d = self.getControl(DIALOG_IMAGE)
		d.setHeight(h + 40)

		offset = (316 - h) / 2

		d.setPosition(0, offset - 20)
		l.setPosition(20, offset)

		self.setFocus(l)
开发者ID:Mafarricos,项目名称:Mafarricos-modded-xbmc-addons,代码行数:29,代码来源:traktContextMenu.py


示例5: __rateOnTrakt

def __rateOnTrakt(rating, media_type, media, unrate=False):
    logger.debug("Sending rating (%s) to Trakt.tv" % rating)

    params = media
    if utils.isMovie(media_type):
        key = 'movies'
        params['rating'] = rating
    elif utils.isShow(media_type):
        key = 'shows'
        params['rating'] = rating
    elif utils.isSeason(media_type):
        key = 'shows'
        params['seasons'] = [{'rating': rating, 'number': media['season']}]
    elif utils.isEpisode(media_type):
        key = 'episodes'
        params['rating'] = rating
    else:
        return
    root = {key: [params]}

    if not unrate:
        data = globals.traktapi.addRating(root)
    else:
        data = globals.traktapi.removeRating(root)

    if data:
        s = utils.getFormattedItemName(media_type, media)
        if 'not_found' in data and not data['not_found']['movies'] and not data['not_found']['episodes'] and not data['not_found']['shows']:

            if not unrate:
                utils.notification(utils.getString(32040), s)
            else:
                utils.notification(utils.getString(32042), s)
        else:
            utils.notification(utils.getString(32044), s)
开发者ID:AMOboxTV,项目名称:AMOBox.LegoBuild,代码行数:35,代码来源:rating.py


示例6: __scrobble

    def __scrobble(self, status):
        if not self.curVideoInfo:
            return

        logger.debug("scrobble()")
        scrobbleMovieOption = utilities.getSettingAsBool("scrobble_movie")
        scrobbleEpisodeOption = utilities.getSettingAsBool("scrobble_episode")

        watchedPercent = self.__calculateWatchedPercent()

        if utilities.isMovie(self.curVideo["type"]) and scrobbleMovieOption:
            response = self.traktapi.scrobbleMovie(self.curVideoInfo, watchedPercent, status)
            if not response is None:
                self.__scrobbleNotification(response)
                logger.debug("Scrobble response: %s" % str(response))
                return response

        elif utilities.isEpisode(self.curVideo["type"]) and scrobbleEpisodeOption:
            if self.isMultiPartEpisode:
                logger.debug(
                    "Multi-part episode, scrobbling part %d of %d."
                    % (self.curMPEpisode + 1, self.curVideo["multi_episode_count"])
                )
                adjustedDuration = int(self.videoDuration / self.curVideo["multi_episode_count"])
                watchedPercent = ((self.watchedTime - (adjustedDuration * self.curMPEpisode)) / adjustedDuration) * 100

            response = self.traktapi.scrobbleEpisode(self.traktShowSummary, self.curVideoInfo, watchedPercent, status)

            if response is not None:
                self.__scrobbleNotification(response)
                logger.debug("Scrobble response: %s" % str(response))
                return response
开发者ID:rickardrocks,项目名称:tknorris-beta-repo,代码行数:32,代码来源:scrobbler.py


示例7: onInit

    def onInit(self):
        lang = utils.getString
        mange_string = lang(32133) if utils.isMovie(self.media_type) else lang(32134)
        rate_string = lang(32137)
        if utils.isShow(self.media_type):
            rate_string = lang(32138)
        elif utils.isSeason(self.media_type):
            rate_string = lang(32149)
        elif utils.isEpisode(self.media_type):
            rate_string = lang(32139)

        actions = [mange_string, lang(32135), lang(32136), rate_string, lang(32140), lang(32141), lang(32142), lang(32143)]
        keys = ["itemlists", "removefromlist", "addtolist", "rate", "togglewatched", "managelists", "updatetags",
                "sync"]

        l = self.getControl(ACTION_LIST)
        for i in range(len(actions)):
            if keys[i] in self.buttons:
                l.addItem(self.newListItem(actions[i], id=keys[i]))

        h = ((len(self.buttons)) * 46) - 6
        l.setHeight(h)

        d = self.getControl(DIALOG_IMAGE)
        d.setHeight(h + 40)

        self.setFocus(l)
开发者ID:CatoV9,项目名称:script.trakt,代码行数:27,代码来源:traktContextMenu.py


示例8: doManualRating

    def doManualRating(self, data):
        action = data['action']
        media_type = data['media_type']
        summaryInfo = None

        if not utilities.isValidMediaType(media_type):
            logger.debug("doManualRating(): Invalid media type '%s' passed for manual %s." % (media_type, action))
            return

        if not data['action'] in ['rate', 'unrate']:
            logger.debug("doManualRating(): Unknown action passed.")
            return

        logger.debug("Getting data for manual %s of %s: imdb: |%s| dbid: |%s|" % (action, media_type, data.get('remoteid'), data.get('dbid')))

        if utilities.isEpisode(media_type):
            summaryInfo = globals.traktapi.getEpisodeSummary(data['imdbnumber'], data['season'], data['episode'])
            userInfo = globals.traktapi.getEpisodeRatingForUser(data['imdbnumber'], data['season'], data['episode'], 'imdb')
        elif utilities.isSeason(media_type):
            summaryInfo = globals.traktapi.getShowSummary(data['imdbnumber'])
            userInfo = globals.traktapi.getSeasonRatingForUser(data['imdbnumber'], data['season'], 'imdb')
        elif utilities.isShow(media_type):
            summaryInfo = globals.traktapi.getShowSummary(data['imdbnumber'])
            userInfo = globals.traktapi.getShowRatingForUser(data['imdbnumber'], 'imdb')
        elif utilities.isMovie(media_type):
            summaryInfo = globals.traktapi.getMovieSummary(data['imdbnumber'])
            userInfo = globals.traktapi.getMovieRatingForUser(data['imdbnumber'])

        if summaryInfo is not None:
            summaryInfo = summaryInfo.to_dict()
            summaryInfo['user'] = {'ratings': userInfo}
            if utilities.isEpisode(media_type):
                summaryInfo['season'] = data['season']
                summaryInfo['number'] = data['episode']
            elif utilities.isSeason(media_type):
                summaryInfo['season'] = data['season']

            if action == 'rate':
                if not 'rating' in data:
                    rateMedia(media_type, [summaryInfo])
                else:
                    rateMedia(media_type, [summaryInfo], rating=data['rating'])
        else:
            logger.debug("doManualRating(): Summary info was empty, possible problem retrieving data from Trakt.tv")
开发者ID:TonyPh12345,项目名称:kodibrasilforum,代码行数:44,代码来源:service.py


示例9: watching

	def watching(self):
		if not self.isPlaying:
			return

		if not self.curVideoInfo:
			return

		Debug("[Scrobbler] watching()")
		scrobbleMovieOption = utilities.getSettingAsBool('scrobble_movie')
		scrobbleEpisodeOption = utilities.getSettingAsBool('scrobble_episode')

		self.update(True)

		duration = self.videoDuration / 60
		watchedPercent = (self.watchedTime / self.videoDuration) * 100

		if utilities.isMovie(self.curVideo['type']) and scrobbleMovieOption:
			response = self.traktapi.watchingMovie(self.curVideoInfo, duration, watchedPercent)
			if response != None:
				if self.curVideoInfo['imdbnumber'] is None:
					if 'status' in response and response['status'] == "success":
						if 'movie' in response and 'imdb_id' in response['movie']:
							self.curVideoInfo['imdbnumber'] = response['movie']['imdb_id']
							if 'id' in self.curVideo and utilities.getSettingAsBool('update_imdb_id'):
								req = {"jsonrpc": "2.0", "id": 1, "method": "VideoLibrary.SetMovieDetails", "params": {"movieid" : self.curVideoInfo['movieid'], "imdbnumber": self.curVideoInfo['imdbnumber']}}
								utilities.xbmcJsonRequest(req)
							# get summary data now if we are rating this movie
							if utilities.getSettingAsBool('rate_movie') and self.traktSummaryInfo is None:
								Debug("[Scrobbler] Movie rating is enabled, pre-fetching summary information.")
								self.traktSummaryInfo = self.traktapi.getMovieSummary(self.curVideoInfo['imdbnumber'])

				Debug("[Scrobbler] Watch response: %s" % str(response))
				
		elif utilities.isEpisode(self.curVideo['type']) and scrobbleEpisodeOption:
			if self.isMultiPartEpisode:
				Debug("[Scrobbler] Multi-part episode, watching part %d of %d." % (self.curMPEpisode + 1, self.curVideo['multi_episode_count']))
				# recalculate watchedPercent and duration for multi-part
				adjustedDuration = int(self.videoDuration / self.curVideo['multi_episode_count'])
				duration = adjustedDuration / 60
				watchedPercent = ((self.watchedTime - (adjustedDuration * self.curMPEpisode)) / adjustedDuration) * 100
			
			response = self.traktapi.watchingEpisode(self.curVideoInfo, duration, watchedPercent)
			if response != None:
				if self.curVideoInfo['tvdb_id'] is None:
					if 'status' in response and response['status'] == "success":
						if 'show' in response and 'tvdb_id' in response['show']:
							self.curVideoInfo['tvdb_id'] = response['show']['tvdb_id']
							if 'id' in self.curVideo and utilities.getSettingAsBool('update_tvdb_id'):
								req = {"jsonrpc": "2.0", "id": 1, "method": "VideoLibrary.SetTVShowDetails", "params": {"tvshowid" : self.curVideoInfo['tvshowid'], "imdbnumber": self.curVideoInfo['tvdb_id']}}
								utilities.xbmcJsonRequest(req)
							# get summary data now if we are rating this episode
							if utilities.getSettingAsBool('rate_episode') and self.traktSummaryInfo is None:
								Debug("[Scrobbler] Episode rating is enabled, pre-fetching summary information.")
								self.traktSummaryInfo = self.traktapi.getEpisodeSummary(self.curVideoInfo['tvdb_id'], self.curVideoInfo['season'], self.curVideoInfo['episode'])

				Debug("[Scrobbler] Watch response: %s" % str(response))
开发者ID:Mesoptier,项目名称:script.trakt,代码行数:56,代码来源:scrobbler.py


示例10: stoppedWatching

	def stoppedWatching(self):
		Debug("[Scrobbler] stoppedWatching()")
		scrobbleMovieOption = utilities.getSettingAsBool("scrobble_movie")
		scrobbleEpisodeOption = utilities.getSettingAsBool("scrobble_episode")

		if utilities.isMovie(self.curVideo['type']) and scrobbleMovieOption:
			response = self.traktapi.cancelWatchingMovie()
			if response != None:
				Debug("[Scrobbler] Cancel watch response: %s" % str(response))
		elif utilities.isEpisode(self.curVideo['type']) and scrobbleEpisodeOption:
			response = self.traktapi.cancelWatchingEpisode()
			if response != None:
				Debug("[Scrobbler] Cancel watch response: %s" % str(response))
开发者ID:Mesoptier,项目名称:script.trakt,代码行数:13,代码来源:scrobbler.py


示例11: __rateOnTrakt

def __rateOnTrakt(rating, media_type, media, unrate=False):
	logger.debug("Sending rating (%s) to Trakt.tv" % rating)

	params = {}
	

	if utils.isMovie(media_type):
		params = media
		params['rating'] = rating
		root = {}
		listing = [params]
		root['movies'] = listing

	elif utils.isShow(media_type):
		params['rating'] = rating
		params['title'] = media['title']
		params['year'] = media['year']
		params['ids'] = {}
		params['ids']['tmdb'] = media['ids']['tmdb']
		params['ids']['imdb'] = media['ids']['imdb']
		params['ids']['tvdb'] = media['ids']['tvdb']

		root = {}
		listing = [params]
		root['shows'] = listing

	elif utils.isEpisode(media_type):
		params = media
		params['rating'] = rating
		root = {}
		listing = [params]
		root['episodes'] = listing

	else:
		return

	if not unrate:
		data = globals.traktapi.addRating(root)
	else:
		data = globals.traktapi.removeRating(root)

	if data:
		s = utils.getFormattedItemName(media_type, media)
		if 'not_found' in data and not data['not_found']['movies'] and not data['not_found']['episodes'] and not data['not_found']['shows']:

			if not unrate:
				utils.notification(utils.getString(32040), s)
			else:
				utils.notification(utils.getString(32042), s)
		else:
			utils.notification(utils.getString(32044), s)
开发者ID:Leinad4Mind,项目名称:script.trakt,代码行数:51,代码来源:rating.py


示例12: __preFetchUserRatings

 def __preFetchUserRatings(self, result):
     if result:
         if utilities.isMovie(self.curVideo['type']) and utilities.getSettingAsBool('rate_movie'):
             # pre-get summary information, for faster rating dialog.
             logger.debug("Movie rating is enabled, pre-fetching summary information.")
             self.curVideoInfo = result['movie']
             self.curVideoInfo['user'] = {'ratings': self.traktapi.getMovieRatingForUser(result['movie']['ids']['trakt'], 'trakt')}
         elif utilities.isEpisode(self.curVideo['type']) and utilities.getSettingAsBool('rate_episode'):
             # pre-get summary information, for faster rating dialog.
             logger.debug("Episode rating is enabled, pre-fetching summary information.")
             self.curVideoInfo = result['episode']
             self.curVideoInfo['user'] = {'ratings': self.traktapi.getEpisodeRatingForUser(result['show']['ids']['trakt'],
                                                                                           self.curVideoInfo['season'], self.curVideoInfo['number'], 'trakt')}
         logger.debug('Pre-Fetch result: %s; Info: %s' % (result, self.curVideoInfo))
开发者ID:cisval,项目名称:script.trakt,代码行数:14,代码来源:scrobbler.py


示例13: scrobble

    def scrobble(self):
        if not self.curVideoInfo:
            return

        Debug("[Scrobbler] scrobble()")
        scrobbleMovieOption = utilities.getSettingAsBool("scrobble_movie")
        scrobbleEpisodeOption = utilities.getSettingAsBool("scrobble_episode")

        duration = self.videoDuration / 60
        watchedPercent = (self.watchedTime / self.videoDuration) * 100

        if utilities.isMovie(self.curVideo["type"]) and scrobbleMovieOption:
            response = self.traktapi.scrobbleMovie(self.curVideoInfo, duration, watchedPercent)
            if not response is None and "status" in response:
                if response["status"] == "success":
                    self.watchlistTagCheck()
                    Debug("[Scrobbler] Scrobble response: %s" % str(response))
                elif response["status"] == "failure":
                    if response["error"].startswith("scrobbled") and response["error"].endswith("already"):
                        Debug("[Scrobbler] Movie was just recently scrobbled, attempting to cancel watching instead.")
                        self.stoppedWatching()
                    elif response["error"] == "movie not found":
                        Debug(
                            "[Scrobbler] Movie '%s' was not found on trakt.tv, possible malformed XBMC metadata."
                            % self.curVideoInfo["title"]
                        )

        elif utilities.isEpisode(self.curVideo["type"]) and scrobbleEpisodeOption:
            if self.isMultiPartEpisode:
                Debug(
                    "[Scrobbler] Multi-part episode, scrobbling part %d of %d."
                    % (self.curMPEpisode + 1, self.curVideo["multi_episode_count"])
                )
                adjustedDuration = int(self.videoDuration / self.curVideo["multi_episode_count"])
                duration = adjustedDuration / 60
                watchedPercent = ((self.watchedTime - (adjustedDuration * self.curMPEpisode)) / adjustedDuration) * 100

            response = self.traktapi.scrobbleEpisode(self.curVideoInfo, duration, watchedPercent)
            if not response is None and "status" in response:
                if response["status"] == "success":
                    Debug("[Scrobbler] Scrobble response: %s" % str(response))
                elif response["status"] == "failure":
                    if response["error"].startswith("scrobbled") and response["error"].endswith("already"):
                        Debug("[Scrobbler] Episode was just recently scrobbled, attempting to cancel watching instead.")
                        self.stoppedWatching()
                    elif response["error"] == "show not found":
                        Debug(
                            "[Scrobbler] Show '%s' was not found on trakt.tv, possible malformed XBMC metadata."
                            % self.curVideoInfo["showtitle"]
                        )
开发者ID:perern,项目名称:script.trakt,代码行数:50,代码来源:scrobbler.py


示例14: watching

	def watching(self):
		if not self.isPlaying:
			return

		if not self.curVideoInfo:
			return

		Debug("[Scrobbler] watching()")
		scrobbleMovieOption = utilities.getSettingAsBool('scrobble_movie')
		scrobbleEpisodeOption = utilities.getSettingAsBool('scrobble_episode')

		self.update(True)

		duration = self.videoDuration / 60
		watchedPercent = (self.watchedTime / self.videoDuration) * 100

		if utilities.isMovie(self.curVideo['type']) and scrobbleMovieOption:
			response = self.traktapi.watchingMovie(self.curVideoInfo, duration, watchedPercent)
			if response != None:
				if self.curVideoInfo['imdbnumber'] is None:
					if 'status' in response and response['status'] == "success":
						if 'movie' in response and 'imdb_id' in response['movie']:
							self.curVideoInfo['imdbnumber'] = response['movie']['imdb_id']
							# get summary data now if we are rating this movie
							if utilities.getSettingAsBool('rate_movie') and self.traktSummaryInfo is None:
								self.traktSummaryInfo = self.traktapi.getMovieSummary(self.curVideoInfo['imdbnumber'])

				Debug("[Scrobbler] Watch response: %s" % str(response))
				
		elif utilities.isEpisode(self.curVideo['type']) and scrobbleEpisodeOption:
			if self.isMultiPartEpisode:
				Debug("[Scrobbler] Multi-part episode, watching part %d of %d." % (self.curMPEpisode + 1, self.curVideo['multi_episode_count']))
				# recalculate watchedPercent and duration for multi-part
				adjustedDuration = int(self.videoDuration / self.curVideo['multi_episode_count'])
				duration = adjustedDuration / 60
				watchedPercent = ((self.watchedTime - (adjustedDuration * self.curMPEpisode)) / adjustedDuration) * 100
			
			response = self.traktapi.watchingEpisode(self.curVideoInfo, duration, watchedPercent)
			if response != None:
				if self.curVideoInfo['tvdb_id'] is None:
					if 'status' in response and response['status'] == "success":
						if 'show' in response and 'tvdb_id' in response['show']:
							self.curVideoInfo['tvdb_id'] = response['show']['tvdb_id']
							# get summary data now if we are rating this episode
							if utilities.getSettingAsBool('rate_episode') and self.traktSummaryInfo is None:
								self.traktSummaryInfo = self.traktapi.getEpisodeSummary(self.curVideoInfo['tvdb_id'], self.curVideoInfo['season'], self.curVideoInfo['episode'])

				Debug("[Scrobbler] Watch response: %s" % str(response))
开发者ID:hephaistosthemaker,项目名称:script.trakt,代码行数:48,代码来源:scrobbler.py


示例15: rateOnTrakt

def rateOnTrakt(rating, media_type, media, unrate=False):
    utils.Debug("[Rating] Sending rating (%s) to trakt.tv" % rating)

    params = {}
    params["rating"] = rating

    if utils.isMovie(media_type):
        params["title"] = media["title"]
        params["year"] = media["year"]
        params["tmdb_id"] = media["tmdb_id"]
        params["imdb_id"] = media["imdb_id"]

        data = globals.traktapi.rateMovie(params)

    elif utils.isShow(media_type):
        params["title"] = media["title"]
        params["year"] = media["year"]
        params["tvdb_id"] = media["tvdb_id"]
        params["imdb_id"] = media["imdb_id"]

        data = globals.traktapi.rateShow(params)

    elif utils.isEpisode(media_type):
        params["title"] = media["show"]["title"]
        params["year"] = media["show"]["year"]
        params["season"] = media["episode"]["season"]
        params["episode"] = media["episode"]["number"]
        params["tvdb_id"] = media["show"]["tvdb_id"]
        params["imdb_id"] = media["show"]["imdb_id"]

        data = globals.traktapi.rateEpisode(params)

    else:
        return

    if data:
        s = utils.getFormattedItemName(media_type, media)
        if "status" in data and data["status"] == "success":
            if not unrate:
                utils.notification(utils.getString(1350), s)
            else:
                utils.notification(utils.getString(1352), s)
        elif "status" in data and data["status"] == "failure":
            utils.notification(utils.getString(1354), s)
        else:
            # status not in data, different problem, do nothing for now
            pass
开发者ID:hephaistosthemaker,项目名称:script.trakt,代码行数:47,代码来源:rating.py


示例16: onFocus

	def onFocus(self, controlID):
		if controlID in self.focus_labels:
			s = utils.getString(self.focus_labels[controlID])
			if self.rerate:
				if self.media['rating'] == self.buttons[controlID] or self.media['rating_advanced'] == self.buttons[controlID]:
					if utils.isMovie(self.media_type):
						s = utils.getString(1325)
					elif utils.isShow(self.media_type):
						s = utils.getString(1326)
					elif utils.isEpisode(self.media_type):
						s = utils.getString(1327)
					else:
						pass
			
			self.getControl(10013).setLabel(s)
		else:
			self.getControl(10013).setLabel('')
开发者ID:Dpons039,项目名称:script.trakt,代码行数:17,代码来源:rating.py


示例17: onFocus

	def onFocus(self, controlID):
		if controlID in self.focus_labels:
			s = utils.getString(self.focus_labels[controlID])

			if self.rerate:
				if self.media['user']['ratings'] and self.media['user']['ratings']['rating'] == self.buttons[controlID]:
					if utils.isMovie(self.media_type):
						s = utils.getString(32037)
					elif utils.isShow(self.media_type):
						s = utils.getString(32038)
					elif utils.isEpisode(self.media_type):
						s = utils.getString(32039)
					else:
						pass

			self.getControl(10013).setLabel(s)
		else:
			self.getControl(10013).setLabel('')
开发者ID:Leinad4Mind,项目名称:script.trakt,代码行数:18,代码来源:rating.py


示例18: __preFetchUserRatings

    def __preFetchUserRatings(self, result):
        if result:
            if utilities.isMovie(self.curVideo['type']) and utilities.getSettingAsBool('rate_movie'):
                # pre-get sumamry information, for faster rating dialog.
                logger.debug("Movie rating is enabled, pre-fetching summary information.")
                if result['movie']['ids']['imdb']:
                    self.curVideoInfo['user'] = {'ratings': self.traktapi.getMovieRatingForUser(result['movie']['ids']['imdb'])}
                    self.curVideoInfo['ids'] = result['movie']['ids']
                else:
                    logger.debug("'%s (%d)' has no valid id, can't get rating." % (self.curVideoInfo['title'], self.curVideoInfo['year']))
            elif utilities.isEpisode(self.curVideo['type']) and utilities.getSettingAsBool('rate_episode'):
                # pre-get sumamry information, for faster rating dialog.
                logger.debug("Episode rating is enabled, pre-fetching summary information.")

                if result['show']['ids']['tvdb']:
                    self.curVideoInfo['user'] = {'ratings': self.traktapi.getEpisodeRatingForUser(result['show']['ids']['tvdb'], self.curVideoInfo['season'], self.curVideoInfo['number'])}
                    self.curVideoInfo['ids'] = result['episode']['ids']
                else:
                    logger.debug("'%s - S%02dE%02d' has no valid id, can't get rating." % (self.curVideoInfo['showtitle'], self.curVideoInfo['season'], self.curVideoInfo['episode']))
开发者ID:CatoV9,项目名称:script.trakt,代码行数:19,代码来源:scrobbler.py


示例19: doManualRating

	def doManualRating(self, data):

		action = data['action']
		media_type = data['media_type']
		summaryInfo = None

		if not utilities.isValidMediaType(media_type):
			utilities.Debug("doManualRating(): Invalid media type '%s' passed for manual %s." % (media_type, action))
			return

		if not data['action'] in ['rate', 'unrate']:
			utilities.Debug("doManualRating(): Unknown action passed.")
			return
			
		if 'dbid' in data:
			utilities.Debug("Getting data for manual %s of library '%s' with ID of '%s'" % (action, media_type, data['dbid']))
		elif 'remoteitd' in data:
			if 'season' in data:
				utilities.Debug("Getting data for manual %s of non-library '%s' S%02dE%02d, with ID of '%s'." % (action, media_type, data['season'], data['episode'], data['remoteid']))
			else:
				utilities.Debug("Getting data for manual %s of non-library '%s' with ID of '%s'" % (action, media_type, data['remoteid']))

		if utilities.isEpisode(media_type):
			summaryInfo = globals.traktapi.getEpisodeSummary(data['tvdb_id'], data['season'], data['episode'])
		elif utilities.isShow(media_type):
			summaryInfo = globals.traktapi.getShowSummary(data['imdbnumber'])
		elif utilities.isMovie(media_type):
			summaryInfo = globals.traktapi.getMovieSummary(data['imdbnumber'])
		
		if not summaryInfo is None:
			if utilities.isMovie(media_type) or utilities.isShow(media_type):
				summaryInfo['xbmc_id'] = data['dbid']

			if action == 'rate':
				if not 'rating' in data:
					rateMedia(media_type, summaryInfo)
				else:
					rateMedia(media_type, summaryInfo, rating=data['rating'])
			elif action == 'unrate':
				rateMedia(media_type, summaryInfo, unrate=True)
		else:
			utilities.Debug("doManualRating(): Summary info was empty, possible problem retrieving data from trakt.tv")
开发者ID:perern,项目名称:script.trakt,代码行数:42,代码来源:service.py


示例20: onInit

    def onInit(self):
        mange_string = getString(32133) if isMovie(self.media_type) else getString(32134)
        rate_string = getString(32137)
        if isShow(self.media_type):
            rate_string = getString(32138)
        elif isSeason(self.media_type):
            rate_string = getString(32149)
        elif isEpisode(self.media_type):
            rate_string = getString(32139)

        actions = [mange_string, getString(32135), getString(32136), rate_string, getString(32140), getString(32141), getString(32142), getString(32143)]
        keys = ["itemlists", "removefromlist", "addtowatchlist", "rate", "togglewatched", "managelists", "updatetags",
                "sync"]

        l = self.getControl(ACTION_LIST)
        for i in range(len(actions)):
            if keys[i] in self.buttons:
                l.addItem(self.newListItem(actions[i], id=keys[i]))

        self.setFocus(l)
开发者ID:RottenKid,项目名称:script.trakt,代码行数:20,代码来源:traktContextMenu.py



注:本文中的utilities.isEpisode函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utilities.isMovie函数代码示例发布时间:2022-05-26
下一篇:
Python utilities.idl_filename_to_component函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap