本文整理汇总了Python中sickrage.core.common.Quality.compositeStatus方法的典型用法代码示例。如果您正苦于以下问题:Python Quality.compositeStatus方法的具体用法?Python Quality.compositeStatus怎么用?Python Quality.compositeStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sickrage.core.common.Quality
的用法示例。
在下文中一共展示了Quality.compositeStatus方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generate_sample_ep
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import compositeStatus [as 别名]
def generate_sample_ep(multi=None, abd=False, sports=False, anime_type=None):
# make a fake episode object
ep = Validator.FakeTVEpisode(2, 3, 3, "Ep Name")
ep.status = Quality.compositeStatus(DOWNLOADED, Quality.HDTV)
ep.airdate = datetime.date(2011, 3, 9)
if abd:
ep.release_name = 'Show.Name.2011.03.09.HDTV.XviD-RLSGROUP'
ep.show.air_by_date = 1
elif sports:
ep.release_name = 'Show.Name.2011.03.09.HDTV.XviD-RLSGROUP'
ep.show.sports = 1
else:
if anime_type != 3:
ep.show.anime = 1
ep.release_name = 'Show.Name.003.HDTV.XviD-RLSGROUP'
else:
ep.release_name = 'Show.Name.S02E03.HDTV.XviD-RLSGROUP'
if multi is not None:
ep.name = "Ep Name (1)"
if anime_type != 3:
ep.show.anime = 1
ep.release_name = 'Show.Name.003-004.HDTV.XviD-RLSGROUP'
secondEp = Validator.FakeTVEpisode(2, 4, 4, "Ep Name (2)")
secondEp.status = Quality.compositeStatus(DOWNLOADED, Quality.HDTV)
secondEp.release_name = ep.release_name
ep.relatedEps.append(secondEp)
else:
ep.release_name = 'Show.Name.S02E03E04E05.HDTV.XviD-RLSGROUP'
secondEp = Validator.FakeTVEpisode(2, 4, 4, "Ep Name (2)")
secondEp.status = Quality.compositeStatus(DOWNLOADED, Quality.HDTV)
secondEp.release_name = ep.release_name
thirdEp = Validator.FakeTVEpisode(2, 5, 5, "Ep Name (3)")
thirdEp.status = Quality.compositeStatus(DOWNLOADED, Quality.HDTV)
thirdEp.release_name = ep.release_name
ep.relatedEps.append(secondEp)
ep.relatedEps.append(thirdEp)
return ep
示例2: logSnatch
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import compositeStatus [as 别名]
def logSnatch(searchResult):
"""
Log history of snatch
:param searchResult: search result object
"""
for curEpObj in searchResult.episodes:
showid = int(curEpObj.show.indexerid)
season = int(curEpObj.season)
episode = int(curEpObj.episode)
quality = searchResult.quality
version = searchResult.version
providerClass = searchResult.provider
if providerClass is not None:
provider = providerClass.name
else:
provider = "unknown"
action = Quality.compositeStatus(SNATCHED, searchResult.quality)
resource = searchResult.name
History._logHistoryItem(action, showid, season, episode, quality, resource, provider, version)
示例3: __init__
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import compositeStatus [as 别名]
def __init__(self, season, episode, absolute_number, name):
self.relatedEps = []
self.name = name
self.season = season
self.episode = episode
self.absolute_number = absolute_number
self.scene_season = season
self.scene_episode = episode
self.scene_absolute_number = absolute_number
self.airdate = datetime.date(2010, 3, 9)
self.show = Validator.FakeTVShow()
self.status = Quality.compositeStatus(DOWNLOADED, Quality.SDTV)
self.release_name = 'Show.Name.S02E03.HDTV.XviD-RLSGROUP'
self.is_proper = True
示例4: logFailed
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import compositeStatus [as 别名]
def logFailed(epObj, release, provider=None):
"""
Log a failed download
:param epObj: Episode object
:param release: Release group
:param provider: Provider used for snatch
"""
showid = int(epObj.show.indexerid)
season = int(epObj.season)
epNum = int(epObj.episode)
status, quality = Quality.splitCompositeStatus(epObj.status)
action = Quality.compositeStatus(FAILED, quality)
History._logHistoryItem(action, showid, season, epNum, quality, release, provider)
示例5: logSubtitle
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import compositeStatus [as 别名]
def logSubtitle(showid, season, episode, status, subtitleResult):
"""
Log download of subtitle
:param showid: Showid of download
:param season: Show season
:param episode: Show episode
:param status: Status of download
:param subtitleResult: Result object
"""
resource = subtitleResult.language.opensubtitles
provider = subtitleResult.provider_name
status, quality = Quality.splitCompositeStatus(status)
action = Quality.compositeStatus(SUBTITLED, quality)
History._logHistoryItem(action, showid, season, episode, quality, resource, provider)
示例6: markFailed
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import compositeStatus [as 别名]
def markFailed(epObj):
"""
Mark an episode as failed
:param epObj: Episode object to mark as failed
:return: empty string
"""
log_str = ""
try:
with epObj.lock:
quality = Quality.splitCompositeStatus(epObj.status)[1]
epObj.status = Quality.compositeStatus(FAILED, quality)
epObj.saveToDB()
except EpisodeNotFoundException as e:
sickrage.srCore.srLogger.warning("Unable to get episode, please set its status manually: {}".format(e.message))
return log_str
示例7: snatchEpisode
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import compositeStatus [as 别名]
def snatchEpisode(result, endStatus=SNATCHED):
"""
Contains the internal logic necessary to actually "snatch" a result that
has been found.
:param result: SearchResult instance to be snatched.
:param endStatus: the episode status that should be used for the episode object once it's snatched.
:return: boolean, True on success
"""
if result is None:
return False
result.priority = 0 # -1 = low, 0 = normal, 1 = high
if sickrage.srCore.srConfig.ALLOW_HIGH_PRIORITY:
# if it aired recently make it high priority
for curEp in result.episodes:
if date.today() - curEp.airdate <= timedelta(days=7):
result.priority = 1
if re.search(r'(^|[\. _-])(proper|repack)([\. _-]|$)', result.name, re.I) is not None:
endStatus = SNATCHED_PROPER
if result.url.startswith('magnet') or result.url.endswith('torrent'):
result.resultType = 'torrent'
dlResult = False
if result.resultType in ("nzb", "nzbdata"):
if sickrage.srCore.srConfig.NZB_METHOD == "blackhole":
dlResult = _downloadResult(result)
elif sickrage.srCore.srConfig.NZB_METHOD == "sabnzbd":
dlResult = SabNZBd.sendNZB(result)
elif sickrage.srCore.srConfig.NZB_METHOD == "nzbget":
is_proper = True if endStatus == SNATCHED_PROPER else False
dlResult = NZBGet.sendNZB(result, is_proper)
else:
sickrage.srCore.srLogger.error(
"Unknown NZB action specified in config: " + sickrage.srCore.srConfig.NZB_METHOD)
elif result.resultType == "torrent":
if sickrage.srCore.srConfig.TORRENT_METHOD == "blackhole":
dlResult = _downloadResult(result)
else:
if all([not result.content, not result.url.startswith('magnet:')]):
result.content = sickrage.srCore.srWebSession.get(result.url).content
if any([result.content, result.url.startswith('magnet:')]):
# add public trackers to magnet url for non-private torrent providers
if not result.provider.private and result.url.startswith('magnet:'):
result.url += '&tr='.join(
[x.strip() for x in sickrage.srCore.srConfig.TORRENT_TRACKERS.split(',') if x.strip()])
client = getClientIstance(sickrage.srCore.srConfig.TORRENT_METHOD)()
dlResult = client.sendTORRENT(result)
else:
sickrage.srCore.srLogger.warning("Torrent file content is empty")
else:
sickrage.srCore.srLogger.error("Unknown result type, unable to download it (%r)" % result.resultType)
# no download results found
if not dlResult:
return False
if sickrage.srCore.srConfig.USE_FAILED_DOWNLOADS:
FailedHistory.logSnatch(result)
sickrage.srCore.srNotifications.message('Episode snatched', result.name)
History.logSnatch(result)
# don't notify when we re-download an episode
sql_l = []
trakt_data = []
for curEpObj in result.episodes:
with curEpObj.lock:
if isFirstBestMatch(result):
curEpObj.status = Quality.compositeStatus(SNATCHED_BEST, result.quality)
else:
curEpObj.status = Quality.compositeStatus(endStatus, result.quality)
sql_q = curEpObj.saveToDB(False)
if sql_q:
sql_l.append(sql_q)
if curEpObj.status not in Quality.DOWNLOADED:
try:
srNotifiers.notify_snatch(
curEpObj._format_pattern('%SN - %Sx%0E - %EN - %QN') + " from " + result.provider.name)
except:
sickrage.srCore.srLogger.debug("Failed to send snatch notification")
trakt_data.append((curEpObj.season, curEpObj.episode))
data = sickrage.srCore.notifiersDict.trakt_notifier.trakt_episode_data_generate(trakt_data)
if sickrage.srCore.srConfig.USE_TRAKT and sickrage.srCore.srConfig.TRAKT_SYNC_WATCHLIST:
sickrage.srCore.srLogger.debug(
"Add episodes, showid: indexerid " + str(result.show.indexerid) + ", Title " + str(
result.show.name) + " to Traktv Watchlist")
if data:
sickrage.srCore.notifiersDict.trakt_notifier.update_watchlist(result.show, data_episode=data, update="add")
#.........这里部分代码省略.........
示例8: snatchEpisode
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import compositeStatus [as 别名]
def snatchEpisode(result, endStatus=SNATCHED):
"""
Contains the internal logic necessary to actually "snatch" a result that
has been found.
:param result: SearchResult instance to be snatched.
:param endStatus: the episode status that should be used for the episode object once it's snatched.
:return: boolean, True on success
"""
if result is None:
return False
result.priority = 0 # -1 = low, 0 = normal, 1 = high
if sickrage.app.config.allow_high_priority:
# if it aired recently make it high priority
for curEp in result.episodes:
if date.today() - curEp.airdate <= timedelta(days=7):
result.priority = 1
if re.search(r'(^|[. _-])(proper|repack)([. _-]|$)', result.name, re.I) is not None:
endStatus = SNATCHED_PROPER
# get result content
result.content = result.provider.get_content(result.url)
dlResult = False
if result.resultType in ("nzb", "nzbdata"):
if sickrage.app.config.nzb_method == "blackhole":
dlResult = result.provider.download_result(result)
elif sickrage.app.config.nzb_method == "sabnzbd":
dlResult = SabNZBd.sendNZB(result)
elif sickrage.app.config.nzb_method == "nzbget":
is_proper = True if endStatus == SNATCHED_PROPER else False
dlResult = NZBGet.sendNZB(result, is_proper)
else:
sickrage.app.log.error("Unknown NZB action specified in config: " + sickrage.app.config.nzb_method)
elif result.resultType in ("torrent", "torznab"):
# add public trackers to torrent result
if not result.provider.private:
result = result.provider.add_trackers(result)
if sickrage.app.config.torrent_method == "blackhole":
dlResult = result.provider.download_result(result)
else:
if any([result.content, result.url.startswith('magnet:')]):
client = getClientIstance(sickrage.app.config.torrent_method)()
dlResult = client.send_torrent(result)
else:
sickrage.app.log.warning("Torrent file content is empty")
else:
sickrage.app.log.error("Unknown result type, unable to download it (%r)" % result.resultType)
# no download results found
if not dlResult:
return False
FailedHistory.logSnatch(result)
sickrage.app.alerts.message(_('Episode snatched'), result.name)
History.logSnatch(result)
# don't notify when we re-download an episode
trakt_data = []
for curEpObj in result.episodes:
with curEpObj.lock:
if isFirstBestMatch(result):
curEpObj.status = Quality.compositeStatus(SNATCHED_BEST, result.quality)
else:
curEpObj.status = Quality.compositeStatus(endStatus, result.quality)
# save episode to DB
curEpObj.save_to_db()
if curEpObj.status not in Quality.DOWNLOADED:
try:
Notifiers.mass_notify_snatch(
curEpObj._format_pattern('%SN - %Sx%0E - %EN - %QN') + " from " + result.provider.name)
except:
sickrage.app.log.debug("Failed to send snatch notification")
trakt_data.append((curEpObj.season, curEpObj.episode))
data = sickrage.app.notifier_providers['trakt'].trakt_episode_data_generate(trakt_data)
if sickrage.app.config.use_trakt and sickrage.app.config.trakt_sync_watchlist:
sickrage.app.log.debug(
"Add episodes, showid: indexerid " + str(result.show.indexerid) + ", Title " + str(
result.show.name) + " to Traktv Watchlist")
if data:
sickrage.app.notifier_providers['trakt'].update_watchlist(result.show, data_episode=data, update="add")
return True
示例9: snatchEpisode
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import compositeStatus [as 别名]
def snatchEpisode(result, endStatus=SNATCHED):
"""
Contains the internal logic necessary to actually "snatch" a result that
has been found.
:param result: SearchResult instance to be snatched.
:param endStatus: the episode status that should be used for the episode object once it's snatched.
:return: boolean, True on success
"""
if result is None:
return False
result.priority = 0 # -1 = low, 0 = normal, 1 = high
if sickrage.ALLOW_HIGH_PRIORITY:
# if it aired recently make it high priority
for curEp in result.episodes:
if datetime.date.today() - curEp.airdate <= datetime.timedelta(days=7):
result.priority = 1
if re.search(r"(^|[\. _-])(proper|repack)([\. _-]|$)", result.name, re.I) is not None:
endStatus = SNATCHED_PROPER
if result.url.startswith("magnet") or result.url.endswith("torrent"):
result.resultType = "torrent"
# NZBs can be sent straight to SAB or saved to disk
if result.resultType in ("nzb", "nzbdata"):
if sickrage.NZB_METHOD == "blackhole":
dlResult = _downloadResult(result)
elif sickrage.NZB_METHOD == "sabnzbd":
dlResult = SabNZBd.sendNZB(result)
elif sickrage.NZB_METHOD == "nzbget":
is_proper = True if endStatus == SNATCHED_PROPER else False
dlResult = NZBGet.sendNZB(result, is_proper)
else:
sickrage.LOGGER.error("Unknown NZB action specified in config: " + sickrage.NZB_METHOD)
dlResult = False
# TORRENTs can be sent to clients or saved to disk
elif result.resultType == "torrent":
# torrents are saved to disk when blackhole mode
if sickrage.TORRENT_METHOD == "blackhole":
dlResult = _downloadResult(result)
else:
if not result.content and not result.url.startswith("magnet"):
result.content = result.provider.getURL(result.url, needBytes=True)
if result.content or result.url.startswith("magnet"):
client = getClientIstance(sickrage.TORRENT_METHOD)()
dlResult = client.sendTORRENT(result)
else:
sickrage.LOGGER.warning("Torrent file content is empty")
dlResult = False
else:
sickrage.LOGGER.error("Unknown result type, unable to download it (%r)" % result.resultType)
dlResult = False
if not dlResult:
return False
if sickrage.USE_FAILED_DOWNLOADS:
FailedHistory.logSnatch(result)
notifications.message("Episode snatched", result.name)
History.logSnatch(result)
# don't notify when we re-download an episode
sql_l = []
trakt_data = []
for curEpObj in result.episodes:
with curEpObj.lock:
if isFirstBestMatch(result):
curEpObj.status = Quality.compositeStatus(SNATCHED_BEST, result.quality)
else:
curEpObj.status = Quality.compositeStatus(endStatus, result.quality)
sql_l.append(curEpObj.get_sql())
if curEpObj.status not in Quality.DOWNLOADED:
try:
notify_snatch(curEpObj._format_pattern("%SN - %Sx%0E - %EN - %QN") + " from " + result.provider.name)
except:
sickrage.LOGGER.debug("Failed to send snatch notification")
trakt_data.append((curEpObj.season, curEpObj.episode))
data = sickrage.NOTIFIERS.trakt_notifier.trakt_episode_data_generate(trakt_data)
if sickrage.USE_TRAKT and sickrage.TRAKT_SYNC_WATCHLIST:
sickrage.LOGGER.debug(
"Add episodes, showid: indexerid "
+ str(result.show.indexerid)
+ ", Title "
+ str(result.show.name)
+ " to Traktv Watchlist"
)
if data:
sickrage.NOTIFIERS.trakt_notifier.update_watchlist(result.show, data_episode=data, update="add")
#.........这里部分代码省略.........