mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-05 17:43:37 +00:00
Change improve usage of the optional regex library.
Limit possible regex errors to 20% of extra_info up to max 3 errors.
This commit is contained in:
parent
ad63608cad
commit
f1958535d2
4 changed files with 18 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
### 0.13.6 (2017-12-13 01:50:00 UTC)
|
||||
|
||||
* Change improve multi episode release search
|
||||
* Change improve usage of the optional regex library
|
||||
|
||||
|
||||
### 0.13.5 (2017-12-11 21:45:00 UTC)
|
||||
|
|
|
@ -58,8 +58,12 @@
|
|||
</div>
|
||||
<div id="content_download_propers">
|
||||
<span class="component-desc">
|
||||
#if $getVar('using_regex', False)
|
||||
<p>Optional <a href="https://pypi.python.org/pypi/regex" target="_blank">regex python library</a> is being used</p>
|
||||
#else
|
||||
<p>Optional: to improve matching, install the OS dependent <a href="https://pypi.python.org/pypi/regex" target="_blank">regex python library</a></p>
|
||||
<p>at a command line, simply enter ... <code>python -m pip install regex</code></p>
|
||||
#end if
|
||||
</span>
|
||||
<div class="field-pair">
|
||||
<label>
|
||||
|
|
|
@ -656,8 +656,13 @@ class ParseResult(object):
|
|||
if None is regex:
|
||||
return re.sub(ep_regex, '', e_i_n_n, flags=re.I)
|
||||
|
||||
return regex.sub(r'(%s){e<=%d}' % (
|
||||
ep_regex, trunc(len(re.findall(r'\w', ep_regex)) / 5)), '', e_i_n_n, flags=regex.I | regex.B)
|
||||
er = trunc(len(re.findall(r'\w', ep_regex)) / 5)
|
||||
try:
|
||||
me = trunc(len(e_i_n_n) / 5)
|
||||
me = min(3, me)
|
||||
except (StandardError, Exception):
|
||||
me = 3
|
||||
return regex.sub(r'(%s){e<=%d}' % (ep_regex, (er, me)[er > me]), '', e_i_n_n, flags=regex.I | regex.B)
|
||||
|
||||
def get_extra_info_no_name(self):
|
||||
extra_info_no_name = self.extra_info
|
||||
|
|
|
@ -4976,6 +4976,12 @@ class ConfigSearch(Config):
|
|||
show.rls_require_words.strip()]
|
||||
t.using_rls_require_words.sort(lambda x, y: cmp(x[1], y[1]), reverse=False)
|
||||
t.propers_intervals = search_propers.ProperSearcher().search_intervals
|
||||
t.using_regex = False
|
||||
try:
|
||||
from sickbeard.name_parser.parser import regex
|
||||
t.using_regex = None is not regex
|
||||
except (StandardError, Exception):
|
||||
pass
|
||||
return t.respond()
|
||||
|
||||
def saveSearch(self, use_nzbs=None, use_torrents=None, nzb_dir=None, sab_username=None, sab_password=None,
|
||||
|
|
Loading…
Reference in a new issue