本文整理汇总了Python中app.lib.twitter.Twitter.notify方法的典型用法代码示例。如果您正苦于以下问题:Python Twitter.notify方法的具体用法?Python Twitter.notify怎么用?Python Twitter.notify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.lib.twitter.Twitter
的用法示例。
在下文中一共展示了Twitter.notify方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _search
# 需要导入模块: from app.lib.twitter import Twitter [as 别名]
# 或者: from app.lib.twitter.Twitter import notify [as 别名]
#.........这里部分代码省略.........
log.debug('%s already completed for "%s". Not searching for any qualities below.' % (queue.qualityType, movie.name))
return True
# only search for active and not completed, minimal 1 min since last search
if queue.active and not queue.completed and not self.abort and not self.stop:
#skip if no search is set
log.debug('Needs a search?')
if (not ((preReleaseSearch and queue.qualityType in Qualities.preReleases) or (dvdReleaseSearch and not queue.qualityType in Qualities.preReleases))) and not queue.lastCheck < (now - int(self.config.get('Intervals', 'search')) * 7200):
continue
log.debug('Start searching for movie: %s' % movie.name)
highest = self.provider.find(movie, queue)
log.debug('End searching for movie: %s' % movie.name)
#send highest to SABnzbd & mark as snatched
if highest:
log.debug('Found highest')
#update what I found
queue.name = latinToAscii(highest.name)
queue.link = highest.detailUrl
Db.flush()
waitFor = queue.waitFor * (60 * 60 * 24)
if queue.markComplete or (not queue.markComplete and highest.date + waitFor < time.time()):
time.sleep(10) # Give these APIs air!
if self.config.get('NZB', 'sendTo') == 'Sabnzbd' and highest.type == 'nzb':
success = self.sabNzbd.send(highest, movie.imdb)
elif self.config.get('NZB', 'sendTo') == 'Nzbget' and highest.type == 'nzb':
success = self.nzbGet.send(highest)
elif self.config.get('Torrents', 'sendTo') == 'Transmission' and highest.type == 'torrent':
success = self.transmission.send(highest, movie.imdb)
else:
success = self.blackHole(highest)
else:
success = False
log.info('Found %s but waiting for %d hours.' % (highest.name, ((highest.date + waitFor) - time.time()) / (60 * 60)))
# Set status
if success:
log.debug('Success')
movie.status = u'snatched' if queue.markComplete else u'waiting'
movie.dateChanged = datetime.datetime.now()
queue.lastCheck = now
queue.completed = True
Db.flush()
# Add to history
h = History()
h.movie = movie.id
h.value = str(highest.id) + '-' + str(highest.size)
h.status = u'snatched'
Db.add(h)
Db.flush()
# Notify PROWL
if self.config.get('PROWL', 'onSnatch'):
log.debug('PROWL')
prowl = PROWL()
prowl.notify(highest.name, 'Download Started')
# Notify XBMC
if self.config.get('XBMC', 'onSnatch'):
log.debug('XBMC')
xbmc = XBMC()
xbmc.notify('Snatched %s' % highest.name)
# Notify GROWL
if self.config.get('GROWL', 'onSnatch'):
log.debug('GROWL')
growl = GROWL()
growl.notify('Snatched %s' % highest.name, 'Download Started')
# Notify Notifo
if self.config.get('Notifo', 'onSnatch'):
log.debug('Notifo')
notifo = Notifo()
notifo.notify('%s' % highest.name, "Snatched:")
# Notify NotifyMyAndroid
if self.config.get('NMA', 'onSnatch'):
log.debug('NotifyMyAndroid')
nma = NMA()
nma.notify('Download Started', 'Snatched %s' % highest.name)
# Notify Twitter
if self.config.get('Twitter', 'onSnatch'):
log.debug('Twitter')
twitter = Twitter()
twitter.notify('Download Started', 'Snatched %s' % highest.name)
return True
queue.lastCheck = now
Db.flush()
return False
示例2: doRename
# 需要导入模块: from app.lib.twitter import Twitter [as 别名]
# 或者: from app.lib.twitter.Twitter import notify [as 别名]
def doRename(self):
'''
Go find files and rename them!
'''
log.debug('Starting renaming')
if self.isDisabled():
log.debug('Renaming is disabled')
return
allMovies = self.getMovies(self.conf('download'))
log.debug('Movies: %s' % allMovies)
if allMovies:
log.debug("Ready to rename some files.")
for movie in allMovies:
if movie.get('match'):
log.debug('self.renameFiles(movie)')
finalDestination = self.renameFiles(movie)
# Search for trailer & subtitles
log.debug('crons')
cherrypy.config['cron']['trailer'].forDirectory(finalDestination['directory'])
cherrypy.config['cron']['subtitle'].forDirectory(finalDestination['directory'])
# Update Metadata
if self.config.get('Meta', 'enabled'):
log.debug('metadata')
nfoFileName = self.config.get('Meta', 'nfoFileName')
fanartFileNaming = self.config.get('Meta', 'fanartFileName')
fanartMinHeight = self.config.get('Meta', 'fanartMinHeight')
fanartMinWidth = self.config.get('Meta', 'fanartMinWidth')
posterFileNaming = self.config.get('Meta', 'posterFileName')
posterMinHeight = self.config.get('Meta', 'posterMinHeight')
posterMinWidth = self.config.get('Meta', 'posterMinWidth')
try:
x = xmg.MetaGen(movie['movie'].imdb)
fanartOrigExt = os.path.splitext(x.get_fanart_url(fanartMinHeight, fanartMinWidth))[-1][1:]
posterOrigExt = os.path.splitext(x.get_poster_url(posterMinHeight, posterMinWidth))[-1][1:]
nfo_location = os.path.join(finalDestination['directory'],
self.genMetaFileName(movie, nfoFileName))
fanart_filename = self.genMetaFileName(movie,
fanartFileNaming,
add_tags = {'orig_ext': fanartOrigExt})
poster_filename = self.genMetaFileName(movie,
posterFileNaming,
add_tags = {'orig_ext': posterOrigExt})
x.write_nfo(nfo_location)
x.write_fanart(fanart_filename,
finalDestination['directory'],
fanartMinHeight,
fanartMinWidth)
x.write_poster(poster_filename,
finalDestination['directory'],
posterMinHeight,
posterMinWidth)
log.info('XBMC metainfo for imdbid, %s, generated' % movie['movie'].imdb)
except Exception, e:
log.error('XMG TMDB API failure. Please report to developers. API returned: %s' % e)
log.error(traceback.format_exc())
# Notify XBMC
log.debug('XBMC')
xbmc = XBMC()
xbmc.notify('Downloaded %s (%s)' % (movie['movie'].name, movie['movie'].year))
xbmc.updateLibrary()
# Notify NMJ
log.debug('NMJ')
nmj = NMJ()
nmj.updateLibrary()
# Notify PLEX
log.debug('PLEX')
plex = PLEX()
plex.updateLibrary()
# Notify PROWL
log.debug('PROWL')
prowl = PROWL()
prowl.notify('Downloaded %s (%s)' % (movie['movie'].name, movie['movie'].year), 'Download Complete')
# Notify GROWL
log.debug('GROWL')
growl = GROWL()
growl.notify('Downloaded %s (%s)' % (movie['movie'].name, movie['movie'].year), 'Download Complete')
# Notify Notifo
log.debug('Notifo')
notifo = Notifo()
notifo.notify('%s (%s)' % (movie['movie'].name, movie['movie'].year), "Downloaded:")
#.........这里部分代码省略.........
示例3: doRename
# 需要导入模块: from app.lib.twitter import Twitter [as 别名]
# 或者: from app.lib.twitter.Twitter import notify [as 别名]
def doRename(self):
"""
Go find files and rename them!
"""
log.debug("Starting renaming")
if self.isDisabled():
log.debug("Renaming is disabled")
return
allMovies = self.getMovies(self.conf("download"))
log.debug("Movies: %s" % allMovies)
if allMovies:
log.debug("Ready to rename some files.")
for movie in allMovies:
if movie.get("match"):
log.debug("self.renameFiles(movie)")
finalDestination = self.renameFiles(movie)
# Search for trailer & subtitles
log.debug("crons")
cherrypy.config["cron"]["trailer"].forDirectory(finalDestination["directory"])
cherrypy.config["cron"]["subtitle"].forDirectory(finalDestination["directory"])
# Update Metadata
if self.config.get("Meta", "enabled"):
log.debug("metadata")
nfoFileName = self.config.get("Meta", "nfoFileName")
fanartFileNaming = self.config.get("Meta", "fanartFileName")
fanartMinHeight = self.config.get("Meta", "fanartMinHeight")
fanartMinWidth = self.config.get("Meta", "fanartMinWidth")
posterFileNaming = self.config.get("Meta", "posterFileName")
posterMinHeight = self.config.get("Meta", "posterMinHeight")
posterMinWidth = self.config.get("Meta", "posterMinWidth")
try:
x = xmg.MetaGen(movie["movie"].imdb)
fanartOrigExt = os.path.splitext(x.get_fanart_url(fanartMinHeight, fanartMinWidth))[-1][1:]
posterOrigExt = os.path.splitext(x.get_poster_url(posterMinHeight, posterMinWidth))[-1][1:]
nfo_location = os.path.join(
finalDestination["directory"], self.genMetaFileName(movie, nfoFileName)
)
fanart_filename = self.genMetaFileName(
movie, fanartFileNaming, add_tags={"orig_ext": fanartOrigExt}
)
poster_filename = self.genMetaFileName(
movie, posterFileNaming, add_tags={"orig_ext": posterOrigExt}
)
urlOnly = self.config.get("Meta", "urlOnly")
x.write_nfo(nfo_location, url=True, xml=False)
x.write_fanart(fanart_filename, finalDestination["directory"], fanartMinHeight, fanartMinWidth)
x.write_poster(poster_filename, finalDestination["directory"], posterMinHeight, posterMinWidth)
log.info("XBMC metainfo for imdbid, %s, generated" % movie["movie"].imdb)
except Exception, e:
log.error("XMG TMDB API failure. Please report to developers. API returned: %s" % e)
log.error(traceback.format_exc())
# Run post-processing Scripts
self._run_extra_script(finalDestination)
# Notify XBMC
log.debug("XBMC")
xbmc = XBMC()
xbmc.notify("Downloaded %s (%s)" % (movie["movie"].name, movie["movie"].year))
xbmc.updateLibrary()
# Notify NMJ
log.debug("NMJ")
nmj = NMJ()
nmj.updateLibrary()
# Notify PLEX
log.debug("PLEX")
plex = PLEX()
plex.updateLibrary()
# Notify PROWL
log.debug("PROWL")
prowl = PROWL()
prowl.notify("Downloaded %s (%s)" % (movie["movie"].name, movie["movie"].year), "Download Complete")
# Notify GROWL
log.debug("GROWL")
growl = GROWL()
growl.notify("Downloaded %s (%s)" % (movie["movie"].name, movie["movie"].year), "Download Complete")
# Notify Notifo
log.debug("Notifo")
notifo = Notifo()
notifo.notify("%s (%s)" % (movie["movie"].name, movie["movie"].year), "Downloaded:")
# Notify Boxcar
#.........这里部分代码省略.........