1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-11-17 23:05:11 -05:00

Merge remote-tracking branch 'origin/dev'

This commit is contained in:
echel0n 2014-07-06 15:39:18 -07:00
commit 5b0d9c7ec1
5 changed files with 49 additions and 54 deletions

View File

@ -189,8 +189,25 @@
<i>Replace with:</i> <b><%=", ".join([Quality.qualityStrings[x] for x in sorted(bestQualities)])%></b>
#end if
#end if
<tr><td class="showLegend">Scene Name:</td><td>#if $show.exceptions then $exceptions_string else $show.name#</td></tr>
#if $show.rls_require_words:
<tr><td class="showLegend">Required Words: </td><td>#echo $show.rls_require_words#</td></tr>
#end if
#if $show.rls_ignore_words:
<tr><td class="showLegend">Ignored Words: </td><td>#echo $show.rls_ignore_words#</td></tr>
#end if
#if $bwl.get_white_keywords_for("release_group"):
<tr>
<td class="showLegend">Wanted Group#if len($bwl.get_white_keywords_for("release_group"))>1 then "s" else ""#:</td>
<td>#echo ', '.join($bwl.get_white_keywords_for("release_group"))#</td>
</tr>
#end if
#if $bwl.get_black_keywords_for("release_group"):
<tr>
<td class="showLegend">Unwanted Group#if len($bwl.get_black_keywords_for("release_group"))>1 then "s" else ""#:</td>
<td>#echo ', '.join($bwl.get_black_keywords_for("release_group"))#</td>
</tr>
#end if
</td></tr>
</table>
<td style="float: right;">
@ -209,25 +226,6 @@
#if $anyQualities + $bestQualities
<tr><td class="showLegend">Archive First Match: </td><td><img src="$sbRoot/images/#if int($show.archive_firstmatch) == 1 then "yes16.png\" alt=\"Y" else "no16.png\" alt=\"N"#" width="16" height="16" /></td></tr>
#end if
#if $bwl.get_white_keywords_for("gloabl"):
<tr><td class="showLegend">Whitelist: </td><td>#echo ', '.join($bwl.get_white_keywords_for("gloabl"))#</td></tr>
#end if
#if $bwl.get_black_keywords_for("gloabl"):
<tr><td class="showLegend">Blacklist: </td><td>#echo ', '.join($bwl.get_black_keywords_for("gloabl"))#</td></tr>
#end if
#if $bwl.get_white_keywords_for("release_group"):
<tr>
<td class="showLegend">Wanted Group#if len($bwl.get_white_keywords_for("release_group"))>1 then "s" else ""#:</td>
<td>#echo ', '.join($bwl.get_white_keywords_for("release_group"))#</td>
</tr>
#end if
#if $bwl.get_black_keywords_for("release_group"):
<tr>
<td class="showLegend">Unwanted Group#if len($bwl.get_black_keywords_for("release_group"))>1 then "s" else ""#:</td>
<td>#echo ', '.join($bwl.get_black_keywords_for("release_group"))#</td>
</tr>
#end if
</table>
</td>
</tr>

View File

@ -119,16 +119,8 @@
</td>
<td align="center">
#if $curStatus == DOWNLOADED:
#set $match = $re.search("\-(\w+)\.\w{3}\Z", $os.path.basename($hItem["resource"]))
#if $match
#if $match.group(1).upper() in ("X264", "720P"):
#set $match = $re.search("(\w+)\-.*\-"+$match.group(1)+"\.\w{3}\Z", $os.path.basename($hItem["resource"]), re.IGNORECASE)
#if $match
<i>$match.group(1).upper()</i>
#end if
#else:
<i>$match.group(1).upper()</i>
#end if
#if $hItem["provider"] != "-1":
<i>$hItem["provider"]</i>
#end if
#else
#if $hItem["provider"] > 0

View File

@ -109,29 +109,32 @@ class NameParser(object):
logger.log(u"WARNING: Invalid show series name pattern, %s: [%s]" % (errormsg, pattern))
else:
# attempt matching with main show name pattern
seriesname_match = show_regex.match(name)
if seriesname_match:
seriesname_groups = seriesname_match.groupdict().keys()
if 'series_name' in seriesname_groups:
series_name = self.clean_series_name(seriesname_match.group('series_name'))
showname_match = show_regex.match(name)
if showname_match:
showname_groups = showname_match.groupdict().keys()
if 'show_name' in showname_groups:
series_name = self.clean_series_name(showname_match.group('show_name'))
return helpers.get_show_by_name(series_name, useIndexer=self.useIndexers)
def _parse_string(self, name):
if not name:
return
self.showObj = None
if not self.naming_pattern:
if not self.showObj and not self.naming_pattern:
# Regex pattern to return the Show / Series Name regardless of the file pattern tossed at it, matched 53 show name examples from regexes.py
show_pattern = '''(?:(?:\[.*?\])|(?:\d{3}[\.-]))*[ _\.]?(?P<series_name>.*?(?:[ ._-]((?!\d{4}\W\d\d\W\d\d\W)\d{4}))?)(?:(?:(?:[ ._-]+\d+)|(?:[ ._-]+s\d{2}))|(?:\W+(?:(?:S\d[\dE._ -])|(?:\d\d?x)|(?:\d{4}\W\d\d\W\d\d)|(?:(?:part|pt)[\._ -]?(?:\d|[ivx]))|Season\W+\d+\W+|E\d+\W+|(?:\d{1,3}.+\d{1,}[a-zA-Z]{2}\W+[a-zA-Z]{3,}\W+\d{4}.+))))'''
show_pattern_alt = '''^(?P<series_name>.*?(?:[ ._-]((?!\d{4}\W\d\d\W\d\d\W)\d{4}))?)(?:(?:(?:[ ._-]+\d+)|(?:[ ._-]+s\d{2}))|(?:\W+(?:(?:S\d[\dE._ -])|(?:\d\d?x)|(?:\d{4}\W\d\d\W\d\d)|(?:(?:part|pt)[\._ -]?(?:\d|[ivx]))|Season\W+\d+\W+|E\d+\W+|(?:\d{1,3}.+\d{1,}[a-zA-Z]{2}\W+[a-zA-Z]{3,}\W+\d{4}.+))))'''
show_patterns = [
'''^(?P<show_name>.*?)\W+(?:(?:S\d[\dE._ -])|(?:\d\d?x)|(?:\d{4}\W\d\d\W\d\d)|(?:(?:part|pt)[\._ -]?(\d|[ivx]))|Season\W+\d+\W+|E\d+\W+|(?:\d{1,3}.+\d{1,}[a-zA-Z]{2}\W+[a-zA-Z]{3,}\W+\d{4}.+))''',
'''^((\[.*?\])|(\d+[\.-]))*[ _\.]*(?P<show_name>.*?)(([ ._-]+\d+)|([ ._-]+s\d{2})).*'''
]
self.showObj = self._matchShowName(name, show_pattern)
if not self.showObj:
self.showObj = self._matchShowName(name, show_pattern_alt)
if not self.showObj:
raise InvalidShowException("Unable to parse " + name.encode(sickbeard.SYS_ENCODING, 'xmlcharrefreplace'))
# find show object
for pattern in show_patterns:
self.showObj = self._matchShowName(name, pattern)
if self.showObj:
break
else:
raise InvalidShowException(
"Unable to parse " + name.encode(sickbeard.SYS_ENCODING, 'xmlcharrefreplace'))
regexMode = self.ALL_REGEX
if self.showObj and self.showObj.is_anime:

View File

@ -480,12 +480,11 @@ class PostProcessor(object):
return to_return
# parse the name to break it into show name, season, and episode
try:
np = NameParser(file, useIndexers=True, convert=True)
parse_result = np.parse(name)
except InvalidShowException:
logger.log(u"Unable to parse the filename " + name + " into a valid show", logger.WARNING)
return to_return
np = NameParser(file, useIndexers=True, convert=True)
parse_result = np.parse(name)
# show object
show = parse_result.show
if parse_result.air_by_date:
season = -1
@ -497,7 +496,7 @@ class PostProcessor(object):
season = parse_result.season_number
episodes = parse_result.episode_numbers
to_return = (parse_result.show, season, episodes, parse_result.quality)
to_return = (show, season, episodes, parse_result.quality)
self._finalize(parse_result)
return to_return
@ -603,7 +602,7 @@ class PostProcessor(object):
try:
(cur_show, cur_season, cur_episodes, cur_quality) = cur_attempt()
except InvalidNameException, e:
except (InvalidNameException, InvalidShowException), e:
logger.log(u"Unable to parse, skipping: " + ex(e), logger.DEBUG)
continue

View File

@ -618,11 +618,14 @@ class TVShow(object):
logger.log(str(self.indexerid) + u": Creating episode object from " + file, logger.DEBUG)
try:
myParser = NameParser(showObj=self, useIndexers=True)
myParser = NameParser(True, showObj=self, useIndexers=True)
parse_result = myParser.parse(file)
except InvalidNameException:
logger.log(u"Unable to parse the filename " + file + " into a valid episode", logger.ERROR)
return None
except InvalidShowException:
logger.log(u"Unable to parse the filename " + file + " into a valid show", logger.WARNING)
return None
if not len(parse_result.episode_numbers) and not (parse_result.air_by_date or parse_result.sports):
logger.log("parse_result: " + str(parse_result))