Change improve search for PROPERS.

Include snatch_proper, snatch_best, downloaded, archived in check for already downloaded propers.
Remove path from compared result.
This commit is contained in:
Prinz23 2017-05-28 23:32:02 +01:00 committed by JackDandy
parent 0cf9cd5052
commit 0331d5ee6f
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: