Fix find show results returned as newest/oldest that are then sorted z to a.

This commit is contained in:
JackDandy 2023-05-28 07:41:31 +01:00
parent d797d30704
commit 59f83064b9
2 changed files with 24 additions and 13 deletions

View file

@ -1,4 +1,10 @@
### 3.29.1 (2023-05-26 06:10:00 UTC) ### 3.29.2 (2023-05-28 07:45:00 UTC)
* Fix find show results returned as newest/oldest that are then sorted z to a
* Fix add show "TheTVDB via Trakt"
### 3.29.1 (2023-05-26 06:10:00 UTC)
* Fix IMDB fetch from TheTVDb API * Fix IMDB fetch from TheTVDb API

View file

@ -4297,19 +4297,24 @@ class AddShows(Home):
return (grouped, combined)[as_combined] return (grouped, combined)[as_combined]
if 'az' == sickgear.RESULTS_SORTBY[:2]: sort_methods = [sort_oldest, sort_newest, sort_za, sort_az, sort_rel]
sort_results = [sort_oldest, sort_newest, sort_rel, sort_za, sort_az] if re.match('az|za|ne|ol', sickgear.RESULTS_SORTBY[:2]):
elif 'za' == sickgear.RESULTS_SORTBY[:2]: if 'az' == sickgear.RESULTS_SORTBY[:2]:
sort_results = [sort_oldest, sort_newest, sort_rel, sort_az, sort_za] new_default = sort_az
elif 'newest' == sickgear.RESULTS_SORTBY[:6]: elif 'za' == sickgear.RESULTS_SORTBY[:2]:
sort_results = [sort_az, sort_rel, sort_oldest, sort_newest] new_default = sort_za
elif 'oldest' == sickgear.RESULTS_SORTBY[:6]: elif 'newest' == sickgear.RESULTS_SORTBY[:6]:
sort_results = [sort_az, sort_rel, sort_newest, sort_oldest] new_default = sort_newest
else: else: # 'oldest' == sickgear.RESULTS_SORTBY[:6]:
sort_results = [sort_za, sort_az, sort_oldest, sort_newest, sort_rel] new_default = sort_oldest
for n, func in enumerate(sort_results): sort_methods.remove(new_default)
final_results = func(final_results, n == len(sort_results) - 1, 'nogroup' == sickgear.RESULTS_SORTBY[-7:]) sort_methods += [new_default]
idx_last_sort = len(sort_methods) - 1
sort_nogroup = 'nogroup' == sickgear.RESULTS_SORTBY[-7:]
for n, cur_method in enumerate(sort_methods):
final_results = cur_method(final_results, n == idx_last_sort, sort_nogroup)
return json_dumps({'results': final_results}) return json_dumps({'results': final_results})