From 6d8a209f2a223b1ebf5ae413efa6fc01c1a3a703 Mon Sep 17 00:00:00 2001 From: Prinz23 Date: Sun, 13 Aug 2023 20:33:07 +0200 Subject: [PATCH 1/2] sort backlog and manual segment search results episode number --- sickgear/search_queue.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sickgear/search_queue.py b/sickgear/search_queue.py index ff7a5037..f3b0d1ad 100644 --- a/sickgear/search_queue.py +++ b/sickgear/search_queue.py @@ -653,6 +653,11 @@ class ManualSearchQueueItem(BaseSearchQueueItem): search_result = search.search_providers(self.show_obj, [self.segment], True, try_other_searches=True) if search_result: + # sort results by season, episode number + try: + search_result.sort(key=lambda a: (a.ep_obj_list[0].season or 0, a.ep_obj_list[0].episode or 0)) + except (BaseException, Exception): + pass for result in search_result: # type: sickgear.classes.NZBSearchResult logger.log(f'Downloading {result.name} from {result.provider.name}') self.success = search.snatch_episode(result) @@ -734,6 +739,11 @@ class BacklogQueueItem(BaseSearchQueueItem): scheduled=self.standard_backlog) if search_result: + # sort results by season, episode number + try: + search_result.sort(key=lambda a: (a.ep_obj_list[0].season or 0, a.ep_obj_list[0].episode or 0)) + except (BaseException, Exception): + pass for result in search_result: # type: sickgear.classes.NZBSearchResult logger.log(f'Downloading {result.name} from {result.provider.name}') if search.snatch_episode(result): From 96fc7d1c9d49f4c56508b1151dc0a221733ca8c1 Mon Sep 17 00:00:00 2001 From: Prinz23 Date: Tue, 15 Aug 2023 20:03:32 +0200 Subject: [PATCH 2/2] Change sort episodes when set to wanted on display show page --- CHANGES.md | 2 ++ sickgear/webserve.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 21c9ad0c..3131b947 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,8 @@ * Update Beautiful Soup 4.11.1 (r642) to 4.12.2 * Update soupsieve 2.3.2.post1 (792d566) to 2.4.1 (2e66beb) * Fix regex that was not using py312 notation +* Change sort backlog and manual segment search results episode number +* Change sort episodes when set to wanted on display show page ### 3.29.4 (2023-06-07 13:45:00 UTC) diff --git a/sickgear/webserve.py b/sickgear/webserve.py index e18da957..2505ba9c 100644 --- a/sickgear/webserve.py +++ b/sickgear/webserve.py @@ -3202,7 +3202,10 @@ class Home(MainHandler): if None is not eps: sql_l = [] - for cur_ep in eps.split('|'): + # sort episode numbers + eps_list = eps.split('|') + eps_list.sort() + for cur_ep in eps_list: logger.debug(f'Attempting to set status on episode {cur_ep} to {status}')