本文整理汇总了Python中utilities.getString函数的典型用法代码示例。如果您正苦于以下问题:Python getString函数的具体用法?Python getString怎么用?Python getString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getString函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: traktUpdateMovies
def traktUpdateMovies(self, movies):
if len(movies) == 0:
self.updateProgress(60, line2=utilities.getString(1469))
Debug("[Movies Sync] trakt.tv movie playcount is up to date")
return
titles = ", ".join(["%s (%s)" % (m['title'], m['imdb_id']) for m in movies])
Debug("[Movies Sync] %i movie(s) playcount will be updated on trakt.tv" % len(movies))
Debug("[Movies Sync] Movies updated: %s" % titles)
self.updateProgress(40, line2="%i %s" % (len(movies), utilities.getString(1428)))
# Send request to update playcounts on trakt.tv
chunked_movies = utilities.chunks([self.sanitizeMovieData(movie) for movie in movies], 50)
i = 0
x = float(len(chunked_movies))
for chunk in chunked_movies:
if self.isCanceled():
return
params = {'movies': chunk}
if self.simulate:
Debug("[Movies Sync] %s" % str(params))
else:
self.traktapi.updateSeenMovie(params)
i = i + 1
y = ((i / x) * 20) + 40
self.updateProgress(int(y), line2=utilities.getString(1478))
self.updateProgress(60, line2=utilities.getString(1470) % len(movies))
开发者ID:Mafarricos,项目名称:Mafarricos-modded-xbmc-addons,代码行数:30,代码来源:sync.py
示例2: xbmcUpdateEpisodes
def xbmcUpdateEpisodes(self, shows):
if len(shows) == 0:
self.updateProgress(82, line1=utilities.getString(1441), line2=utilities.getString(1493))
Debug("[Episodes Sync] XBMC episode playcounts are up to date.")
return
Debug("[Episodes Sync] %i show(s) shows are missing playcounts on XBMC" % len(shows))
for s in ["%s" % self.getShowAsString(s, short=True) for s in shows]:
Debug("[Episodes Sync] Episodes updated: %s" % s)
self.updateProgress(64, line1=utilities.getString(1441), line2="%i %s" % (len(shows), utilities.getString(1439)), line3=" ")
episodes = []
for show in shows:
for season in show['seasons']:
for episode in show['seasons'][season]:
episodes.append({'episodeid': show['seasons'][season][episode]['id'], 'playcount': 1})
#split episode list into chunks of 50
chunked_episodes = utilities.chunks([{"jsonrpc": "2.0", "method": "VideoLibrary.SetEpisodeDetails", "params": episodes[i], "id": i} for i in range(len(episodes))], 50)
i = 0
x = float(len(chunked_episodes))
for chunk in chunked_episodes:
if self.isCanceled():
return
if self.simulate:
Debug("[Episodes Sync] %s" % str(chunk))
else:
utilities.xbmcJsonRequest(chunk)
i = i + 1
y = ((i / x) * 18) + 64
self.updateProgress(int(y), line2=utilities.getString(1494))
self.updateProgress(82, line2=utilities.getString(1495) % len(episodes))
开发者ID:Mafarricos,项目名称:Mafarricos-modded-xbmc-addons,代码行数:35,代码来源:sync.py
示例3: __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
示例4: traktAddEpisodes
def traktAddEpisodes(self, shows):
if len(shows) == 0:
Debug("[Episodes Sync] trakt.tv episode collection is up to date.")
return
Debug("[Episodes Sync] %i show(s) have episodes (%d) to be added to your trakt.tv collection." % (len(shows), self.countEpisodes(shows)))
for show in shows:
Debug("[Episodes Sync] Episodes added: %s" % self.getShowAsString(show, short=True))
if self.show_progress:
progress.update(35, line1=utilities.getString(1435), line2='%i %s' % (len(shows), utilities.getString(1436)))
for show in shows:
if self.isCanceled():
return
epCount = self.countEpisodes([show])
title = show['title'].encode('utf-8', 'ignore')
if self.show_progress:
progress.update(45, line1=utilities.getString(1435), line2=title, line3='%i %s' % (epCount, utilities.getString(1437)))
s = self.traktFormatShow(show)
if self.simulate:
Debug("[Episodes Sync] %s" % str(s))
else:
self.traktapi.addEpisode(s)
开发者ID:chx0003,项目名称:script.trakt,代码行数:27,代码来源:sync.py
示例5: traktRemoveEpisodes
def traktRemoveEpisodes(self, shows):
if len(shows) == 0:
Debug('[Episodes Sync] trakt.tv episode collection is clean')
return
Debug("[Episodes Sync] %i show(s) will have episodes removed from trakt.tv collection." % len(shows))
for show in shows:
Debug("[Episodes Sync] Episodes removed: %s" % self.getShowAsString(show, short=True))
if self.show_progress:
progress.update(90, line1=utilities.getString(1445), line2='%i %s' % (len(shows), utilities.getString(1446)))
for show in shows:
if self.isCanceled():
return
epCount = self.countEpisodes([show])
title = show['title'].encode('utf-8', 'ignore')
if self.show_progress:
progress.update(95, line1=utilities.getString(1445), line2=title, line3='%i %s' % (epCount, utilities.getString(1447)))
s = self.traktFormatShow(show)
if self.simulate:
Debug("[Episodes Sync] %s" % str(s))
else:
self.traktapi.removeEpisode(s)
开发者ID:chx0003,项目名称:script.trakt,代码行数:27,代码来源:sync.py
示例6: traktRemoveMovies
def traktRemoveMovies(self, movies):
if len(movies) == 0:
self.updateProgress(98, line2=utilities.getString(1474))
Debug("[Movies Sync] trakt.tv movie collection is clean, no movies to remove.")
return
titles = ", ".join(["%s (%s)" % (m['title'], m['imdb_id']) for m in movies])
Debug("[Movies Sync] %i movie(s) will be removed from trakt.tv collection." % len(movies))
Debug("[Movies Sync] Movies removed: %s" % titles)
self.updateProgress(80, line2="%i %s" % (len(movies), utilities.getString(1444)))
chunked_movies = utilities.chunks([self.sanitizeMovieData(movie) for movie in movies], 50)
i = 0
x = float(len(chunked_movies))
for chunk in chunked_movies:
if self.isCanceled():
return
params = {'movies': chunk}
if self.simulate:
Debug("[Movies Sync] %s" % str(params))
else:
self.traktapi.removeMovie(params)
i = i + 1
y = ((i / x) * 20) + 80
self.updateProgress(int(y), line2=utilities.getString(1476))
self.updateProgress(98, line2=utilities.getString(1475) % len(movies))
开发者ID:Mafarricos,项目名称:Mafarricos-modded-xbmc-addons,代码行数:29,代码来源:sync.py
示例7: traktUpdateEpisodes
def traktUpdateEpisodes(self, shows):
if len(shows) == 0:
self.updateProgress(64, line1=utilities.getString(1438), line2=utilities.getString(1492))
Debug("[Episodes Sync] trakt.tv episode playcounts are up to date.")
return
Debug("[Episodes Sync] %i show(s) are missing playcounts on trakt.tv" % len(shows))
for show in shows:
Debug("[Episodes Sync] Episodes updated: %s" % self.getShowAsString(show, short=True))
self.updateProgress(46, line1=utilities.getString(1438), line2="%i %s" % (len(shows), utilities.getString(1439)), line3=" ")
i = 0
x = float(len(shows))
for show in shows:
if self.isCanceled():
return
epCount = self.countEpisodes([show])
title = show['title'].encode('utf-8', 'ignore')
i = i + 1
y = ((i / x) * 18) + 46
self.updateProgress(70, line2=title, line3="%i %s" % (epCount, utilities.getString(1440)))
s = self.traktFormatShow(show)
if self.simulate:
Debug("[Episodes Sync] %s" % str(s))
else:
self.traktapi.updateSeenEpisode(s)
self.updateProgress(64, line2="%i %s" % (len(shows), utilities.getString(1439)))
开发者ID:Mafarricos,项目名称:Mafarricos-modded-xbmc-addons,代码行数:32,代码来源:sync.py
示例8: xbmcUpdateMovies
def xbmcUpdateMovies(self, movies):
if len(movies) == 0:
self.updateProgress(80, line2=utilities.getString(1471))
Debug("[Movies Sync] XBMC movie playcount is up to date.")
return
titles = ", ".join(["%s (%s)" % (m['title'], m['imdb_id']) for m in movies])
Debug("[Movies Sync] %i movie(s) playcount will be updated in XBMC" % len(movies))
Debug("[Movies Sync] Movies updated: %s" % titles)
self.updateProgress(60, line2="%i %s" % (len(movies), utilities.getString(1430)))
#split movie list into chunks of 50
chunked_movies = utilities.chunks([{"jsonrpc": "2.0", "method": "VideoLibrary.SetMovieDetails", "params": {"movieid": movies[i]['movieid'], "playcount": movies[i]['plays']}, "id": i} for i in range(len(movies))], 50)
i = 0
x = float(len(chunked_movies))
for chunk in chunked_movies:
if self.isCanceled():
return
if self.simulate:
Debug("[Movies Sync] %s" % str(chunk))
else:
utilities.xbmcJsonRequest(chunk)
i = i + 1
y = ((i / x) * 20) + 60
self.updateProgress(int(y), line2=utilities.getString(1472))
self.updateProgress(80, line2=utilities.getString(1473) % len(movies))
开发者ID:Mafarricos,项目名称:Mafarricos-modded-xbmc-addons,代码行数:29,代码来源:sync.py
示例9: __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
示例10: __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
示例11: __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
示例12: __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
示例13: __traktLoadShowsPlaybackProgress
def __traktLoadShowsPlaybackProgress(self):
if utilities.getSettingAsBool('trakt_episode_playback') and not self.__isCanceled():
self.__updateProgress(10, line1=utilities.getString(1485), line2=utilities.getString(32119))
logger.debug('[Playback Sync] Getting playback progress from Trakt.tv')
try:
traktProgressShows = self.traktapi.getEpisodePlaybackProgress()
except Exception:
logger.debug("[Playback Sync] Invalid Trakt.tv progress list, possible error getting data from Trakt, aborting Trakt.tv playback update.")
return False
i = 0
x = float(len(traktProgressShows))
showsProgress = {'shows': []}
for show in traktProgressShows:
i += 1
y = ((i / x) * 20) + 6
self.__updateProgress(int(y), line2=utilities.getString(32120) % (i, x))
#will keep the data in python structures - just like the KODI response
show = show.to_dict()
showsProgress['shows'].append(show)
self.__updateProgress(32, line2=utilities.getString(32121))
return showsProgress
开发者ID:Leinad4Mind,项目名称:script.trakt,代码行数:27,代码来源:sync.py
示例14: __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
示例15: 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
示例16: __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
示例17: traktAddMovies
def traktAddMovies(self, movies):
if len(movies) == 0:
self.updateProgress(40, line2=utilities.getString(1467))
Debug("[Movies Sync] trakt.tv movie collection is up to date.")
return
titles = ", ".join(["%s (%s)" % (m['title'], m['imdb_id']) for m in movies])
Debug("[Movies Sync] %i movie(s) will be added to trakt.tv collection." % len(movies))
Debug("[Movies Sync] Movies added: %s" % titles)
self.updateProgress(20, line2="%i %s" % (len(movies), utilities.getString(1426)))
chunked_movies = utilities.chunks([self.sanitizeMovieData(movie) for movie in movies], 50)
i = 0
x = float(len(chunked_movies))
for chunk in chunked_movies:
if self.isCanceled():
return
params = {'movies': chunk}
if self.simulate:
Debug("[Movies Sync] %s" % str(params))
else:
self.traktapi.addMovie(params)
i = i + 1
y = ((i / x) * 20) + 20
self.updateProgress(int(y), line2=utilities.getString(1477))
self.updateProgress(40, line2=utilities.getString(1468) % len(movies))
开发者ID:Mafarricos,项目名称:Mafarricos-modded-xbmc-addons,代码行数:29,代码来源:sync.py
示例18: 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]:
s = utils.getString(1325)
self.getControl(10013).setLabel(s)
else:
self.getControl(10013).setLabel('')
开发者ID:DiMartinoX,项目名称:plugin.video.kinopoisk.ru,代码行数:10,代码来源:rating.py
示例19: __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
示例20: __kodiLoadShows
def __kodiLoadShows(self):
self.sync.UpdateProgress(1, line1=utilities.getString(32094), line2=utilities.getString(32095))
logger.debug("[Episodes Sync] Getting show data from Kodi")
data = utilities.kodiJsonRequest({'jsonrpc': '2.0', 'method': 'VideoLibrary.GetTVShows', 'params': {'properties': ['title', 'imdbnumber', 'year', 'userrating']}, 'id': 0})
if data['limits']['total'] == 0:
logger.debug("[Episodes Sync] Kodi json request was empty.")
return None, None
tvshows = utilities.kodiRpcToTraktMediaObjects(data)
logger.debug("[Episode Sync] Getting shows from kodi finished %s" % tvshows)
if tvshows is None:
return None, None
self.sync.UpdateProgress(2, line2=utilities.getString(32096))
resultCollected = {'shows': []}
resultWatched = {'shows': []}
i = 0
x = float(len(tvshows))
logger.debug("[Episodes Sync] Getting episode data from Kodi")
for show_col1 in tvshows:
i += 1
y = ((i / x) * 8) + 2
self.sync.UpdateProgress(int(y), line2=utilities.getString(32097) % (i, x))
show = {'title': show_col1['title'], 'ids': {}, 'year': show_col1['year'], 'rating': show_col1['rating'],
'tvshowid': show_col1['tvshowid'], 'seasons': []}
if 'ids' in show_col1 and 'tvdb' in show_col1['ids']:
show['ids'] = {'tvdb': show_col1['ids']['tvdb']}
data = utilities.kodiJsonRequest({'jsonrpc': '2.0', 'method': 'VideoLibrary.GetEpisodes', 'params': {'tvshowid': show_col1['tvshowid'], 'properties': ['season', 'episode', 'playcount', 'uniqueid', 'lastplayed', 'file', 'dateadded', 'runtime', 'userrating']}, 'id': 0})
if not data:
logger.debug("[Episodes Sync] There was a problem getting episode data for '%s', aborting sync." % show['title'])
return None, None
elif 'episodes' not in data:
logger.debug("[Episodes Sync] '%s' has no episodes in Kodi." % show['title'])
continue
if 'tvshowid' in show_col1:
del(show_col1['tvshowid'])
showWatched = copy.deepcopy(show)
data2 = copy.deepcopy(data)
show['seasons'] = utilities.kodiRpcToTraktMediaObjects(data)
showWatched['seasons'] = utilities.kodiRpcToTraktMediaObjects(data2, 'watched')
resultCollected['shows'].append(show)
resultWatched['shows'].append(showWatched)
self.sync.UpdateProgress(10, line2=utilities.getString(32098))
return resultCollected, resultWatched
开发者ID:AMOboxTV,项目名称:AMOBox.LegoBuild,代码行数:53,代码来源:syncEpisodes.py
注:本文中的utilities.getString函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论