本文整理汇总了Python中sickbeard.common.Quality.compositeStatus方法的典型用法代码示例。如果您正苦于以下问题:Python Quality.compositeStatus方法的具体用法?Python Quality.compositeStatus怎么用?Python Quality.compositeStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sickbeard.common.Quality
的用法示例。
在下文中一共展示了Quality.compositeStatus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_logSnatch
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import compositeStatus [as 别名]
def test_logSnatch(self):
myDB = db.DBConnection("../sickbeard.db")
#res = myDB.select("SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;")
#for r in res:
#print r["name"]
#print "tables-----------------------"
searchResult=SearchResults([Episode(12345,2,4),Episode(54321,1,3)])
history.logSnatch(searchResult)
#check if elements added
res=myDB.select("SELECT COUNT(*) FROM history WHERE (action=? AND date=? AND showid=? AND season=? AND episode=? AND quality=? AND resource=? AND provider=?)",
[Quality.compositeStatus(SNATCHED, 4), datetime.datetime.today().strftime(dateFormat), 12345, 2, 4, 4, "searchName", "unknown"])
self.assertEqual(len(res),1)
res=myDB.select("SELECT COUNT(*) FROM history WHERE (action=? AND date=? AND showid=? AND season=? AND episode=? AND quality=? AND resource=? AND provider=?)",
[Quality.compositeStatus(SNATCHED, 4), datetime.datetime.today().strftime(dateFormat), 54321, 1, 3, 4, "searchName", "unknown"])
self.assertEqual(len(res),1)
#delete just-added elements
myDB.action("DELETE FROM history WHERE (action=? AND date=? AND showid=? AND season=? AND episode=? AND quality=? AND resource=? AND provider=?)",
[Quality.compositeStatus(SNATCHED, 4), datetime.datetime.today().strftime(dateFormat), 12345, 2, 4, 4, "searchName", "unknown"])
myDB.action("DELETE FROM history WHERE (action=? AND date=? AND showid=? AND season=? AND episode=? AND quality=? AND resource=? AND provider=?)",
[Quality.compositeStatus(SNATCHED, 4), datetime.datetime.today().strftime(dateFormat), 54321, 1, 3, 4, "searchName", "unknown"])
示例2: generate_sample_ep
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import compositeStatus [as 别名]
def generate_sample_ep(multi=None, abd=False, sports=False, anime_type=None):
# make a fake episode object
ep = TVEpisode(2, 3, 3, "Ep Name")
# pylint: disable=protected-access
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 = TVEpisode(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 = TVEpisode(2, 4, 4, "Ep Name (2)")
secondEp._status = Quality.compositeStatus(DOWNLOADED, Quality.HDTV)
secondEp._release_name = ep._release_name
thirdEp = TVEpisode(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
示例3: logSnatch
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.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 != None:
provider = providerClass.name
else:
provider = "unknown"
action = Quality.compositeStatus(SNATCHED, searchResult.quality)
resource = searchResult.name
_logHistoryItem(action, showid, season, episode, quality, resource, provider, version)
示例4: logSubtitle
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import compositeStatus [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)
示例5: history_snatched_proper_fix
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import compositeStatus [as 别名]
def history_snatched_proper_fix():
my_db = db.DBConnection()
if not my_db.has_flag('history_snatch_proper'):
logger.log('Updating history items with status Snatched Proper in a background process...')
sql_result = my_db.select('SELECT rowid, resource, quality, showid'
' FROM history'
' WHERE action LIKE "%%%02d"' % SNATCHED +
' AND (UPPER(resource) LIKE "%PROPER%"'
' OR UPPER(resource) LIKE "%REPACK%"'
' OR UPPER(resource) LIKE "%REAL%")')
if sql_result:
cl = []
for r in sql_result:
show_obj = None
try:
show_obj = helpers.findCertainShow(sickbeard.showList, int(r['showid']))
except (StandardError, Exception):
pass
np = NameParser(False, showObj=show_obj, testing=True)
try:
pr = np.parse(r['resource'])
except (StandardError, Exception):
continue
if 0 < Quality.get_proper_level(pr.extra_info_no_name(), pr.version, pr.is_anime):
cl.append(['UPDATE history SET action = ? WHERE rowid = ?',
[Quality.compositeStatus(SNATCHED_PROPER, int(r['quality'])),
r['rowid']]])
if cl:
my_db.mass_action(cl)
logger.log('Completed the history table update with status Snatched Proper.')
my_db.add_flag('history_snatch_proper')
示例6: logFailed
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import compositeStatus [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)
示例7: logFailed
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import compositeStatus [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)
示例8: set_episode_failed
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import compositeStatus [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)
示例9: markFailed
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import compositeStatus [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)
示例10: __init__
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import compositeStatus [as 别名]
def __init__(self, season, episode, absolute_number, name): # pylint: disable=super-init-not-called
super(TVEpisode, self).__init__(None, season, episode)
self.related_episodes = []
self.name = name
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.status = Quality.compositeStatus(common.DOWNLOADED, common.Quality.SDTV)
self.release_name = 'Show.Name.S02E03.HDTV.XviD-RLSGROUP'
self.is_proper = True
self.show = TVShow()
示例11: markFailed
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import compositeStatus [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)
示例12: __init__
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.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 = TVShow()
self._status = Quality.compositeStatus(common.DOWNLOADED, common.Quality.SDTV)
self._release_name = 'Show.Name.S02E03.HDTV.XviD-RLSGROUP'
self._is_proper = True
示例13: logFailed
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.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)
_logHistoryItem(action, showid, season, epNum, quality, release, provider)
示例14: test_should_delete_episode
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import compositeStatus [as 别名]
def test_should_delete_episode(self):
test_cases = [
((SNATCHED, Quality.HDTV), False),
((SNATCHED_PROPER, Quality.HDTV), False),
((SNATCHED_BEST, Quality.HDTV), False),
((DOWNLOADED, Quality.HDTV), False),
((ARCHIVED, Quality.HDTV), False),
((ARCHIVED, Quality.NONE), False),
((SKIPPED, Quality.NONE), True),
((IGNORED, Quality.NONE), False),
((UNAIRED, Quality.NONE), True),
((UNKNOWN, Quality.NONE), True),
((WANTED, Quality.NONE), True),
]
for c, b in test_cases:
self.assertEqual(helpers.should_delete_episode(Quality.compositeStatus(*c)), b)
示例15: markFailed
# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.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 = 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)