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

Python utilities.getSettingAsBool函数代码示例

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

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



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

示例1: run

	def run(self):
		sync = Sync(show_progress=self._isManual, run_silent=self._runSilent, api=globals.traktapi)
		sync.sync()
		
		if utilities.getSettingAsBool('tagging_enable') and utilities.getSettingAsBool('tagging_tag_after_sync'):
			q = queue.SqliteQueue()
			q.append({'action': 'updateTags'})
开发者ID:perern,项目名称:script.trakt,代码行数:7,代码来源:service.py


示例2: syncCheck

	def syncCheck(self, media_type):
		if media_type == 'movies':
			return utilities.getSettingAsBool('add_movies_to_trakt') or utilities.getSettingAsBool('trakt_movie_playcount') or utilities.getSettingAsBool('xbmc_movie_playcount') or utilities.getSettingAsBool('clean_trakt_movies')
		else:
			return utilities.getSettingAsBool('add_episodes_to_trakt') or utilities.getSettingAsBool('trakt_episode_playcount') or utilities.getSettingAsBool('xbmc_episode_playcount') or utilities.getSettingAsBool('clean_trakt_episodes')

		return False
开发者ID:Mafarricos,项目名称:Mafarricos-modded-xbmc-addons,代码行数:7,代码来源:sync.py


示例3: __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


示例4: __init__

	def __init__(self, show_progress=False, api=None):
		self.traktapi = api
		self.show_progress = show_progress
		self.notify = utilities.getSettingAsBool('show_sync_notifications')
		self.simulate = utilities.getSettingAsBool('simulate_sync')
		if self.simulate:
			Debug("[Sync] Sync is configured to be simulated.")
开发者ID:hephaistosthemaker,项目名称:script.trakt,代码行数:7,代码来源:sync.py


示例5: __init__

	def __init__(self, show_progress=False, api=None):
		self.traktapi = api
		self.show_progress = show_progress
		self.notify = utilities.getSettingAsBool('show_sync_notifications')
		self.simulate = utilities.getSettingAsBool('simulate_sync')
		if self.simulate:
			Debug("[Sync] Sync is configured to be simulated.")

		if self.show_progress:
			progress.create('%s %s' % (utilities.getString(1400), utilities.getString(1402)), line1=' ', line2=' ', line3=' ')
开发者ID:chx0003,项目名称:script.trakt,代码行数:10,代码来源:sync.py


示例6: __init__

	def __init__(self, show_progress=False, run_silent=False, library="all", api=None):
		self.traktapi = api
		self.show_progress = show_progress
		self.run_silent = run_silent
		self.library = library
		if self.show_progress and self.run_silent:
			logger.debug("Sync is being run silently.")
		self.sync_on_update = utilities.getSettingAsBool('sync_on_update')
		self.notify = utilities.getSettingAsBool('show_sync_notifications')
		self.notify_during_playback = not (xbmc.Player().isPlayingVideo() and utilities.getSettingAsBool("hide_notifications_playback"))
开发者ID:Leinad4Mind,项目名称:script.trakt,代码行数:10,代码来源:sync.py


示例7: watching

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

        if not self.curVideoInfo:
            return

        Debug("[Scrobbler] watching()")

        self.update(True)

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

        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 = 'yep'
            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:
                                self.traktSummaryInfo = self.traktapi.getEpisodeSummary(self.curVideoInfo['tvdb_id'],
                                                                                        self.curVideoInfo['season'],
                                                                                        self.curVideoInfo['episode'])

                Debug("[Scrobbler] Watch response: %s" % str(response))
                match = utilities.getEpisodeDetailsFromXbmc(self.curMPEpisode, ['showtitle', 'season', 'episode', 'tvshowid', 'uniqueid'])
            else:
                match = utilities.getEpisodeDetailsFromXbmc(self.curVideo['id'], ['showtitle', 'season', 'episode', 'tvshowid', 'uniqueid'])
        elif 'showtitle' in self.curVideoData and 'season' in self.curVideoData and 'episode' in self.curVideoData:
            match = {}
            match['tvdb_id'] = None
            match['year'] = None
            match['showtitle'] = self.curVideoData['showtitle']
            match['season'] = self.curVideoData['season']
            match['episode'] = self.curVideoData['episode']
            match['uniqueid'] = None
            if match == None:
                return
开发者ID:DiMartinoX,项目名称:plugin.video.kinopoisk.ru,代码行数:53,代码来源:scrobbler.py


示例8: 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


示例9: _dispatch

 def _dispatch(self, data):
     try:
         logger.debug("Dispatch: %s" % data)
         action = data['action']
         if action == 'started':
             del data['action']
             self.scrobbler.playbackStarted(data)
         elif action == 'ended' or action == 'stopped':
             self.scrobbler.playbackEnded()
         elif action == 'paused':
             self.scrobbler.playbackPaused()
         elif action == 'resumed':
             self.scrobbler.playbackResumed()
         elif action == 'seek' or action == 'seekchapter':
             self.scrobbler.playbackSeek()
         elif action == 'databaseUpdated':
             if utilities.getSettingAsBool('sync_on_update'):
                 logger.debug("Performing sync after library update.")
                 self.doSync()
         elif action == 'databaseCleaned':
             if utilities.getSettingAsBool('sync_on_update') and (utilities.getSettingAsBool('clean_trakt_movies') or utilities.getSettingAsBool('clean_trakt_episodes')):
                 logger.debug("Performing sync after library clean.")
                 self.doSync()
         elif action == 'settingsChanged':
             logger.debug("Settings changed, reloading.")
             globals.traktapi.updateSettings()
         elif action == 'markWatched':
             del data['action']
             self.doMarkWatched(data)
         elif action == 'manualRating':
             ratingData = data['ratingData']
             self.doManualRating(ratingData)
         elif action == 'addtowatchlist':  # add to watchlist
             del data['action']
             self.doAddToWatchlist(data)
         elif action == 'manualSync':
             if not self.syncThread.isAlive():
                 logger.debug("Performing a manual sync.")
                 self.doSync(manual=True, silent=data['silent'], library=data['library'])
             else:
                 logger.debug("There already is a sync in progress.")
         elif action == 'settings':
             utilities.showSettings()
         elif action == 'scanStarted':
             pass
         else:
             logger.debug("Unknown dispatch action, '%s'." % action)
     except Exception as ex:
         message = utilities.createError(ex)
         logger.fatal(message)
开发者ID:beljim,项目名称:tknorris-beta-repo,代码行数:50,代码来源:service.py


示例10: __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


示例11: 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


示例12: 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


示例13: __traktLoadMoviesPlaybackProgress

	def __traktLoadMoviesPlaybackProgress(self):
		if utilities.getSettingAsBool('trakt_movie_playback') and not self.__isCanceled():
			self.__updateProgress(25, line2=utilities.getString(32122))

			logger.debug('[Movies Sync] Getting playback progress from Trakt.tv')
			try:
				traktProgressMovies = self.traktapi.getMoviePlaybackProgress()
			except Exception:
				logger.debug("[Movies Sync] Invalid Trakt.tv playback progress list, possible error getting data from Trakt, aborting Trakt.tv playback update.")
				return False

			i = 0
			x = float(len(traktProgressMovies))
			moviesProgress = {'movies': []}
			for movie in traktProgressMovies:
				i += 1
				y = ((i / x) * 25) + 11
				self.__updateProgress(int(y), line2=utilities.getString(32123) % (i, x))

				#will keep the data in python structures - just like the KODI response
				movie = movie.to_dict()

				moviesProgress['movies'].append(movie)

			self.__updateProgress(36, line2=utilities.getString(32124))

			return moviesProgress
开发者ID:Leinad4Mind,项目名称:script.trakt,代码行数:27,代码来源:sync.py


示例14: check

    def check(self, id, rating=0):
        ok1,ok3=None,None
        db_rating=self._get(id)
        title=titlesync(id)
        if getSettingAsBool("silentoffline"):
            if db_rating==None and rating>=0:
                showMessage(__language__(30520),__language__(30522) % (str(rating)))
                ok1=True
            elif db_rating>=0 and rating!=db_rating:
                showMessage(__language__(30520),__language__(30523) % (str(rating)))
                ok3=True
            elif db_rating!=None and rating==db_rating:
                showMessage(__language__(30520),__language__(30524) % (str(rating)))
        else:
            if db_rating==None and rating>=0:
                ok1=self.dialog.yesno(__language__(30520),__language__(30525) % (str(rating)), unicode(title))
            elif db_rating and rating!=db_rating:
                ok3=self.dialog.yesno(__language__(30520),__language__(30526) % (str(db_rating), str(rating)),unicode(title))
            elif db_rating==0 and rating!=db_rating:
                ok3=True
            elif db_rating!=None and rating==db_rating:
                showMessage(__language__(30520),__language__(30527) % (str(rating)))

        if ok1:
            self._add(id, rating)
            return True
        if ok3:
            self._delete(id)
            self._add(id, rating)
            return True
开发者ID:DiMartinoX,项目名称:plugin.video.kinopoisk.ru,代码行数:30,代码来源:rating.py


示例15: __addMoviesToKodiWatched

	def __addMoviesToKodiWatched(self, traktMovies, kodiMovies):

		if utilities.getSettingAsBool('kodi_movie_playcount') and not self.__isCanceled():
			updateKodiTraktMovies = copy.deepcopy(traktMovies)
			updateKodiKodiMovies = copy.deepcopy(kodiMovies)

			kodiMoviesToUpdate = self.__compareMovies(updateKodiTraktMovies, updateKodiKodiMovies, watched=True, restrict=True)

			if len(kodiMoviesToUpdate) == 0:
				self.__updateProgress(84, line2=utilities.getString(32088))
				logger.debug("[Movies Sync] Kodi movie playcount is up to date.")
				return

			titles = ", ".join(["%s" % (m['title']) for m in kodiMoviesToUpdate])
			logger.debug("[Movies Sync] %i movie(s) playcount will be updated in Kodi" % len(kodiMoviesToUpdate))
			logger.debug("[Movies Sync] Movies to add: %s" % titles)

			self.__updateProgress(73, line2=utilities.getString(32065) % len(kodiMoviesToUpdate))

			#split movie list into chunks of 50
			chunksize = 50
			chunked_movies = utilities.chunks([{"jsonrpc": "2.0", "method": "VideoLibrary.SetMovieDetails", "params": {"movieid": kodiMoviesToUpdate[i]['movieid'], "playcount": kodiMoviesToUpdate[i]['plays'], "lastplayed": utilities.convertUtcToDateTime(kodiMoviesToUpdate[i]['last_watched_at'])}, "id": i} for i in range(len(kodiMoviesToUpdate))], chunksize)
			i = 0
			x = float(len(kodiMoviesToUpdate))
			for chunk in chunked_movies:
				if self.__isCanceled():
					return
				i += 1
				y = ((i / x) * 11) + 73
				self.__updateProgress(int(y), line2=utilities.getString(32089) % ((i)*chunksize if (i)*chunksize < x else x, x))

				utilities.kodiJsonRequest(chunk)

			self.__updateProgress(84, line2=utilities.getString(32090) % len(kodiMoviesToUpdate))
开发者ID:Leinad4Mind,项目名称:script.trakt,代码行数:34,代码来源:sync.py


示例16: __scrobbleNotification

    def __scrobbleNotification(self, info):
        if not self.curVideoInfo:
            return

        if utilities.getSettingAsBool("scrobble_notification"):
            s = utilities.getFormattedItemName(self.curVideo["type"], info[self.curVideo["type"]])
            utilities.notification(utilities.getString(32015), s)
开发者ID:rickardrocks,项目名称:tknorris-beta-repo,代码行数:7,代码来源:scrobbler.py


示例17: __addMovieProgressToKodi

	def __addMovieProgressToKodi(self, traktMovies, kodiMovies):

		if utilities.getSettingAsBool('trakt_movie_playback') and traktMovies and not self.__isCanceled():
			updateKodiTraktMovies = copy.deepcopy(traktMovies)
			updateKodiKodiMovies = copy.deepcopy(kodiMovies)

			kodiMoviesToUpdate = self.__compareMovies(updateKodiTraktMovies['movies'], updateKodiKodiMovies, restrict=True, playback=True)
			if len(kodiMoviesToUpdate) == 0:
				self.__updateProgress(99, line2=utilities.getString(32125))
				logger.debug("[Movies Sync] Kodi movie playbacks are up to date.")
				return

			logger.debug("[Movies Sync] %i movie(s) playbacks will be updated in Kodi" % len(kodiMoviesToUpdate))

			self.__updateProgress(85, line2=utilities.getString(32126) % len(kodiMoviesToUpdate))
			#need to calculate the progress in int from progress in percent from Trakt
			#split movie list into chunks of 50
			chunksize = 50
			chunked_movies = utilities.chunks([{"jsonrpc": "2.0", "id": i, "method": "VideoLibrary.SetMovieDetails", "params": {"movieid": kodiMoviesToUpdate[i]['movieid'], "resume": {"position": kodiMoviesToUpdate[i]['runtime']/100.0*kodiMoviesToUpdate[i]['progress']}}} for i in range(len(kodiMoviesToUpdate))], chunksize)
			i = 0
			x = float(len(kodiMoviesToUpdate))
			for chunk in chunked_movies:
				if self.__isCanceled():
					return
				i += 1
				y = ((i / x) * 14) + 85
				self.__updateProgress(int(y), line2=utilities.getString(32127) % ((i)*chunksize if (i)*chunksize < x else x, x))
				utilities.kodiJsonRequest(chunk)

			self.__updateProgress(99, line2=utilities.getString(32128) % len(kodiMoviesToUpdate))
开发者ID:Leinad4Mind,项目名称:script.trakt,代码行数:30,代码来源:sync.py


示例18: __addMoviesToTraktCollection

	def __addMoviesToTraktCollection(self, kodiMovies, traktMovies):
		if utilities.getSettingAsBool('add_movies_to_trakt') and not self.__isCanceled():
			addTraktMovies = copy.deepcopy(traktMovies)
			addKodiMovies = copy.deepcopy(kodiMovies)

			traktMoviesToAdd = self.__compareMovies(addKodiMovies, addTraktMovies)
			self.sanitizeMovies(traktMoviesToAdd)
			logger.debug("[Movies Sync] Compared movies, found %s to add." % len(traktMoviesToAdd))

			if len(traktMoviesToAdd) == 0:
				self.__updateProgress(48, line2=utilities.getString(32084))
				logger.debug("[Movies Sync] Trakt.tv movie collection is up to date.")
				return

			titles = ", ".join(["%s" % (m['title']) for m in traktMoviesToAdd])
			logger.debug("[Movies Sync] %i movie(s) will be added to Trakt.tv collection." % len(traktMoviesToAdd))
			logger.debug("[Movies Sync] Movies to add : %s" % titles)

			self.__updateProgress(37, line2=utilities.getString(32063) % len(traktMoviesToAdd))

			moviesToAdd = {'movies': traktMoviesToAdd}
			#logger.debug("Movies to add: %s" % moviesToAdd)
			try:
				self.traktapi.addToCollection(moviesToAdd)
			except Exception as ex:
				message = utilities.createError(ex)
				logging.fatal(message)

			self.__updateProgress(48, line2=utilities.getString(32085) % len(traktMoviesToAdd))
开发者ID:Leinad4Mind,项目名称:script.trakt,代码行数:29,代码来源:sync.py


示例19: __deleteMoviesFromTraktCollection

	def __deleteMoviesFromTraktCollection(self, traktMovies, kodiMovies):

		if utilities.getSettingAsBool('clean_trakt_movies') and not self.__isCanceled():
			removeTraktMovies = copy.deepcopy(traktMovies)
			removeKodiMovies = copy.deepcopy(kodiMovies)

			logger.debug("[Movies Sync] Starting to remove.")
			traktMoviesToRemove = self.__compareMovies(removeTraktMovies, removeKodiMovies)
			self.sanitizeMovies(traktMoviesToRemove)
			logger.debug("[Movies Sync] Compared movies, found %s to remove." % len(traktMoviesToRemove))

			if len(traktMoviesToRemove) == 0:
				self.__updateProgress(60, line2=utilities.getString(32091))
				logger.debug("[Movies Sync] Trakt.tv movie collection is clean, no movies to remove.")
				return

			titles = ", ".join(["%s" % (m['title']) for m in traktMoviesToRemove])
			logger.debug("[Movies Sync] %i movie(s) will be removed from Trakt.tv collection." % len(traktMoviesToRemove))
			logger.debug("[Movies Sync] Movies removed: %s" % titles)

			self.__updateProgress(49, line2=utilities.getString(32076) % len(traktMoviesToRemove))

			moviesToRemove = {'movies': traktMoviesToRemove}
			try:
				self.traktapi.removeFromCollection(moviesToRemove)
			except Exception as ex:
				message = utilities.createError(ex)
				logging.fatal(message)

			self.__updateProgress(60, line2=utilities.getString(32092) % len(traktMoviesToRemove))
开发者ID:Leinad4Mind,项目名称:script.trakt,代码行数:30,代码来源:sync.py


示例20: __deleteEpisodesFromTraktCollection

	def __deleteEpisodesFromTraktCollection(self, traktShows, kodiShows):
		if utilities.getSettingAsBool('clean_trakt_episodes') and not self.__isCanceled():
			removeTraktShows = copy.deepcopy(traktShows)
			removeKodiShows = copy.deepcopy(kodiShows)

			traktShowsRemove = self.__compareShows(removeTraktShows, removeKodiShows)
			self.sanitizeShows(traktShowsRemove)

			if len(traktShowsRemove['shows']) == 0:
				self.__updateProgress(65, line1=utilities.getString(32077), line2=utilities.getString(32110))
				logger.debug('[Episodes Sync] Trakt.tv episode collection is clean, no episodes to remove.')
				return

			logger.debug("[Episodes Sync] %i show(s) will have episodes removed from Trakt.tv collection." % len(traktShowsRemove['shows']))
			for show in traktShowsRemove['shows']:
				logger.debug("[Episodes Sync] Episodes removed: %s" % self.__getShowAsString(show, short=True))

			self.__updateProgress(50, line1=utilities.getString(32077), line2=utilities.getString(32111) % self.__countEpisodes(traktShowsRemove), line3=" ")

			logger.debug("[traktRemoveEpisodes] Shows to remove %s" % traktShowsRemove)
			try:
				self.traktapi.removeFromCollection(traktShowsRemove)
			except Exception as ex:
				message = utilities.createError(ex)
				logging.fatal(message)

			self.__updateProgress(65, line2=utilities.getString(32112) % self.__countEpisodes(traktShowsRemove), line3=" ")
开发者ID:Leinad4Mind,项目名称:script.trakt,代码行数:27,代码来源:sync.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python utilities.getString函数代码示例发布时间:2022-05-26
下一篇:
Python utilities.getQgisTestApp函数代码示例发布时间: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