Merge pull request #773 from JackDandy/feature/FixSearch

Fix only replace initial quality releases from the upgrade to list.
This commit is contained in:
JackDandy 2016-09-22 13:26:36 +01:00 committed by GitHub
commit beeff7ab89
4 changed files with 17 additions and 15 deletions

View file

@ -157,6 +157,7 @@
* Change improve config/providers newznab categories layout * Change improve config/providers newznab categories layout
* Change show loaded log message at start up and include info source * Change show loaded log message at start up and include info source
* Change if episode has no airdate then set status to unaired (was skipped) * Change if episode has no airdate then set status to unaired (was skipped)
* Fix only replace initial quality releases from the upgrade to list
[develop changelog] [develop changelog]
* Change send nzb data to NZBGet for Anizb instead of url * Change send nzb data to NZBGet for Anizb instead of url

View file

@ -951,7 +951,7 @@ def validateShow(show, season=None, episode=None):
return t return t
return t[show.indexerid][season][episode] return t[show.indexerid][season][episode]
except (sickbeard.indexer_episodenotfound, sickbeard.indexer_seasonnotfound): except (sickbeard.indexer_episodenotfound, sickbeard.indexer_seasonnotfound, TypeError):
pass pass

View file

@ -186,6 +186,7 @@ class GenericProvider:
urls = ['http%s://%s/torrent/%s.torrent' % (u + (torrent_hash,)) urls = ['http%s://%s/torrent/%s.torrent' % (u + (torrent_hash,))
for u in (('s', 'itorrents.org'), ('s', 'torra.pro'), ('s', 'torra.click'), for u in (('s', 'itorrents.org'), ('s', 'torra.pro'), ('s', 'torra.click'),
('s', 'torrage.info'), ('', 'reflektor.karmorra.info'),
('s', 'torrentproject.se'), ('', 'thetorrent.org'))] ('s', 'torrentproject.se'), ('', 'thetorrent.org'))]
except (StandardError, Exception): except (StandardError, Exception):
link_type = 'torrent' link_type = 'torrent'

View file

@ -303,8 +303,8 @@ def is_first_best_match(result):
def wanted_episodes(show, from_date, make_dict=False, unaired=False): def wanted_episodes(show, from_date, make_dict=False, unaired=False):
initial_qualities, archive_qualities = common.Quality.splitQuality(show.quality) initial_qualities, upgrade_qualities = common.Quality.splitQuality(show.quality)
all_qualities = list(set(initial_qualities + archive_qualities)) all_qualities = list(set(initial_qualities + upgrade_qualities))
my_db = db.DBConnection() my_db = db.DBConnection()
@ -350,19 +350,20 @@ def wanted_episodes(show, from_date, make_dict=False, unaired=False):
not_downloaded = True not_downloaded = True
cur_composite_status = int(result['status']) cur_composite_status = int(result['status'])
cur_status, cur_quality = common.Quality.splitCompositeStatus(cur_composite_status) cur_status, cur_quality = common.Quality.splitCompositeStatus(cur_composite_status)
cur_snatched = cur_status in downloaded_status_list
if show.archive_firstmatch and cur_status in downloaded_status_list and cur_quality in archive_qualities: if show.archive_firstmatch and cur_snatched and cur_quality in upgrade_qualities:
continue continue
# special case: already downloaded quality is not in any of the wanted Qualities # special case: already downloaded quality is not in any of the upgrade to Qualities
other_quality_downloaded = False other_quality_downloaded = False
if cur_status in downloaded_status_list and cur_quality not in all_qualities: if len(upgrade_qualities) and cur_snatched and cur_quality not in all_qualities:
other_quality_downloaded = True other_quality_downloaded = True
wanted_qualities = all_qualities wanted_qualities = all_qualities
else: else:
wanted_qualities = archive_qualities wanted_qualities = upgrade_qualities
if archive_qualities: if upgrade_qualities:
highest_wanted_quality = max(wanted_qualities) highest_wanted_quality = max(wanted_qualities)
else: else:
if other_quality_downloaded: if other_quality_downloaded:
@ -371,11 +372,10 @@ def wanted_episodes(show, from_date, make_dict=False, unaired=False):
highest_wanted_quality = 0 highest_wanted_quality = 0
# if we need a better one then say yes # if we need a better one then say yes
if (cur_status in downloaded_status_list and cur_quality < highest_wanted_quality) or \ if (cur_snatched and cur_quality < highest_wanted_quality) \
cur_status in status_list or \ or cur_status in status_list \
(sickbeard.SEARCH_UNAIRED and 1 == result['airdate'] and cur_status in (common.SKIPPED, common.IGNORED, or (sickbeard.SEARCH_UNAIRED and 1 == result['airdate']
common.UNAIRED, common.UNKNOWN, and cur_status in (common.SKIPPED, common.IGNORED, common.UNAIRED, common.UNKNOWN, common.FAILED)):
common.FAILED)):
if cur_status in (common.WANTED, common.FAILED): if cur_status in (common.WANTED, common.FAILED):
total_wanted += 1 total_wanted += 1
@ -386,8 +386,8 @@ def wanted_episodes(show, from_date, make_dict=False, unaired=False):
not_downloaded = False not_downloaded = False
ep_obj = show.getEpisode(int(result['season']), int(result['episode'])) ep_obj = show.getEpisode(int(result['season']), int(result['episode']))
ep_obj.wantedQuality = [i for i in (initial_qualities if not_downloaded else ep_obj.wantedQuality = [i for i in (wanted_qualities, initial_qualities)[not_downloaded]
wanted_qualities) if (i > cur_quality and i != common.Quality.UNKNOWN)] if (common.Quality.UNKNOWN != i and cur_quality < i)]
ep_obj.eps_aired_in_season = ep_count.get(helpers.tryInt(result['season']), 0) ep_obj.eps_aired_in_season = ep_count.get(helpers.tryInt(result['season']), 0)
ep_obj.eps_aired_in_scene_season = ep_count_scene.get( ep_obj.eps_aired_in_scene_season = ep_count_scene.get(
helpers.tryInt(result['scene_season']), 0) if result['scene_season'] else None helpers.tryInt(result['scene_season']), 0) if result['scene_season'] else None