Browse Source

Fix search result priority for nzbget.

Change move priority property to SearchResult base class.
Add new test for wanted whole first season (add show).
Add some tests for no episodes shows (wanted ep - add show).
Change SickGear-NG version.
pull/1289/head
Prinz23 5 years ago
committed by JackDandy
parent
commit
879d5342bc
  1. 6
      CHANGES.md
  2. 2
      autoProcessTV/SickGear-NG/SickGear-NG.py
  3. 4
      sickbeard/classes.py
  4. 2
      sickbeard/nzbget.py
  5. 3
      sickbeard/search.py
  6. 78
      tests/show_tests.py

6
CHANGES.md

@ -95,7 +95,7 @@
* Add next run time to Manage/Show Tasks/Daily show update * Add next run time to Manage/Show Tasks/Daily show update
* Change when fetching imdb data, if imdb id is an episode id then try to find and use real show id * Change when fetching imdb data, if imdb id is an episode id then try to find and use real show id
* Change delete diskcache db in imdbpie when value error (due to change in Python version) * Change delete diskcache db in imdbpie when value error (due to change in Python version)
* Change during startup, cleanup any _cleaner.pyc/o to prevent issues when switching python versions * Change during startup, cleanup any cleaner.pyc/o to prevent issues when switching python versions
* Add .pyc cleaner if python version is switched * Add .pyc cleaner if python version is switched
* Change rebrand "SickGear PostProcessing script" to "SickGear Process Media extension" * Change rebrand "SickGear PostProcessing script" to "SickGear Process Media extension"
* Change improve setup guide to use the NZBGet version to minimise displayed text based on version * Change improve setup guide to use the NZBGet version to minimise displayed text based on version
@ -105,6 +105,10 @@
* Change supported Python version 2.7.9-2.7.18 inclusive expanded to 3.7.1-3.8.1 inclusive * Change supported Python version 2.7.9-2.7.18 inclusive expanded to 3.7.1-3.8.1 inclusive
* Change pidfile creation under Linux 0o644 * Change pidfile creation under Linux 0o644
* Fix long path issues with Windows process media * Fix long path issues with Windows process media
* Fix search result priority for nzbget
* Change move priority property to SearchResult base class
* Add new test for wanted whole first season (add show)
* Change SickGear-NG version
[develop changelog] [develop changelog]

2
autoProcessTV/SickGear-NG/SickGear-NG.py

@ -51,7 +51,7 @@
# Send "Process Media" requests to SickGear # Send "Process Media" requests to SickGear
# #
# Process Media extension version: 2.4. # Process Media extension version: 2.5.
# <!-- # <!--
# For more info and updates please visit forum topic at # For more info and updates please visit forum topic at
# --> # -->

4
sickbeard/classes.py

@ -95,6 +95,10 @@ class SearchResult(LegacySearchResult):
# path to cache file # path to cache file
self.cache_filepath = '' # type: AnyStr self.cache_filepath = '' # type: AnyStr
# priority of result
# -1 = low, 0 = normal, 1 = high
self.priority = 0 # type: int
@property @property
def show_obj(self): def show_obj(self):
# type: (...) -> Optional[sickbeard.tv.TVShow] # type: (...) -> Optional[sickbeard.tv.TVShow]

2
sickbeard/nzbget.py

@ -93,7 +93,7 @@ def send_nzb(search_result):
sickbeard.TVInfoAPI(cur_ep_obj.show_obj.tvid).config.get('dupekey', ''), cur_ep_obj.show_obj.prodid) sickbeard.TVInfoAPI(cur_ep_obj.show_obj.tvid).config.get('dupekey', ''), cur_ep_obj.show_obj.prodid)
dupekey += '-%s.%s' % (cur_ep_obj.season, cur_ep_obj.episode) dupekey += '-%s.%s' % (cur_ep_obj.season, cur_ep_obj.episode)
if 1 == nzb.priority: if 1 == search_result.priority:
add_to_top = True add_to_top = True
nzbget_prio = sickbeard.NZBGET_PRIORITY nzbget_prio = sickbeard.NZBGET_PRIORITY

3
sickbeard/search.py

@ -109,12 +109,11 @@ def snatch_episode(result, end_status=SNATCHED):
if None is result: if None is result:
return False return False
result.priority = 0 # -1 = low, 0 = normal, 1 = high
if sickbeard.ALLOW_HIGH_PRIORITY: if sickbeard.ALLOW_HIGH_PRIORITY:
# if it aired recently make it high priority # if it aired recently make it high priority
for cur_ep_obj in result.ep_obj_list: for cur_ep_obj in result.ep_obj_list:
if datetime.date.today() - cur_ep_obj.airdate <= datetime.timedelta(days=7) or \ if datetime.date.today() - cur_ep_obj.airdate <= datetime.timedelta(days=7) or \
datetime.date.fromordinal(1) >= cur_ep_obj.airdate: datetime.date.fromordinal(1) >= cur_ep_obj.airdate:
result.priority = 1 result.priority = 1
if 0 < result.properlevel: if 0 < result.properlevel:
end_status = SNATCHED_PROPER end_status = SNATCHED_PROPER

78
tests/show_tests.py

@ -96,6 +96,39 @@ wanted_tests = [
), ),
dict( dict(
name='Start, entire season',
show=dict(indexer=1, indexerid=210, quality=Quality.combineQualities([Quality.SDTV], [])),
episodes=[
dict(season=1, episode=1, status=SKIPPED, quality=Quality.NONE, airdate=datetime.date(2019, 1, 2)),
dict(season=1, episode=2, status=SKIPPED, quality=Quality.NONE, airdate=datetime.date(2019, 1, 1)),
dict(season=1, episode=3, status=SKIPPED, quality=Quality.NONE, airdate=datetime.date(2019, 1, 1)),
dict(season=1, episode=4, status=SKIPPED, quality=Quality.NONE, airdate=datetime.date(2019, 1, 1)),
dict(season=1, episode=5, status=UNAIRED, quality=Quality.NONE, airdate=datetime.date.fromordinal(1)),
dict(season=2, episode=1, status=UNAIRED, quality=Quality.NONE, airdate=datetime.date.fromordinal(1)),
dict(season=2, episode=2, status=UNAIRED, quality=Quality.NONE, airdate=datetime.date.fromordinal(1)),
dict(season=2, episode=3, status=UNAIRED, quality=Quality.NONE, airdate=datetime.date.fromordinal(1)),
dict(season=2, episode=4, status=UNAIRED, quality=Quality.NONE, airdate=datetime.date.fromordinal(1)),
dict(season=3, episode=1, status=UNAIRED, quality=Quality.NONE, airdate=datetime.date.fromordinal(1)),
dict(season=3, episode=2, status=UNAIRED, quality=Quality.NONE, airdate=datetime.date.fromordinal(1)),
dict(season=3, episode=3, status=UNAIRED, quality=Quality.NONE, airdate=datetime.date.fromordinal(1)),
],
start_wanted=-1, end_wanted=0,
result=dict(
start=dict(
count=4, episodes={
1: {1: WANTED, 2: WANTED, 3: WANTED, 4: WANTED, 5: UNAIRED},
2: {1: UNAIRED, 2: UNAIRED, 3: UNAIRED, 4: UNAIRED},
3: {1: UNAIRED, 2: UNAIRED, 3: UNAIRED}
}),
end=dict(
count=0, episodes={
1: {1: WANTED, 2: WANTED, 3: WANTED, 4: WANTED, 5: UNAIRED},
2: {1: UNAIRED, 2: UNAIRED, 3: UNAIRED, 4: UNAIRED},
3: {1: UNAIRED, 2: UNAIRED, 3: UNAIRED}
}))
),
dict(
name='End only', name='End only',
show=dict(indexer=1, indexerid=2, quality=Quality.combineQualities([Quality.SDTV], [])), show=dict(indexer=1, indexerid=2, quality=Quality.combineQualities([Quality.SDTV], [])),
episodes=[ episodes=[
@ -296,6 +329,51 @@ wanted_tests = [
count=0, episodes={ count=0, episodes={
})) }))
), ),
dict(
name='no episodes, whole first season',
show=dict(indexer=1, indexerid=37, quality=Quality.combineQualities([Quality.SDTV], [])),
episodes=[
],
start_wanted=-1, end_wanted=0,
result=dict(
start=dict(
count=0, episodes={
}),
end=dict(
count=0, episodes={
}))
),
dict(
name='no episodes, whole last season',
show=dict(indexer=1, indexerid=38, quality=Quality.combineQualities([Quality.SDTV], [])),
episodes=[
],
start_wanted=0, end_wanted=-1,
result=dict(
start=dict(
count=0, episodes={
}),
end=dict(
count=0, episodes={
}))
),
dict(
name='no episodes, whole first and last season',
show=dict(indexer=1, indexerid=39, quality=Quality.combineQualities([Quality.SDTV], [])),
episodes=[
],
start_wanted=-1, end_wanted=-1,
result=dict(
start=dict(
count=0, episodes={
}),
end=dict(
count=0, episodes={
}))
),
] ]

Loading…
Cancel
Save