本文整理汇总了Python中sickbeard.helpers.findCertainShow函数的典型用法代码示例。如果您正苦于以下问题:Python findCertainShow函数的具体用法?Python findCertainShow怎么用?Python findCertainShow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了findCertainShow函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: updateShows
def updateShows(self):
logger.log(u"Starting trakt show watchlist check", logger.DEBUG)
watchlist = TraktCall("user/watchlist/shows.json/%API%/" + sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_API, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_PASSWORD)
if watchlist is None:
logger.log(u"Could not connect to trakt service, aborting watchlist update", logger.DEBUG)
return
for show in watchlist:
if int(sickbeard.TRAKT_METHOD_ADD) != 2:
self.addDefaultShow(show["tvdb_id"], show["title"], SKIPPED)
else:
self.addDefaultShow(show["tvdb_id"], show["title"], WANTED)
if int(sickbeard.TRAKT_METHOD_ADD) == 1:
newShow = helpers.findCertainShow(sickbeard.showList, int(show["tvdb_id"]))
if newShow is not None:
self.setEpisodeToWanted(newShow, 1, 1)
self.startBacklog(newShow)
else:
self.todoWanted.append((int(show["tvdb_id"]), 1, 1))
if int(sickbeard.TRAKT_METHOD_ADD) == 3:
newShow = helpers.findCertainShow(sickbeard.showList, int(show["tvdb_id"]))
if newShow is not None:
for ep in range(1,4):
self.setEpisodeToWanted(newShow, 1, ep)
self.startBacklog(newShow)
else:
for ep in range(1,4):
self.todoWanted.append((int(show["tvdb_id"]), 1, ep))
示例2: updateEpisodes
def updateEpisodes(self):
"""
Sets episodes to wanted that are in trakt watchlist
"""
logger.log(u"Starting trakt episode watchlist check", logger.DEBUG)
if not len(self.EpisodeWatchlist):
logger.log(u"No episode found in your watchlist, aborting episode update", logger.DEBUG)
return
managed_show = []
for show in self.EpisodeWatchlist:
indexer = int(sickbeard.TRAKT_DEFAULT_INDEXER)
if indexer == 2:
indexer_id = int(show["show"]["ids"]["tvrage"])
else:
indexer_id = int(show["show"]["ids"]["tvdb"])
newShow = helpers.findCertainShow(sickbeard.showList, indexer_id)
try:
if newShow is None:
if indexer_id not in managed_show:
self.addDefaultShow(indexer, indexer_id, show["show"]["title"], SKIPPED)
managed_show.append(indexer_id)
self.todoWanted.append((indexer_id, show['episode']['season'], show['episode']['number']))
else:
if newShow.indexer == indexer:
self.setEpisodeToWanted(newShow, show['episode']['season'], show['episode']['number'])
except TypeError:
logger.log(u"Could not parse the output from trakt for " + show["show"]["title"], logger.DEBUG)
示例3: findPropers
def findPropers(self, search_date=datetime.datetime.today()):
results = []
sqlResults = db.DBConnection().select(
"SELECT s.show_name, e.showid, e.season, e.episode, e.status, e.airdate FROM tv_episodes AS e"
+ " INNER JOIN tv_shows AS s ON (e.showid = s.indexer_id)"
+ " WHERE e.airdate >= "
+ str(search_date.toordinal())
+ " AND (e.status IN ("
+ ",".join([str(x) for x in Quality.DOWNLOADED])
+ ")"
+ " OR (e.status IN ("
+ ",".join([str(x) for x in Quality.SNATCHED])
+ ")))"
)
if not sqlResults:
return []
for sqlShow in sqlResults:
curShow = helpers.findCertainShow(sickbeard.showList, int(sqlShow["showid"]))
curEp = curShow.getEpisode(int(sqlShow["season"]), int(sqlShow["episode"]))
searchString = self._get_episode_search_strings(curEp, add_string="PROPER|REPACK")
for item in self._doSearch(searchString[0]):
title, url = self._get_title_and_url(item)
results.append(classes.Proper(title, url, datetime.datetime.today()))
return results
示例4: find_xem_numbering
def find_xem_numbering(indexer_id, season, episode):
"""
Returns the scene numbering, as retrieved from xem.
Refreshes/Loads as needed.
@param indexer_id: int
@param season: int
@param episode: int
@return: (int, int) a tuple of scene_season, scene_episode, or None if there is no special mapping.
"""
if indexer_id is None or season is None or episode is None:
return None
showObj = helpers.findCertainShow(sickbeard.showList, indexer_id)
if showObj is None: return None
indexer = showObj.indexer
if _xem_refresh_needed(indexer_id):
_xem_refresh(indexer_id)
cacheDB = db.DBConnection('cache.db')
rows = cacheDB.select(
"SELECT scene_season, scene_episode FROM xem_numbering WHERE indexer = ? and indexer_id = ? and season = ? and episode = ?",
[indexer, indexer_id, season, episode])
if rows:
return (int(rows[0]["scene_season"]), int(rows[0]["scene_episode"]))
else:
return None
示例5: get_xem_numbering_for_season
def get_xem_numbering_for_season(indexer_id, season):
"""
Returns a dict of (season, episode) : (sceneSeason, sceneEpisode) mappings
for an entire show. Both the keys and values of the dict are tuples.
Will be empty if there are no scene numbers set
"""
if indexer_id is None or season is None:
return {}
showObj = helpers.findCertainShow(sickbeard.showList, indexer_id)
if showObj is None: return {}
indexer = showObj.indexer
if _xem_refresh_needed(indexer_id):
_xem_refresh(indexer_id)
cacheDB = db.DBConnection('cache.db')
rows = cacheDB.select(
'SELECT season, scene_season FROM xem_numbering WHERE indexer = ? and indexer_id = ? AND season = ? ORDER BY season, [indexer, indexer_id, season]')
result = {}
if rows:
for row in rows:
result.setdefault(int(row['season']), []).append(int(row['scene_season']))
else:
result.setdefault(int(season), []).append(int(season))
return result
示例6: addDefaultShow
def addDefaultShow(self, indexer, indexer_id, name, status):
"""
Adds a new show with the default settings
"""
if not helpers.findCertainShow(sickbeard.showList, int(indexer_id)):
logger.log(u"Adding show " + str(indexer_id))
root_dirs = sickbeard.ROOT_DIRS.split('|')
try:
location = root_dirs[int(root_dirs[0]) + 1]
except:
location = None
if location:
showPath = ek(os.path.join, location, helpers.sanitizeFileName(name))
dir_exists = helpers.makeDir(showPath)
if not dir_exists:
logger.log(u"Unable to create the folder %s , can't add the show" % showPath, logger.WARNING)
return
else:
helpers.chmodAsParent(showPath)
sickbeard.showQueueScheduler.action.addShow(int(indexer), int(indexer_id), showPath,
default_status=status,
quality=int(sickbeard.QUALITY_DEFAULT),
flatten_folders=int(sickbeard.FLATTEN_FOLDERS_DEFAULT),
paused=sickbeard.TRAKT_START_PAUSED,
default_status_after=status,
archive=sickbeard.ARCHIVE_DEFAULT)
else:
logger.log(u"There was an error creating the show, no root directory setting found", logger.WARNING)
return
示例7: updateAiringList
def updateAiringList():
logger.log("Searching DB and building list of airing episodes")
curDate = datetime.date.today().toordinal()
myDB = db.DBConnection()
sqlResults = myDB.select("SELECT * FROM tv_episodes WHERE status == " + str(UNAIRED) + " AND airdate <= " + str(curDate))
epList = []
for sqlEp in sqlResults:
try:
show = helpers.findCertainShow (sickbeard.showList, int(sqlEp["showid"]))
except exceptions.MultipleShowObjectsException:
logger.log("ERROR: expected to find a single show matching " + sqlEp["showid"])
return None
except exceptions.SickBeardException, e:
logger.log("Unexpected exception: "+str(e), logger.ERROR)
continue
# we aren't ever downloading specials
if int(sqlEp["season"]) == 0:
continue
if show == None:
continue
ep = show.getEpisode(sqlEp["season"], sqlEp["episode"])
if ep == None:
logger.log("Somehow "+show.name+" - "+str(sqlEp["season"])+"x"+str(sqlEp["episode"])+" is None", logger.ERROR)
else:
epList.append(ep)
示例8: updateMissingList
def updateMissingList():
logger.log("Searching DB and building list of MISSED episodes")
myDB = db.DBConnection()
sqlResults = myDB.select("SELECT * FROM tv_episodes WHERE status=" + str(MISSED))
epList = []
for sqlEp in sqlResults:
try:
show = helpers.findCertainShow(sickbeard.showList, int(sqlEp["showid"]))
except exceptions.MultipleShowObjectsException:
logger.log("ERROR: expected to find a single show matching " + sqlEp["showid"])
return None
# we aren't ever downloading specials
if int(sqlEp["season"]) == 0:
continue
if show == None:
continue
ep = show.getEpisode(sqlEp["season"], sqlEp["episode"])
if ep == None:
logger.log(
"Somehow " + show.name + " - " + str(sqlEp["season"]) + "x" + str(sqlEp["episode"]) + " is None",
logger.ERROR,
)
else:
epList.append(ep)
sickbeard.missingList = epList
示例9: _getProperList
def _getProperList(self):
propers = {}
# for each provider get a list of the propers
for curProvider in providers.sortedProviderList():
if not curProvider.isActive():
continue
search_date = datetime.datetime.today() - datetime.timedelta(days=2)
logger.log(u"Searching for any new PROPER releases from " + curProvider.name)
try:
curPropers = curProvider.findPropers(search_date)
except exceptions.AuthException, e:
logger.log(u"Authentication error: " + ex(e), logger.ERROR)
continue
# if they haven't been added by a different provider than add the proper to the list
for x in curPropers:
showObj = helpers.findCertainShow(sickbeard.showList, x.indexerid)
if not showObj:
logger.log(u"Unable to find the show in our watch list " + str(x.name), logger.DEBUG)
continue
name = self._genericName(x.name)
if not name in propers:
logger.log(u"Found new proper: " + x.name, logger.DEBUG)
x.provider = curProvider
propers[name] = x
示例10: updateEpisodes
def updateEpisodes(self):
"""
Sets episodes to wanted that are in trakt watchlist
"""
logger.log(u"Starting trakt episode watchlist check", logger.DEBUG)
try:
watchlist = self.trakt_api.traktRequest("sync/watchlist/episodes")
except (traktException, traktAuthException, traktServerBusy) as e:
logger.log(u"Could not connect to Trakt service: %s" % ex(e), logger.WARNING)
return
if not len(watchlist):
logger.log(u"No shows found in your watchlist, aborting watchlist update", logger.DEBUG)
return
for show in watchlist:
indexer = int(sickbeard.TRAKT_DEFAULT_INDEXER)
if indexer == 2:
indexer_id = int(show["show"]["ids"]["tvrage"])
else:
indexer_id = int(show["show"]["ids"]["tvdb"])
self.addDefaultShow(indexer, indexer_id, show["show"]["title"], SKIPPED)
newShow = helpers.findCertainShow(sickbeard.showList, indexer_id)
try:
if newShow and newShow.indexer == indexer:
for episode in show["episode"]:
if newShow is not None:
self.setEpisodeToWanted(newShow, episode["season"], episode["number"])
else:
self.todoWanted.append((indexer_id, episode["season"], episode["number"]))
except TypeError:
logger.log(u"Could not parse the output from trakt for " + show["show"]["title"], logger.DEBUG)
示例11: _addCacheEntry
def _addCacheEntry(self, name, url, season=None, episodes=None, tvdb_id=0, tvrage_id=0, quality=None, extraNames=[]):
"""Return False|None
Parse the name and try to get as much info out of it as we can
Will use anime regex's if this is called from fanzub
On a succesfull parse it will add the parsed infos into the cache.db
This dosen't mean the parsed result is usefull
"""
myDB = self._getDB()
show = None
if tvdb_id:
show = helpers.findCertainShow(sickbeard.showList, tvdb_id)
# if we don't have complete info then parse the filename to get it
for curName in [name] + extraNames:
cp = CompleteParser(show=show)
cpr = cp.parse(curName)
if cpr.sxxexx and cpr.parse_result:
break
else:
return False
episodeText = "|"+"|".join(map(str, cpr.episodes))+"|"
# get the current timestamp
curTimestamp = int(time.mktime(datetime.datetime.today().timetuple()))
myDB.action("INSERT INTO "+self.providerID+" (name, season, episodes, tvrid, tvdbid, url, time, quality, release_group, proper) VALUES (?,?,?,?,?,?,?,?,?,?)",
[name, cpr.season, episodeText, 0, cpr.tvdbid, url, curTimestamp, cpr.quality, cpr.release_group, int(cpr.is_proper)])
示例12: updateShows
def updateShows(self):
logger.log(u"Starting trakt show watchlist check", logger.DEBUG)
try:
watchlist = self.trakt_api.traktRequest("sync/watchlist/shows")
except (traktException, traktAuthException, traktServerBusy) as e:
logger.log(u"Could not connect to Trakt service: %s" % ex(e), logger.WARNING)
return
if not len(watchlist):
logger.log(u"No shows found in your watchlist, aborting watchlist update", logger.DEBUG)
return
for show in watchlist:
indexer = int(sickbeard.TRAKT_DEFAULT_INDEXER)
if indexer == 2:
indexer_id = int(show["show"]["ids"]["tvrage"])
else:
indexer_id = int(show["show"]["ids"]["tvdb"])
if int(sickbeard.TRAKT_METHOD_ADD) != 2:
self.addDefaultShow(indexer, indexer_id, show["show"]["title"], SKIPPED)
else:
self.addDefaultShow(indexer, indexer_id, show["show"]["title"], WANTED)
if int(sickbeard.TRAKT_METHOD_ADD) == 1:
newShow = helpers.findCertainShow(sickbeard.showList, indexer_id)
if newShow is not None:
self.setEpisodeToWanted(newShow, 1, 1)
else:
self.todoWanted.append((indexer_id, 1, 1))
示例13: find_propers
def find_propers(self, **kwargs):
"""
Search for releases of type PROPER
:return: list of Proper objects
"""
results = []
search_terms = getattr(self, 'proper_search_terms', ['proper', 'repack'])
if not isinstance(search_terms, list):
if None is search_terms:
search_terms = 'proper|repack'
search_terms = [search_terms]
items = self._search_provider({'Propers': search_terms})
clean_term = re.compile(r'(?i)[^a-z1-9\|\.]+')
for proper_term in search_terms:
proper_check = re.compile(r'(?i)(?:%s)' % clean_term.sub('', proper_term))
for item in items:
title, url = self._title_and_url(item)
if proper_check.search(title):
results.append(classes.Proper(title, url, datetime.datetime.today(),
helpers.findCertainShow(sickbeard.showList, None)))
return results
示例14: massEdit
def massEdit(self, toEdit=None):
t = PageTemplate(file="manage_massEdit.tmpl")
t.submenu = ManageMenu
if not toEdit:
redirect("/manage")
showIDs = toEdit.split("|")
showList = []
for curID in showIDs:
curID = int(curID)
showObj = helpers.findCertainShow(sickbeard.showList, curID)
if showObj:
showList.append(showObj)
season_folders_all_same = True
last_season_folders = None
paused_all_same = True
last_paused = None
quality_all_same = True
last_quality = None
root_dir_list = []
for curShow in showList:
cur_root_dir = ek.ek(os.path.dirname, curShow._location)
if cur_root_dir not in root_dir_list:
root_dir_list.append(cur_root_dir)
# if we know they're not all the same then no point even bothering
if paused_all_same:
# if we had a value already and this value is different then they're not all the same
if last_paused not in (curShow.paused, None):
paused_all_same = False
else:
last_paused = curShow.paused
if season_folders_all_same:
if last_season_folders not in (None, curShow.seasonfolders):
season_folders_all_same = False
else:
last_season_folders = curShow.seasonfolders
if quality_all_same:
if last_quality not in (None, curShow.quality):
quality_all_same = False
else:
last_quality = curShow.quality
t.showList = toEdit
t.paused_value = last_paused if paused_all_same else None
t.season_folders_value = last_season_folders if season_folders_all_same else None
t.quality_value = last_quality if quality_all_same else None
t.root_dir_list = root_dir_list
return _munge(t)
示例15: _load_saved_torrents
def _load_saved_torrents(deleteSaveFile=True):
torrent_save_file = _get_running_torrents_pickle_path(False)
if os.path.isfile(torrent_save_file):
try:
data_from_pickle = pickle.load(open(torrent_save_file, "rb"))
for td in data_from_pickle:
if 'episodes' not in td: # older pickles won't have these...
td['episodes'] = []
if 'originalTorrentUrl' not in td:
td['originalTorrentUrl'] = None
if 'blacklistOrigUrlOnFailure' not in td:
td['blacklistOrigUrlOnFailure'] = False
tvEpObjs = []
for ep in td['episodes']:
shw = helpers.findCertainShow(sickbeard.showList, ep['tvdbid'])
tvEpObjs.append(TVEpisode(show=shw, season=ep['season'], episode=ep['episode']))
download_from_torrent(torrent=td['torrent'],
postProcessingDone=td['post_processed'],
start_time=td['start_time'],
key=td['key'],
episodes=tvEpObjs,
originalTorrentUrl=td['originalTorrentUrl'],
blacklistOrigUrlOnFailure=td['blacklistOrigUrlOnFailure'])
except Exception, e:
logger.log(u'Failure while reloading running torrents: %s' % (ex(e)), logger.ERROR)
if deleteSaveFile:
os.remove(torrent_save_file)