本文整理汇总了Python中sickrage.core.common.Quality.nameQuality方法的典型用法代码示例。如果您正苦于以下问题:Python Quality.nameQuality方法的具体用法?Python Quality.nameQuality怎么用?Python Quality.nameQuality使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sickrage.core.common.Quality
的用法示例。
在下文中一共展示了Quality.nameQuality方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_RAWHDTV
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import nameQuality [as 别名]
def test_RAWHDTV(self):
from sickrage.core.common import Quality
self.assertEqual(Quality.RAWHDTV, Quality.nameQuality("Test.Show.S01E02.720p.HDTV.DD5.1.MPEG2-GROUP"))
self.assertEqual(Quality.RAWHDTV, Quality.nameQuality("Test.Show.S01E02.1080i.HDTV.DD2.0.MPEG2-GROUP"))
self.assertEqual(Quality.RAWHDTV, Quality.nameQuality("Test.Show.S01E02.1080i.HDTV.H.264.DD2.0-GROUP"))
self.assertEqual(Quality.RAWHDTV, Quality.nameQuality("Test Show - S01E02 - 1080i HDTV MPA1.0 H.264 - GROUP"))
self.assertEqual(Quality.RAWHDTV, Quality.nameQuality("Test.Show.S01E02.1080i.HDTV.DD.5.1.h264-GROUP"))
示例2: test_HDWEBDL
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import nameQuality [as 别名]
def test_HDWEBDL(self):
from sickrage.core.common import Quality
self.assertEqual(Quality.HDWEBDL, Quality.nameQuality("Test.Show.S01E02.720p.WEB-DL-GROUP"))
self.assertEqual(Quality.HDWEBDL, Quality.nameQuality("Test.Show.S01E02.720p.WEBRip-GROUP"))
self.assertEqual(Quality.HDWEBDL, Quality.nameQuality("Test.Show.S01E02.WEBRip.720p.H.264.AAC.2.0-GROUP"))
self.assertEqual(Quality.HDWEBDL, Quality.nameQuality("Test.Show.S01E02.720p.WEB-DL.AAC2.0.H.264-GROUP"))
self.assertEqual(Quality.HDWEBDL, Quality.nameQuality("Test Show S01E02 720p WEB-DL AAC2 0 H 264-GROUP"))
self.assertEqual(Quality.HDWEBDL, Quality.nameQuality("Test_Show.S01E02_720p_WEB-DL_AAC2.0_H264-GROUP"))
self.assertEqual(Quality.HDWEBDL, Quality.nameQuality("Test.Show.S01E02.720p.WEB-DL.AAC2.0.H264-GROUP"))
self.assertEqual(Quality.HDWEBDL, Quality.nameQuality("Test.Show.S01E02.720p.iTunes.Rip.H264.AAC-GROUP"))
self.assertEqual(Quality.HDWEBDL, Quality.nameQuality("Test.Show.S01E02.720p.AMZN.WEBRip.DDP5.1.x264-GROUP"))
示例3: test_FULLHDWEBDL
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import nameQuality [as 别名]
def test_FULLHDWEBDL(self):
from sickrage.core.common import Quality
self.assertEqual(Quality.FULLHDWEBDL, Quality.nameQuality("Test.Show.S01E02.1080p.WEB-DL-GROUP"))
self.assertEqual(Quality.FULLHDWEBDL, Quality.nameQuality("Test.Show.S01E02.1080p.WEBRip-GROUP"))
self.assertEqual(Quality.FULLHDWEBDL, Quality.nameQuality("Test.Show.S01E02.WEBRip.1080p.H.264.AAC.2.0-GROUP"))
self.assertEqual(Quality.FULLHDWEBDL, Quality.nameQuality("Test.Show.S01E02.WEBRip.1080p.H264.AAC.2.0-GROUP"))
self.assertEqual(Quality.FULLHDWEBDL, Quality.nameQuality("Test.Show.S01E02.1080p.iTunes.H.264.AAC-GROUP"))
self.assertEqual(Quality.FULLHDWEBDL, Quality.nameQuality("Test Show S01E02 1080p iTunes H 264 AAC-GROUP"))
self.assertEqual(Quality.FULLHDWEBDL, Quality.nameQuality("Test_Show_S01E02_1080p_iTunes_H_264_AAC-GROUP"))
示例4: test_HDWEBDL
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import nameQuality [as 别名]
def test_HDWEBDL(self):
self.assertEqual(Quality.HDWEBDL, Quality.nameQuality("Test.Show.S01E02.720p.WEB-DL-GROUP"))
self.assertEqual(Quality.HDWEBDL, Quality.nameQuality("Test.Show.S01E02.720p.WEBRip-GROUP"))
self.assertEqual(Quality.HDWEBDL,
Quality.nameQuality("Test.Show.S01E02.WEBRip.720p.H.264.AAC.2.0-GROUP"))
self.assertEqual(Quality.HDWEBDL,
Quality.nameQuality("Test.Show.S01E02.720p.WEB-DL.AAC2.0.H.264-GROUP"))
self.assertEqual(Quality.HDWEBDL,
Quality.nameQuality("Test Show S01E02 720p WEB-DL AAC2 0 H 264-GROUP"))
self.assertEqual(Quality.HDWEBDL,
Quality.nameQuality("Test_Show.S01E02_720p_WEB-DL_AAC2.0_H264-GROUP"))
self.assertEqual(Quality.HDWEBDL,
Quality.nameQuality("Test.Show.S01E02.720p.WEB-DL.AAC2.0.H264-GROUP"))
self.assertEqual(Quality.HDWEBDL,
Quality.nameQuality("Test.Show.S01E02.720p.iTunes.Rip.H264.AAC-GROUP"))
示例5: test_UNKNOWN
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import nameQuality [as 别名]
def test_UNKNOWN(self):
self.assertEqual(Quality.UNKNOWN, Quality.nameQuality("Test.Show.S01E02-SiCKBEARD"))
示例6: test_FULLHDBLURAY
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import nameQuality [as 别名]
def test_FULLHDBLURAY(self):
self.assertEqual(Quality.FULLHDBLURAY,
Quality.nameQuality("Test.Show.S01E02.1080p.BluRay.x264-GROUP"))
self.assertEqual(Quality.FULLHDBLURAY,
Quality.nameQuality("Test.Show.S01E02.1080p.HDDVD.x264-GROUP"))
示例7: parse
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import nameQuality [as 别名]
def parse(self, data, mode):
"""
Parse search results for items.
:param data: The raw response from a search
:param mode: The current mode used to search, e.g. RSS
:return: A list of items found
"""
results = []
hdtext = [' Versione 720p',
' V 720p',
' V 720',
' V HEVC',
' V HEVC',
' V 1080',
' Versione 1080p',
' 720p HEVC',
' Ver 720',
' 720p HEVC',
' 720p']
with bs4_parser(data) as html:
torrent_table = html.find(class_='showrelease_tb')
torrent_rows = torrent_table('tr') if torrent_table else []
# Continue only if at least one release is found
if len(torrent_rows) < 3:
sickrage.app.log.debug('Data returned from provider does not contain any torrents')
return results
# Skip column headers
for row in torrent_table('tr')[1:]:
cells = row('td')
if not cells:
continue
try:
title = unidecode(cells[6].text)
title = title.replace('·', '').replace(',', '')
title = title.replace('by', '-').strip()
title = title.strip('-').strip()
download_url = cells[1].find('a')['href']
if not all([title, download_url]):
continue
leechers = try_int(cells[3].text)
seeders = try_int(cells[4].text, 1)
filename_qt = self._reverse_quality(self._episode_quality(title))
for text in hdtext:
title1 = title
title = title.replace(text, filename_qt)
if title != title1:
break
if Quality.nameQuality(title) == Quality.UNKNOWN:
title += filename_qt
if self._has_only_subs(title) and not self.subtitle:
sickrage.app.log.debug('Torrent is only subtitled, skipping: {}'.format(title))
continue
if self.engrelease and not self._is_english(title):
sickrage.app.log.debug("Torrent isn't english audio/subtitled, skipping: {} ".format(title))
continue
size = -1
item = {
'title': title,
'link': download_url,
'size': size,
'seeders': seeders,
'leechers': leechers,
}
if mode != 'RSS':
sickrage.app.log.debug('Found result: {}'.format(title))
results.append(item)
except Exception:
sickrage.app.log.error('Failed parsing provider')
return results
示例8: _doSearch
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import nameQuality [as 别名]
def _doSearch(self, search_params, search_mode="eponly", epcount=0, age=0, epObj=None):
results = []
items = {"Season": [], "Episode": [], "RSS": []}
self.categories = "cat=" + str(self.cat)
if not self._doLogin():
return results
for mode in search_params.keys():
sickrage.LOGGER.debug("Search Mode: %s" % mode)
for search_string in search_params[mode]:
if mode is "RSS":
self.page = 2
last_page = 0
y = int(self.page)
if search_string == "":
continue
search_string = str(search_string).replace(".", " ")
for x in range(0, y):
z = x * 20
if last_page:
break
if mode is not "RSS":
searchURL = (self.urls["search_page"] + "&filter={2}").format(z, self.categories, search_string)
else:
searchURL = self.urls["search_page"].format(z, self.categories)
if mode is not "RSS":
sickrage.LOGGER.debug("Search string: %s " % search_string)
sickrage.LOGGER.debug("Search URL: %s" % searchURL)
data = self.getURL(searchURL)
if not data:
sickrage.LOGGER.debug("No data returned from provider")
continue
try:
with BS4Parser(data, markup_type="HTML", features=["html5lib", "permissive"]) as html:
torrent_table = html.find("table", attrs={"class": "copyright"})
torrent_rows = torrent_table.find_all("tr") if torrent_table else []
# Continue only if one Release is found
if len(torrent_rows) < 3:
sickrage.LOGGER.debug("Data returned from provider does not contain any torrents")
last_page = 1
continue
if len(torrent_rows) < 42:
last_page = 1
for result in torrent_table.find_all("tr")[2:]:
try:
link = result.find("td").find("a")
title = link.string
download_url = (
self.urls["download"] % result.find_all("td")[8].find("a")["href"][-8:]
)
leechers = result.find_all("td")[3].find_all("td")[1].text
leechers = int(leechers.strip("[]"))
seeders = result.find_all("td")[3].find_all("td")[2].text
seeders = int(seeders.strip("[]"))
# FIXME
size = -1
except (AttributeError, TypeError):
continue
filename_qt = self._reverseQuality(self._episodeQuality(result))
for text in self.hdtext:
title1 = title
title = title.replace(text, filename_qt)
if title != title1:
break
if Quality.nameQuality(title) == Quality.UNKNOWN:
title += filename_qt
if not self._is_italian(result) and not self.subtitle:
sickrage.LOGGER.debug("Torrent is subtitled, skipping: %s " % title)
continue
if self.engrelease and not self._is_english(result):
sickrage.LOGGER.debug(
"Torrent isnt english audio/subtitled , skipping: %s " % title
)
continue
search_show = re.split(r"([Ss][\d{1,2}]+)", search_string)[0]
show_title = search_show
rindex = re.search(r"([Ss][\d{1,2}]+)", title)
if rindex:
show_title = title[: rindex.start()]
#.........这里部分代码省略.........
示例9: test_UNKNOWN
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import nameQuality [as 别名]
def test_UNKNOWN(self):
from sickrage.core.common import Quality
self.assertEqual(Quality.UNKNOWN, Quality.nameQuality("Test.Show.S01E02-SICKRAGE"))
示例10: test_HDTV
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import nameQuality [as 别名]
def test_HDTV(self):
self.assertEqual(Quality.HDTV, Quality.nameQuality("Test.Show.S01E02.720p.HDTV.x264-GROUP"))
self.assertEqual(Quality.HDTV, Quality.nameQuality("Test.Show.S01E02.HR.WS.PDTV.x264-GROUP"))
示例11: _getProperList
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import nameQuality [as 别名]
#.........这里部分代码省略.........
if name not in propers:
sickrage.app.log.debug("Found new proper: " + x.name)
x.provider = providerObj
propers[name] = x
threading.currentThread().setName(origThreadName)
# take the list of unique propers and get it sorted by
sortedPropers = sorted(propers.values(), key=operator.attrgetter('date'), reverse=True)
finalPropers = []
for curProper in sortedPropers:
try:
myParser = NameParser(False)
parse_result = myParser.parse(curProper.name)
except InvalidNameException:
sickrage.app.log.debug(
"Unable to parse the filename " + curProper.name + " into a valid episode")
continue
except InvalidShowException:
sickrage.app.log.debug("Unable to parse the filename " + curProper.name + " into a valid show")
continue
if not parse_result.series_name:
continue
if not parse_result.episode_numbers:
sickrage.app.log.debug(
"Ignoring " + curProper.name + " because it's for a full season rather than specific episode")
continue
sickrage.app.log.debug(
"Successful match! Result " + parse_result.original_name + " matched to show " + parse_result.show.name)
# set the indexerid in the db to the show's indexerid
curProper.indexerid = parse_result.indexerid
# set the indexer in the db to the show's indexer
curProper.indexer = parse_result.show.indexer
# populate our Proper instance
curProper.show = parse_result.show
curProper.season = parse_result.season_number if parse_result.season_number is not None else 1
curProper.episode = parse_result.episode_numbers[0]
curProper.release_group = parse_result.release_group
curProper.version = parse_result.version
curProper.quality = Quality.nameQuality(curProper.name, parse_result.is_anime)
curProper.content = None
# filter release
bestResult = pickBestResult(curProper, parse_result.show)
if not bestResult:
sickrage.app.log.debug("Proper " + curProper.name + " were rejected by our release filters.")
continue
# only get anime proper if it has release group and version
if bestResult.show.is_anime:
if not bestResult.release_group and bestResult.version == -1:
sickrage.app.log.debug(
"Proper " + bestResult.name + " doesn't have a release group and version, ignoring it")
continue
# check if we actually want this proper (if it's the right quality)
dbData = [x for x in sickrage.app.main_db().get_many('tv_episodes', bestResult.indexerid)
if x['season'] == bestResult.season and x['episode'] == bestResult.episode]
if not dbData:
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(dbData[0]["status"]))
if oldStatus not in (DOWNLOADED, SNATCHED) or oldQuality != bestResult.quality:
continue
# check if we actually want this proper (if it's the right release group and a higher version)
if bestResult.show.is_anime:
dbData = [x for x in sickrage.app.main_db.get_many('tv_episodes', bestResult.indexerid)
if x['season'] == bestResult.season and x['episode'] == bestResult.episode]
oldVersion = int(dbData[0]["version"])
oldRelease_group = (dbData[0]["release_group"])
if -1 < oldVersion < bestResult.version:
sickrage.app.log.info(
"Found new anime v" + str(bestResult.version) + " to replace existing v" + str(oldVersion))
else:
continue
if oldRelease_group != bestResult.release_group:
sickrage.app.log.info(
"Skipping proper from release group: " + bestResult.release_group + ", does not match existing release group: " + oldRelease_group)
continue
# if the show is in our list and there hasn't been a proper already added for that particular episode then add it to our list of propers
if bestResult.indexerid != -1 and (bestResult.indexerid, bestResult.season, bestResult.episode) not in map(
operator.attrgetter('indexerid', 'season', 'episode'), finalPropers):
sickrage.app.log.info("Found a proper that we need: " + str(bestResult.name))
finalPropers.append(bestResult)
return finalPropers
示例12: test_FULLHDTV
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import nameQuality [as 别名]
def test_FULLHDTV(self):
from sickrage.core.common import Quality
self.assertEqual(Quality.FULLHDTV, Quality.nameQuality("Test.Show.S01E02.1080p.HDTV.x264-GROUP"))
示例13: test_HDTV
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import nameQuality [as 别名]
def test_HDTV(self):
from sickrage.core.common import Quality
self.assertEqual(Quality.HDTV, Quality.nameQuality("Test.Show.S01E02.720p.HDTV.x264-GROUP"))
self.assertEqual(Quality.HDTV, Quality.nameQuality("Test.Show.S01E02.HR.WS.PDTV.x264-GROUP"))
示例14: test_SDDVD
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import nameQuality [as 别名]
def test_SDDVD(self):
from sickrage.core.common import Quality
self.assertEqual(Quality.SDDVD, Quality.nameQuality("Test.Show.S01E02.DVDRiP.XViD-GROUP"))
self.assertEqual(Quality.SDDVD, Quality.nameQuality("Test.Show.S01E02.DVDRiP.DiVX-GROUP"))
self.assertEqual(Quality.SDDVD, Quality.nameQuality("Test.Show.S01E02.DVDRiP.x264-GROUP"))
self.assertEqual(Quality.SDDVD, Quality.nameQuality("Test.Show.S01E02.DVDRip.WS.XViD-GROUP"))
self.assertEqual(Quality.SDDVD, Quality.nameQuality("Test.Show.S01E02.DVDRip.WS.DiVX-GROUP"))
self.assertEqual(Quality.SDDVD, Quality.nameQuality("Test.Show.S01E02.DVDRip.WS.x264-GROUP"))
self.assertEqual(Quality.SDDVD, Quality.nameQuality("Test.Show.S01E02.BDRIP.XViD-GROUP"))
self.assertEqual(Quality.SDDVD, Quality.nameQuality("Test.Show.S01E02.BDRIP.DiVX-GROUP"))
self.assertEqual(Quality.SDDVD, Quality.nameQuality("Test.Show.S01E02.BDRIP.x264-GROUP"))
self.assertEqual(Quality.SDDVD, Quality.nameQuality("Test.Show.S01E02.BDRIP.WS.XViD-GROUP"))
self.assertEqual(Quality.SDDVD, Quality.nameQuality("Test.Show.S01E02.BDRIP.WS.DiVX-GROUP"))
self.assertEqual(Quality.SDDVD, Quality.nameQuality("Test.Show.S01E02.BDRIP.WS.x264-GROUP"))
示例15: test_SDTV
# 需要导入模块: from sickrage.core.common import Quality [as 别名]
# 或者: from sickrage.core.common.Quality import nameQuality [as 别名]
def test_SDTV(self):
self.assertEqual(Quality.SDTV, Quality.nameQuality("Test.Show.S01E02.PDTV.XViD-GROUP"))
self.assertEqual(Quality.SDTV, Quality.nameQuality("Test.Show.S01E02.PDTV.x264-GROUP"))
self.assertEqual(Quality.SDTV, Quality.nameQuality("Test.Show.S01E02.HDTV.XViD-GROUP"))
self.assertEqual(Quality.SDTV, Quality.nameQuality("Test.Show.S01E02.HDTV.x264-GROUP"))
self.assertEqual(Quality.SDTV, Quality.nameQuality("Test.Show.S01E02.DSR.XViD-GROUP"))
self.assertEqual(Quality.SDTV, Quality.nameQuality("Test.Show.S01E02.DSR.x264-GROUP"))
self.assertEqual(Quality.SDTV, Quality.nameQuality("Test.Show.S01E02.TVRip.XViD-GROUP"))
self.assertEqual(Quality.SDTV, Quality.nameQuality("Test.Show.S01E02.TVRip.x264-GROUP"))
self.assertEqual(Quality.SDTV, Quality.nameQuality("Test.Show.S01E02.WEBRip.XViD-GROUP"))
self.assertEqual(Quality.SDTV, Quality.nameQuality("Test.Show.S01E02.WEBRip.x264-GROUP"))
self.assertEqual(Quality.SDTV, Quality.nameQuality("Test.Show.S01E02.WEB-DL.x264-GROUP"))
self.assertEqual(Quality.SDTV, Quality.nameQuality("Test.Show.S01E02.WEB-DL.AAC2.0.H.264-GROUP"))
self.assertEqual(Quality.SDTV, Quality.nameQuality("Test.Show.S01E02 WEB-DL H 264-GROUP"))
self.assertEqual(Quality.SDTV, Quality.nameQuality("Test.Show.S01E02_WEB-DL_H_264-GROUP"))
self.assertEqual(Quality.SDTV, Quality.nameQuality("Test.Show.S01E02.WEB-DL.AAC2.0.H264-GROUP"))