本文整理汇总了Python中sickbeard.common.Quality.splitCompositeStatus方法的典型用法代码示例。如果您正苦于以下问题:Python Quality.splitCompositeStatus方法的具体用法?Python Quality.splitCompositeStatus怎么用?Python Quality.splitCompositeStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sickbeard.common.Quality
的用法示例。
在下文中一共展示了Quality.splitCompositeStatus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: logSubtitle
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import splitCompositeStatus [as 别名]
def logSubtitle(showid, season, episode, status, subtitleResult):
resource = subtitleResult.path
provider = subtitleResult.service
status, quality = Quality.splitCompositeStatus(status)
action = Quality.compositeStatus(SUBTITLED, quality)
_logHistoryItem(action, showid, season, episode, quality, resource, provider)
示例2: revert_episode
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import splitCompositeStatus [as 别名]
def revert_episode(ep_obj):
"""Restore the episodes of a failed download to their original state"""
sql_results = db_select(
'SELECT * FROM history t WHERE t.showid=? AND t.season=?', [ep_obj.show.indexerid, ep_obj.season])
history_eps = {r['episode']: r for r in sql_results}
try:
logger.log('Reverting episode %sx%s: [%s]' % (ep_obj.season, ep_obj.episode, ep_obj.name))
with ep_obj.lock:
if ep_obj.episode in history_eps:
status_revert = history_eps[ep_obj.episode]['old_status']
status, quality = Quality.splitCompositeStatus(status_revert)
logger.log('Found in failed.db history with status: %s quality: %s' % (
statusStrings[status], Quality.qualityStrings[quality]))
else:
status_revert = WANTED
logger.log('Episode not found in failed.db history. Setting it to WANTED', logger.WARNING)
ep_obj.status = status_revert
ep_obj.saveToDB()
except EpisodeNotFoundException as e:
logger.log('Unable to create episode, please set its status manually: %s' % ex(e), logger.WARNING)
示例3: logFailed
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import splitCompositeStatus [as 别名]
def logFailed(epObj, release, provider=None):
showid = int(epObj.show.indexerid)
season = int(epObj.season)
epNum = int(epObj.episode)
status, quality = Quality.splitCompositeStatus(epObj.status)
action = Quality.compositeStatus(FAILED, quality)
_logHistoryItem(action, showid, season, epNum, quality, release, provider)
示例4: refine_video
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import splitCompositeStatus [as 别名]
def refine_video(video, episode):
# try to enrich video object using information in original filename
if episode.release_name:
guess_ep = Episode.fromguess(None, guessit(episode.release_name))
for name in vars(guess_ep):
if getattr(guess_ep, name) and not getattr(video, name):
setattr(video, name, getattr(guess_ep, name))
# Use sickbeard metadata
metadata_mapping = {
'episode': 'episode',
'release_group': 'release_group',
'season': 'season',
'series': 'show.name',
'series_imdb_id': 'show.imdbid',
'size': 'file_size',
'title': 'name',
'year': 'show.startyear'
}
def get_attr_value(obj, name):
value = None
for attr in name.split('.'):
if not value:
value = getattr(obj, attr, None)
else:
value = getattr(value, attr, None)
return value
for name in metadata_mapping:
if not getattr(video, name) and get_attr_value(episode, metadata_mapping[name]):
setattr(video, name, get_attr_value(episode, metadata_mapping[name]))
elif episode.show.subtitles_sr_metadata and get_attr_value(episode, metadata_mapping[name]):
setattr(video, name, get_attr_value(episode, metadata_mapping[name]))
# Set quality from metadata
_, quality = Quality.splitCompositeStatus(episode.status)
if not video.format or episode.show.subtitles_sr_metadata:
if quality & Quality.ANYHDTV:
video.format = Quality.combinedQualityStrings.get(Quality.ANYHDTV)
elif quality & Quality.ANYWEBDL:
video.format = Quality.combinedQualityStrings.get(Quality.ANYWEBDL)
elif quality & Quality.ANYBLURAY:
video.format = Quality.combinedQualityStrings.get(Quality.ANYBLURAY)
if not video.resolution or episode.show.subtitles_sr_metadata:
if quality & (Quality.HDTV | Quality.HDWEBDL | Quality.HDBLURAY):
video.resolution = '720p'
elif quality & Quality.RAWHDTV:
video.resolution = '1080i'
elif quality & (Quality.FULLHDTV | Quality.FULLHDWEBDL | Quality.FULLHDBLURAY):
video.resolution = '1080p'
elif quality & (Quality.UHD_4K_TV | Quality.UHD_4K_WEBDL | Quality.UHD_4K_BLURAY):
video.resolution = '4K'
elif quality & (Quality.UHD_8K_TV | Quality.UHD_8K_WEBDL | Quality.UHD_8K_BLURAY):
video.resolution = '8K'
示例5: logFailed
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import splitCompositeStatus [as 别名]
def logFailed(tvdbid, season, episode, status, release, provider=None):
showid = int(tvdbid)
season = int(season)
epNum = int(episode)
status, quality = Quality.splitCompositeStatus(status)
action = Quality.compositeStatus(FAILED, quality)
_logHistoryItem(action, showid, season, epNum, quality, release, provider)
示例6: refine_video
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import splitCompositeStatus [as 别名]
def refine_video(video, episode):
# try to enrich video object using information in original filename
if episode.release_name:
guess_ep = Episode.fromguess(None, guessit(episode.release_name))
for name in vars(guess_ep):
if getattr(guess_ep, name) and not getattr(video, name):
setattr(video, name, getattr(guess_ep, name))
# Use sickbeard metadata
metadata_mapping = {
"episode": "episode",
"release_group": "release_group",
"season": "season",
"series": "show.name",
"series_imdb_id": "show.imdbid",
"size": "file_size",
"title": "name",
"year": "show.startyear",
}
def get_attr_value(obj, name):
value = None
for attr in name.split("."):
if not value:
value = getattr(obj, attr, None)
else:
value = getattr(value, attr, None)
return value
for name in metadata_mapping:
if not getattr(video, name) and get_attr_value(episode, metadata_mapping[name]):
setattr(video, name, get_attr_value(episode, metadata_mapping[name]))
elif episode.show.subtitles_sr_metadata and get_attr_value(episode, metadata_mapping[name]):
setattr(video, name, get_attr_value(episode, metadata_mapping[name]))
# Set quality form metadata
_, quality = Quality.splitCompositeStatus(episode.status)
if not video.format or episode.show.subtitles_sr_metadata:
if quality & Quality.ANYHDTV:
video.format = Quality.combinedQualityStrings.get(Quality.ANYHDTV)
elif quality & Quality.ANYWEBDL:
video.format = Quality.combinedQualityStrings.get(Quality.ANYWEBDL)
elif quality & Quality.ANYBLURAY:
video.format = Quality.combinedQualityStrings.get(Quality.ANYBLURAY)
if not video.resolution or episode.show.subtitles_sr_metadata:
if quality & (Quality.HDTV | Quality.HDWEBDL | Quality.HDBLURAY):
video.resolution = "720p"
elif quality & Quality.RAWHDTV:
video.resolution = "1080i"
elif quality & (Quality.FULLHDTV | Quality.FULLHDWEBDL | Quality.FULLHDBLURAY):
video.resolution = "1080p"
elif quality & (Quality.UHD_4K_TV | Quality.UHD_4K_WEBDL | Quality.UHD_4K_BLURAY):
video.resolution = "4K"
elif quality & (Quality.UHD_8K_TV | Quality.UHD_8K_WEBDL | Quality.UHD_8K_BLURAY):
video.resolution = "8K"
示例7: set_episode_failed
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import splitCompositeStatus [as 别名]
def set_episode_failed(ep_obj):
try:
with ep_obj.lock:
quality = Quality.splitCompositeStatus(ep_obj.status)[1]
ep_obj.status = Quality.compositeStatus(FAILED, quality)
ep_obj.saveToDB()
except EpisodeNotFoundException as e:
logger.log('Unable to get episode, please set its status manually: %s' % ex(e), logger.WARNING)
示例8: markFailed
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import splitCompositeStatus [as 别名]
def markFailed(epObj):
log_str = u""
try:
with epObj.lock:
quality = Quality.splitCompositeStatus(epObj.status)[1]
epObj.status = Quality.compositeStatus(FAILED, quality)
epObj.saveToDB()
except EpisodeNotFoundException, e:
logger.log(u"Unable to get episode, please set its status manually: " + ex(e), logger.WARNING)
示例9: getQualityClass
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import splitCompositeStatus [as 别名]
def getQualityClass(ep_obj):
"""
Find the quality class for the episode
"""
_, ep_quality = Quality.splitCompositeStatus(ep_obj.status)
if ep_quality in Quality.cssClassStrings:
quality_class = Quality.cssClassStrings[ep_quality]
else:
quality_class = Quality.cssClassStrings[Quality.UNKNOWN]
return quality_class
示例10: markFailed
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import splitCompositeStatus [as 别名]
def markFailed(show_obj, season, episode=None):
log_str = u""
if episode:
try:
ep_obj = show_obj.getEpisode(season, episode)
with ep_obj.lock:
quality = Quality.splitCompositeStatus(ep_obj.status)[1]
ep_obj.status = Quality.compositeStatus(FAILED, quality)
ep_obj.saveToDB()
except exceptions.EpisodeNotFoundException, e:
log_str += _log_helper(u"Unable to get episode, please set its status manually: " + exceptions.ex(e), logger.WARNING)
示例11: logFailed
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import splitCompositeStatus [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)
_logHistoryItem(action, showid, season, epNum, quality, release, provider)
示例12: logSubtitle
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import splitCompositeStatus [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)
_logHistoryItem(action, showid, season, episode, quality, resource, provider)
示例13: markFailed
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import splitCompositeStatus [as 别名]
def markFailed(epObj):
"""
Mark an episode as failed
:param epObj: Episode object to mark as failed
:return: empty string
"""
log_str = u""
try:
with epObj.lock:
quality = Quality.splitCompositeStatus(epObj.status)[1]
epObj.status = Quality.compositeStatus(FAILED, quality)
epObj.saveToDB()
except EpisodeNotFoundException, e:
logger.log(u"Unable to get episode, please set its status manually: " + ex(e), logger.WARNING)
示例14: markFailed
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import splitCompositeStatus [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:
logging.warning("Unable to get episode, please set its status manually: {}".format(ex(e)))
return log_str
示例15: proper
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import splitCompositeStatus [as 别名]
if parse_result.show.rls_require_words and not search.filter_release_name(curProper.name,
parse_result.show.rls_require_words):
logger.log(
u"Ignoring " + curProper.name + " based on required words filter: " + parse_result.show.rls_require_words,
logger.INFO)
continue
# check if we actually want this proper (if it's the right quality)
myDB = db.DBConnection()
sqlResults = myDB.select("SELECT status FROM tv_episodes WHERE showid = ? AND season = ? AND episode = ?",
[curProper.indexerid, curProper.season, curProper.episode])
if not sqlResults:
continue
# only keep the proper if we have already retrieved the same quality ep (don't get better/worse ones)
oldStatus, oldQuality = Quality.splitCompositeStatus(int(sqlResults[0]["status"]))
if oldStatus not in (DOWNLOADED, SNATCHED) or oldQuality != curProper.quality:
continue
# check if we actually want this proper (if it's the right release group and a higher version)
if parse_result.is_anime:
myDB = db.DBConnection()
sqlResults = myDB.select(
"SELECT release_group, version FROM tv_episodes WHERE showid = ? AND season = ? AND episode = ?",
[curProper.indexerid, curProper.season, curProper.episode])
oldVersion = int(sqlResults[0]["version"])
oldRelease_group = (sqlResults[0]["release_group"])
if oldVersion > -1 and oldVersion < curProper.version:
logger.log("Found new anime v" + str(curProper.version) + " to replace existing v" + str(oldVersion))