本文整理汇总了Python中utilities.notification函数的典型用法代码示例。如果您正苦于以下问题:Python notification函数的具体用法?Python notification怎么用?Python notification使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了notification函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: scrobbleNotification
def scrobbleNotification(self, info):
if not self.curVideoInfo:
return
if utilities.getSettingAsBool("scrobble_notification"):
s = utilities.getFormattedItemName(self.curVideo['type'], info)
utilities.notification(utilities.getString(1049), s)
开发者ID:Mesoptier,项目名称:script.trakt,代码行数:7,代码来源:scrobbler.py
示例2: Run
def Run(self):
if not self.show_progress and __setting__("sync_on_update") == "true" and self.notify:
notification("%s %s" % (__getstring__(1400), __getstring__(1402)), __getstring__(1420)) # Sync started
self.GetFromXBMC()
if not self.Canceled() and add_movies_to_trakt:
self.GetFromTraktCollection()
self.AddToTrakt()
if trakt_movie_playcount or xbmc_movie_playcount:
if not self.Canceled():
self.GetFromTraktSeen()
if not self.Canceled() and trakt_movie_playcount:
self.UpdatePlaysTrakt()
if not self.Canceled() and xbmc_movie_playcount:
self.UpdatePlaysXBMC()
if not self.Canceled() and clean_trakt_movies:
if not add_movies_to_trakt:
self.GetFromTraktCollection()
if not self.Canceled():
self.RemoveFromTrakt()
if not self.Canceled() and self.show_progress:
progress.update(100, line1=__getstring__(1431), line2=" ", line3=" ")
progress.close()
if not self.show_progress and __setting__("sync_on_update") == "true" and self.notify:
notification("%s %s" % (__getstring__(1400), __getstring__(1402)), __getstring__(1421)) # Sync complete
Debug("[Movies Sync] Complete")
开发者ID:vrokolos,项目名称:script.trakt,代码行数:34,代码来源:movie_sync.py
示例3: rateOnTrakt
def rateOnTrakt(rating, media_type, media):
Debug('[rating] Sending rating (%s) to trakt' % rating)
if media_type == 'movie':
params = {'title': media['title'], 'year': media['year'], 'rating': rating}
if media['imdbnumber'].startswith('tt'):
params['imdb_id'] = media['imdbnumber']
elif media['imdbnumber'].isdigit():
params['tmdb_id'] = media['imdbnumber']
data = globals.traktapi.rateMovie(params)
else:
params = {'title': media['label'], 'year': media['year'], 'season': media['episode']['season'], 'episode': media['episode']['episode'], 'rating': rating}
if media['imdbnumber'].isdigit():
params['tvdb_id'] = media['imdbnumber']
elif media['imdbnumber'].startswith('tt'):
params['imdb_id'] = media['imdbnumber']
data = globals.traktapi.rateEpisode(params)
if data != None:
notification(__language__(1201).encode('utf-8', 'ignore'), __language__(1167).encode('utf-8', 'ignore')) # Rating submitted successfully
开发者ID:darnyte,项目名称:script.trakt,代码行数:26,代码来源:rating.py
示例4: __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
示例5: rateOnTrakt
def rateOnTrakt(self, rating):
if self.media_type == 'movie':
params = {'title': self.media['title'], 'year': self.media['year'], 'rating': rating}
if self.media['imdbnumber'].startswith('tt'):
params['imdb_id'] = self.media['imdbnumber']
elif self.media['imdbnumber'].isdigit():
params['tmdb_id']
data = traktJsonRequest('POST', '/rate/movie/%%API_KEY%%', params, passVersions=True)
else:
params = {'title': self.media['label'], 'year': self.media['year'], 'season': self.media['episode']['season'], 'episode': self.media['episode']['episode'], 'rating': rating}
if self.media['imdbnumber'].isdigit():
params['tvdb_id'] = self.media['imdbnumber']
elif self.media['imdbnumber'].startswith('tt'):
params['imdb_id'] = self.media['imdbnumber']
data = traktJsonRequest('POST', '/rate/episode/%%API_KEY%%', params, passVersions=True)
if data != None:
notification(__language__(1201).encode('utf-8', 'ignore'), __language__(1167).encode('utf-8', 'ignore')) # Rating submitted successfully
开发者ID:Sload89,项目名称:script.trakt,代码行数:25,代码来源:rating.py
示例6: 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
示例7: __init__
def __init__(self, sync, progress):
self.sync = sync
if not self.sync.show_progress and self.sync.sync_on_update and self.sync.notify and self.sync.notify_during_playback:
notification('%s %s' % (utilities.getString(32045), utilities.getString(32050)), utilities.getString(32061)) # Sync started
if self.sync.show_progress and not self.sync.run_silent:
progress.create("%s %s" % (utilities.getString(32045), utilities.getString(32050)), line1=" ", line2=" ", line3=" ")
kodiShowsCollected, kodiShowsWatched = self.__kodiLoadShows()
if not isinstance(kodiShowsCollected, list) and not kodiShowsCollected:
logger.debug("[Episodes Sync] Kodi collected show list is empty, aborting tv show Sync.")
if self.sync.show_progress and not self.sync.run_silent:
progress.close()
return
if not isinstance(kodiShowsWatched, list) and not kodiShowsWatched:
logger.debug("[Episodes Sync] Kodi watched show list is empty, aborting tv show Sync.")
if self.sync.show_progress and not self.sync.run_silent:
progress.close()
return
traktShowsCollected, traktShowsWatched, traktShowsRated, traktEpisodesRated = self.__traktLoadShows()
if not traktShowsCollected:
logger.debug("[Episodes Sync] Error getting Trakt.tv collected show list, aborting tv show sync.")
if self.sync.show_progress and not self.sync.run_silent:
progress.close()
return
if not traktShowsWatched:
logger.debug("[Episodes Sync] Error getting Trakt.tv watched show list, aborting tv show sync.")
if self.sync.show_progress and not self.sync.run_silent:
progress.close()
return
# we need a correct runtime for episodes until we have that this is commented out
traktShowsProgress = self.__traktLoadShowsPlaybackProgress(25, 36)
self.__addEpisodesToTraktCollection(kodiShowsCollected, traktShowsCollected, 37, 47)
self.__deleteEpisodesFromTraktCollection(traktShowsCollected, kodiShowsCollected, 48, 58)
self.__addEpisodesToTraktWatched(kodiShowsWatched, traktShowsWatched, 59, 69)
self.__addEpisodesToKodiWatched(traktShowsWatched, kodiShowsWatched, kodiShowsCollected, 70, 80)
# we need a correct runtime for episodes until we have that this is commented out
self.__addEpisodeProgressToKodi(traktShowsProgress, kodiShowsCollected, 81, 91)
self.__syncShowsRatings(traktShowsRated, kodiShowsCollected, 92, 95)
self.__syncEpisodeRatings(traktEpisodesRated, kodiShowsCollected, 96, 99)
if not self.sync.show_progress and self.sync.sync_on_update and self.sync.notify and self.sync.notify_during_playback:
notification('%s %s' % (utilities.getString(32045), utilities.getString(32050)), utilities.getString(32062)) # Sync complete
if self.sync.show_progress and not self.sync.run_silent:
self.sync.UpdateProgress(100, line1=" ", line2=utilities.getString(32075), line3=" ")
progress.close()
logger.debug("[Episodes Sync] Shows on Trakt.tv (%d), shows in Kodi (%d)." % (len(traktShowsCollected['shows']), len(kodiShowsCollected['shows'])))
logger.debug("[Episodes Sync] Episodes on Trakt.tv (%d), episodes in Kodi (%d)." % (self.__countEpisodes(traktShowsCollected), self.__countEpisodes(kodiShowsCollected)))
logger.debug("[Episodes Sync] Complete.")
开发者ID:AMOboxTV,项目名称:AMOBox.LegoBuild,代码行数:59,代码来源:syncEpisodes.py
示例8: testAccount
def testAccount(self, force=False):
if self.__username == "":
notification('trakt', getString(1106)) # please enter your Username and Password in settings
setSetting('account_valid', False)
return False
elif self.__password == "":
notification("trakt", getString(1107)) # please enter your Password in settings
setSetting('account_valid', False)
return False
if not getSettingAsBool('account_valid') or force:
Debug("[traktAPI] Testing account '%s'." % self.__username)
url = "%s/account/test/%s" % (self.__baseURL, self.__apikey)
Debug("[traktAPI] testAccount(url: %s)" % url)
args = json.dumps({'username': self.__username, 'password': self.__password})
response = None
try:
# get data from trakt.tv
response = self.__getData(url, args)
except traktError, e:
if isinstance(e, traktAuthProblem):
Debug("[traktAPI] testAccount(): Account '%s' failed authentication. (%s)" % (self.__username, e.value))
elif isinstance(e, traktServerBusy):
Debug("[traktAPI] testAccount(): Server Busy (%s)" % e.value)
elif isinstance(e, traktNetworkError):
Debug("[traktAPI] testAccount(): Network error: %s" % e.value)
elif isinstance(e, traktUnknownError):
Debug("[traktAPI] testAccount(): Other problem (%s)" % e.value)
else:
pass
if response:
data = None
try:
data = json.loads(response)
except ValueError:
pass
if 'status' in data:
if data['status'] == 'success':
setSetting('account_valid', True)
Debug("[traktAPI] testAccount(): Account '%s' is valid." % self.__username)
return True
开发者ID:chx0003,项目名称:script.trakt,代码行数:47,代码来源:traktapi.py
示例9: syncEpisodes
def syncEpisodes(self):
if not self.show_progress and self.sync_on_update and self.notify and self.notify_during_playback:
notification('%s %s' % (utilities.getString(1400), utilities.getString(1406)), utilities.getString(1420)) #Sync started
if self.show_progress and not self.run_silent:
progress.create("%s %s" % (utilities.getString(1400), utilities.getString(1406)), line1=" ", line2=" ", line3=" ")
xbmcShows = self.xbmcLoadShows()
if not isinstance(xbmcShows, list) and not xbmcShows:
Debug("[Episodes Sync] XBMC show list is empty, aborting tv show Sync.")
if self.show_progress and not self.run_silent:
progress.close()
return
traktShows = self.traktLoadShows()
if not isinstance(traktShows, list):
Debug("[Episodes Sync] Error getting trakt.tv show list, aborting tv show sync.")
if self.show_progress and not self.run_silent:
progress.close()
return
if utilities.getSettingAsBool('add_episodes_to_trakt') and not self.isCanceled():
traktShowsAdd = self.compareShows(xbmcShows, traktShows)
self.traktAddEpisodes(traktShowsAdd)
if utilities.getSettingAsBool('trakt_episode_playcount') and not self.isCanceled():
traktShowsUpdate = self.compareShows(xbmcShows, traktShows, watched=True)
self.traktUpdateEpisodes(traktShowsUpdate)
if utilities.getSettingAsBool('xbmc_episode_playcount') and not self.isCanceled():
xbmcShowsUpadate = self.compareShows(traktShows, xbmcShows, watched=True, restrict=True)
self.xbmcUpdateEpisodes(xbmcShowsUpadate)
if utilities.getSettingAsBool('clean_trakt_episodes') and not self.isCanceled():
traktShowsRemove = self.compareShows(traktShows, xbmcShows)
self.traktRemoveEpisodes(traktShowsRemove)
if not self.show_progress and self.sync_on_update and self.notify and self.notify_during_playback:
notification('%s %s' % (utilities.getString(1400), utilities.getString(1406)), utilities.getString(1421)) #Sync complete
if not self.isCanceled() and self.show_progress and not self.run_silent:
self.updateProgress(100, line1=" ", line2=utilities.getString(1442), line3=" ")
progress.close()
Debug("[Episodes Sync] Shows on trakt.tv (%d), shows in XBMC (%d)." % (len(utilities.findAllInList(traktShows, 'in_collection', True)), len(xbmcShows)))
Debug("[Episodes Sync] Episodes on trakt.tv (%d), episodes in XBMC (%d)." % (self.countEpisodes(traktShows), self.countEpisodes(xbmcShows)))
Debug("[Episodes Sync] Complete.")
开发者ID:Mafarricos,项目名称:Mafarricos-modded-xbmc-addons,代码行数:46,代码来源:sync.py
示例10: syncMovies
def syncMovies(self):
if not self.show_progress and self.sync_on_update and self.notify and self.notify_during_playback:
notification('%s %s' % (utilities.getString(1400), utilities.getString(1402)), utilities.getString(1420)) #Sync started
if self.show_progress and not self.run_silent:
progress.create("%s %s" % (utilities.getString(1400), utilities.getString(1402)), line1=" ", line2=" ", line3=" ")
xbmcMovies = self.xbmcLoadMovies()
if not isinstance(xbmcMovies, list) and not xbmcMovies:
Debug("[Movies Sync] XBMC movie list is empty, aborting movie Sync.")
if self.show_progress and not self.run_silent:
progress.close()
return
traktMovies = self.traktLoadMovies()
if not isinstance(traktMovies, list):
Debug("[Movies Sync] Error getting trakt.tv movie list, aborting movie Sync.")
if self.show_progress and not self.run_silent:
progress.close()
return
if utilities.getSettingAsBool('add_movies_to_trakt') and not self.isCanceled():
traktMoviesToAdd = self.compareMovies(xbmcMovies, traktMovies)
self.traktAddMovies(traktMoviesToAdd)
if utilities.getSettingAsBool('trakt_movie_playcount') and not self.isCanceled():
traktMoviesToUpdate = self.compareMovies(xbmcMovies, traktMovies, watched=True)
self.traktUpdateMovies(traktMoviesToUpdate)
if utilities.getSettingAsBool('xbmc_movie_playcount') and not self.isCanceled():
xbmcMoviesToUpdate = self.compareMovies(traktMovies, xbmcMovies, watched=True, restrict=True)
self.xbmcUpdateMovies(xbmcMoviesToUpdate)
if utilities.getSettingAsBool('clean_trakt_movies') and not self.isCanceled():
traktMoviesToRemove = self.compareMovies(traktMovies, xbmcMovies)
self.traktRemoveMovies(traktMoviesToRemove)
if not self.isCanceled() and self.show_progress and not self.run_silent:
self.updateProgress(100, line1=utilities.getString(1431), line2=" ", line3=" ")
progress.close()
if not self.show_progress and self.sync_on_update and self.notify and self.notify_during_playback:
notification('%s %s' % (utilities.getString(1400), utilities.getString(1402)), utilities.getString(1421)) #Sync complete
Debug("[Movies Sync] Movies on trakt.tv (%d), movies in XBMC (%d)." % (len(traktMovies), self.countMovies(xbmcMovies)))
Debug("[Movies Sync] Complete.")
开发者ID:Mafarricos,项目名称:Mafarricos-modded-xbmc-addons,代码行数:45,代码来源:sync.py
示例11: __init__
def __init__(self, sync, progress):
self.sync = sync
if not self.sync.show_progress and sync.sync_on_update and sync.notify and self.sync.notify_during_playback:
notification('%s %s' % (utilities.getString(32045), utilities.getString(32046)), utilities.getString(32061)) # Sync started
if sync.show_progress and not sync.run_silent:
progress.create("%s %s" % (utilities.getString(32045), utilities.getString(32046)), line1=" ", line2=" ", line3=" ")
kodiMovies = self.__kodiLoadMovies()
if not isinstance(kodiMovies, list) and not kodiMovies:
logger.debug("[Movies Sync] Kodi movie list is empty, aborting movie Sync.")
if sync.show_progress and not sync.run_silent:
progress.close()
return
try:
traktMovies = self.__traktLoadMovies()
except Exception:
logger.debug("[Movies Sync] Error getting Trakt.tv movie list, aborting movie Sync.")
if sync.show_progress and not sync.run_silent:
progress.close()
return
traktMoviesProgress = self.__traktLoadMoviesPlaybackProgress(25, 36)
self.__addMoviesToTraktCollection(kodiMovies, traktMovies, 37, 47)
self.__deleteMoviesFromTraktCollection(traktMovies, kodiMovies, 48, 58)
self.__addMoviesToTraktWatched(kodiMovies, traktMovies, 59, 69)
self.__addMoviesToKodiWatched(traktMovies, kodiMovies, 70, 80)
self.__addMovieProgressToKodi(traktMoviesProgress, kodiMovies, 81, 91)
self.__syncMovieRatings(traktMovies, kodiMovies, 92, 99)
if sync.show_progress and not sync.run_silent:
self.sync.UpdateProgress(100, line1=utilities.getString(32066), line2=" ", line3=" ")
progress.close()
if not sync.show_progress and sync.sync_on_update and sync.notify and sync.notify_during_playback:
notification('%s %s' % (utilities.getString(32045), utilities.getString(32046)), utilities.getString(32062)) # Sync complete
logger.debug("[Movies Sync] Movies on Trakt.tv (%d), movies in Kodi (%d)." % (len(traktMovies), len(kodiMovies)))
logger.debug("[Movies Sync] Complete.")
开发者ID:nb2a,项目名称:script.trakt,代码行数:44,代码来源:syncMovies.py
示例12: authenticate
def authenticate(self, pin=None):
# Attempt authentication (retrieve new token)
with Trakt.configuration.http(retry=True):
try:
# Exchange `code` for `access_token`
logger.debug("Exchanging pin for access token")
self.authorization = Trakt['oauth'].token_exchange(pin, 'urn:ietf:wg:oauth:2.0:oob')
if not self.authorization:
logger.debug("Authentication Failure")
return False
else:
setSetting('authorization', dumps(self.authorization))
return True
except Exception as ex:
message = createError(ex)
logger.fatal(message)
logger.debug("Cannot connect to server")
notification('Trakt', getString(32023))
开发者ID:agrepi,项目名称:script.trakt,代码行数:19,代码来源:traktapi.py
示例13: Run
def Run(self):
if not self.show_progress and __setting__('sync_on_update') == 'true' and self.notify:
notification('%s %s' % (__getstring__(1400), __getstring__(1406)), __getstring__(1420)) #Sync started
self.GetFromXBMC()
# sanity check, test for non-empty xbmc movie list
if self.xbmc_shows:
if not self.Canceled() and add_episodes_to_trakt:
self.GetCollectionFromTrakt()
if not self.Canceled():
self.AddToTrakt()
if trakt_episode_playcount or xbmc_episode_playcount:
if not self.Canceled():
self.GetWatchedFromTrakt()
if not self.Canceled() and trakt_episode_playcount:
self.UpdatePlaysTrakt()
if xbmc_episode_playcount:
if not self.Canceled():
self.UpdatePlaysXBMC()
if clean_trakt_episodes:
if not self.Canceled() and not add_episodes_to_trakt:
self.GetCollectionFromTrakt()
if not self.Canceled():
self.RemoveFromTrakt()
else:
Debug("[Episodes Sync] XBMC Show list is empty, aborting Episodes Sync.")
if not self.show_progress and __setting__('sync_on_update') == 'true' and self.notify:
notification('%s %s' % (__getstring__(1400), __getstring__(1406)), __getstring__(1421)) #Sync complete
if not self.Canceled() and self.show_progress:
progress.update(100, line1=__getstring__(1442), line2=' ', line3=' ')
progress.close()
Debug('[Episodes Sync] Complete')
开发者ID:Conjuro,项目名称:script.trakt,代码行数:42,代码来源:episode_sync.py
示例14: rate
def rate(rating, media):
import kp, kinopoisk
cookie=utils.get_string_setting('cookie')
if cookie=='': cookie=None
if not cookie:
login=utils.get_string_setting('login')
password=utils.get_string_setting('password')
kpLogin=kp.Login(login,password,cookie)
cookie=kpLogin.get_cookie()
utils.set_string_setting('cookie', cookie)
k=kinopoisk.KinoPoiskRuAgent()
kpId,title,year=None,None,None
if 'kinopoiskId' not in media:
if 'titleAlt' in media: titles=(media['title'], media['titleAlt'])
else: titles=(media['title'],)
for i in titles:
movies=k.search([],{'name':i,'year':media['year']},'English')
if len(movies)>0:
if movies[0][4]>90:
ret=0
else:
items=[]
for i in movies: items.append('%s (%s)'%(i[1],str(i[2])))
ret=xbmcgui.Dialog().select('Movies:',items)
if ret>-1:
kpId=movies[ret][0]
title=movies[ret][1].encode('utf-8')
year=str(movies[ret][2])
break
else:
kpId=str(media['kinopoiskId'])
title=media['title'].encode('utf-8')
year=str(media['year'])
if kpId and kpId!='None':
r_class=kp.Rate(str(rating),str(kpId), cookie)
r=r_class.rateit()
if r:
utils.notification('Rated %s OK!' % (str(kpId)),'%s to %s (%s)!' %(str(rating), title, year))
folderid=utils.get_string_setting('folderid')
if folderid!="" and folderid>-1 and isinstance(int(folderid),int):
r_class.moveit(int(folderid))
return 1
开发者ID:DiMartinoX,项目名称:plugin.video.kinopoisk.ru,代码行数:42,代码来源:rating.py
示例15: __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
示例16: showContextMenu
def showContextMenu(self):
show = self.tvshows[self.getControl(TVSHOW_LIST).getSelectedPosition()]
li = self.getControl(TVSHOW_LIST).getSelectedItem()
options = []
actions = []
if self.type != 'watchlist':
if 'watchlist' in show:
if show['watchlist']:
options.append(__language__(137).encode( "utf-8", "ignore" ))
actions.append('unwatchlist')
else:
options.append(__language__(136).encode( "utf-8", "ignore" ))
actions.append('watchlist')
else:
options.append(__language__(136).encode( "utf-8", "ignore" ))
actions.append('watchlist')
else:
options.append(__language__(137).encode( "utf-8", "ignore" ))
actions.append('unwatchlist')
options.append(__language__(138).encode( "utf-8", "ignore" ))
actions.append('rate')
select = xbmcgui.Dialog().select(show['title'], options)
if select != -1:
Debug("Select: " + actions[select])
if select == -1:
Debug ("menu quit by user")
return
elif actions[select] == 'play':
xbmcgui.Dialog().ok(__language__(200).encode( "utf-8", "ignore" ), __language__(152).encode( "utf-8", "ignore" ))
elif actions[select] == 'unwatchlist':
if utilities.removeTVShowsFromWatchlist([show]) == None:
utilities.notification(__language__(200).encode( "utf-8", "ignore" ), __language__(132).encode( "utf-8", "ignore" )) # Failed to remove from watch-list
else:
utilities.notification(__language__(200).encode( "utf-8", "ignore" ), __language__(133).encode( "utf-8", "ignore" )) # Successfully removed from watch-list
li.setProperty('Watchlist','false')
show['watchlist'] = False
elif actions[select] == 'watchlist':
if utilities.addTVShowsToWatchlist([show]) == None:
utilities.notification(__language__(200).encode( "utf-8", "ignore" ), __language__(130).encode( "utf-8", "ignore" )) # Failed to added to watch-list
else:
utilities.notification(__language__(200).encode( "utf-8", "ignore" ), __language__(131).encode( "utf-8", "ignore" )) # Successfully added to watch-list
li.setProperty('Watchlist','true')
show['watchlist'] = True
elif actions[select] == 'rate':
rateShow = RateShowDialog("rate.xml", __settings__.getAddonInfo('path'), "Default")
rateShow.initDialog(show['tvdb_id'], show['title'], show['year'], utilities.getShowRatingFromTrakt(show['tvdb_id'], show['title'], show['year']))
rateShow.doModal()
del rateShow
开发者ID:lordcapulet,项目名称:script.traktr,代码行数:49,代码来源:windows.py
示例17: getToken
def getToken(self):
if not self.__username and not self.__password:
notification('Trakt', getString(32021)) #Username and password error
elif not self.__password:
notification('Trakt', getString(32022)) #Password error
else:
# Attempt authentication (retrieve new token)
with Trakt.configuration.http(retry=True):
try:
auth = Trakt['auth'].login(getSetting('username'), getSetting('password'))
if auth:
self.__token = auth
else:
logger.debug("Authentication Failure")
notification('Trakt', getString(32025))
except Exception as ex:
message = createError(ex)
logger.fatal(message)
logger.debug("Cannot connect to server")
notification('Trakt', getString(32023))
开发者ID:Leinad4Mind,项目名称:script.trakt,代码行数:20,代码来源:traktapi.py
示例18: __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
示例19: 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
示例20: onClick
def onClick(self, control):
#print 'onClick: %s' % (control)
logger.debug('onClick: %s' % (control))
if control == AUTH_BUTTON:
if not self.__get_token():
logger.debug("Authentification error")
notification(getString(32157), getString(32147), 5000)
return
self.auth = True
if control == LATER_BUTTON:
notification(getString(32157), getString(32150), 5000)
setSetting('last_reminder', str(int(time.time())))
if control == NEVER_BUTTON:
notification(getString(32157), getString(32151), 5000)
setSetting('last_reminder', '-1')
if control in [AUTH_BUTTON, LATER_BUTTON, NEVER_BUTTON]:
self.close()
开发者ID:misterpeeps43,项目名称:script.trakt,代码行数:20,代码来源:gui_utils.py
注:本文中的utilities.notification函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论