Merge pull request #943 from JackDandy/feature/ChangeProperSearch

Change improve search for PROPERS.
This commit is contained in:
JackDandy 2017-06-15 01:31:33 +01:00 committed by GitHub
commit d2b19c2975
2 changed files with 9 additions and 9 deletions

View file

@ -58,6 +58,7 @@
* Change simplify dropdowns at all Add show/Cards * Change simplify dropdowns at all Add show/Cards
* Change cosmetic title on shutdown * Change cosmetic title on shutdown
* Change use TVDb API v2 * Change use TVDb API v2
* Change improve search for PROPERS
[develop changelog] [develop changelog]

View file

@ -18,19 +18,16 @@
import datetime import datetime
import operator import operator
import os
import threading import threading
import traceback import traceback
import sickbeard import sickbeard
from sickbeard import db from sickbeard import db, exceptions, helpers, history, logger, search, show_name_helpers
from sickbeard import exceptions from sickbeard import encodingKludge as ek
from sickbeard.exceptions import ex
from sickbeard import helpers, logger, show_name_helpers
from sickbeard import search
from sickbeard import history
from sickbeard.common import DOWNLOADED, SNATCHED, SNATCHED_PROPER, Quality, ARCHIVED, SNATCHED_BEST from sickbeard.common import DOWNLOADED, SNATCHED, SNATCHED_PROPER, Quality, ARCHIVED, SNATCHED_BEST
from sickbeard.exceptions import ex
from name_parser.parser import NameParser, InvalidNameException, InvalidShowException from name_parser.parser import NameParser, InvalidNameException, InvalidShowException
@ -224,7 +221,8 @@ def _download_propers(proper_list):
history_results = my_db.select( history_results = my_db.select(
'SELECT resource FROM history ' + 'SELECT resource FROM history ' +
'WHERE showid = ? AND season = ? AND episode = ? AND quality = ? AND date >= ? ' + 'WHERE showid = ? AND season = ? AND episode = ? AND quality = ? AND date >= ? ' +
'AND action IN (' + ','.join([str(x) for x in Quality.SNATCHED]) + ')', 'AND (' + ' OR '.join("action LIKE '%%%02d'" % x for x in (SNATCHED, DOWNLOADED, SNATCHED_PROPER,
SNATCHED_BEST, ARCHIVED)) + ')',
[cur_proper.indexerid, cur_proper.season, cur_proper.episode, cur_proper.quality, [cur_proper.indexerid, cur_proper.season, cur_proper.episode, cur_proper.quality,
history_limit.strftime(history.dateFormat)]) history_limit.strftime(history.dateFormat)])
@ -247,7 +245,8 @@ def _download_propers(proper_list):
is_same = False is_same = False
for result in history_results: for result in history_results:
# if the result exists in history already we need to skip it # if the result exists in history already we need to skip it
if clean_proper_name == _generic_name(helpers.remove_non_release_groups(result['resource'])): if clean_proper_name == _generic_name(helpers.remove_non_release_groups(
ek.ek(os.path.basename, result['resource']))):
is_same = True is_same = True
break break
if is_same: if is_same: