Repository: pymedusa/Medusa

Issue:
testRename times out on HUGE tv-shows
**Describe the bug**
When renaming HUGE tv-shows (like simpsons) then testRename makes a timeout. 

**To Reproduce**
Steps to reproduce the behavior:
1: go to simpsons
2: pres preview
3: pres rename selected

**Expected behavior**
i expected that it did not make a timeoout :) 

**Screenshots**
If applicable, add screenshots to help explain your problem.
![Unavngivet](https://user-images.githubusercontent.com/3235438/170775747-ebdde173-41c9-4b81-a903-6278d27ef3a3.png)


**Medusa (please complete the following information):**
 - OS: Linux-4.19.0-12-amd64-x86_64-with-debian-10.6
 - Branch: develop
 - Commit: 20613887d6a7530ea4409b7991ccef6a62885a85
 - Python version: 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0]
 - Database version: 44.19


**Debug logs (at least 50 lines):**
General > Advanced Settings > Enable debug

The debug logs doesn't really show anything about the timeout :( 
<details>

```
2022-05-27 21:17:51 DEBUG	APIv2-Thread-57 :: [2061388] 71663: Formatting pattern: Season %S -> Season 1
2022-05-27 21:17:51 DEBUG	APIv2-Thread-57 :: [2061388] Found codec for The Simpsons Simpsons Roasting on an Open Fire
2022-05-27 21:17:51 DEBUG	APIv2-Thread-57 :: [2061388] Parsed /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E01.Simpsons.Roasting.on.an.Open.Fire.720p.WEB-DL into title: The Simpsons, season: 1, episode: [1], episode_title: Simpsons Roasting on an Open Fire, screen_size: 720p, source: Web, type: episode, parsing_time: 0.09069490432739258, absolute_episode: [], quality: 720p WEB-DL, total_time: 0.09074115753173828
2022-05-27 21:17:51 DEBUG	APIv2-Thread-57 :: [2061388] Matched release /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E01.Simpsons.Roasting.on.an.Open.Fire.720p.WEB-DL to a series in your database: The Simpsons using guessit title: The Simpsons
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] New guessit parse for item /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E01.Simpsons.Roasting.on.an.Open.Fire.720p.WEB-DL
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Trying guessit cache for item /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E01.Simpsons.Roasting.on.an.Open.Fire.720p.WEB-DL
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] 71663: Formatting pattern: %S.N.S%0SE01.%E.N.%Q.N -> The.Simpsons.S01E01.Simpsons.Roasting.on.an.Open.Fire.720p.WEB-DL
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Found codec for The Simpsons Simpsons Roasting on an Open Fire
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Parsed /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E01.Simpsons.Roasting.on.an.Open.Fire.720p.WEB-DL into title: The Simpsons, season: 1, episode: [1], episode_title: Simpsons Roasting on an Open Fire, screen_size: 720p, source: Web, type: episode, parsing_time: 0.08942198753356934, absolute_episode: [], quality: 720p WEB-DL, total_time: 0.08946847915649414
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Matched release /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E01.Simpsons.Roasting.on.an.Open.Fire.720p.WEB-DL to a series in your database: The Simpsons using guessit title: The Simpsons
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] New guessit parse for item /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E01.Simpsons.Roasting.on.an.Open.Fire.720p.WEB-DL
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Trying guessit cache for item /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E01.Simpsons.Roasting.on.an.Open.Fire.720p.WEB-DL
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] 71663: Formatting pattern: Season %S -> Season 1
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Found codec for The Simpsons Bart the Genius
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Parsed /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E02.Bart.the.Genius.720p.WEB-DL into title: The Simpsons, season: 1, episode: [2], episode_title: Bart the Genius, screen_size: 720p, source: Web, type: episode, parsing_time: 0.08829736709594727, absolute_episode: [], quality: 720p WEB-DL, total_time: 0.08834481239318848
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Matched release /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E02.Bart.the.Genius.720p.WEB-DL to a series in your database: The Simpsons using guessit title: The Simpsons
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] New guessit parse for item /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E02.Bart.the.Genius.720p.WEB-DL
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Trying guessit cache for item /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E02.Bart.the.Genius.720p.WEB-DL
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] 71663: Formatting pattern: %S.N.S%0SE02.%E.N.%Q.N -> The.Simpsons.S01E02.Bart.the.Genius.720p.WEB-DL
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Found codec for The Simpsons Bart the Genius
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Parsed /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E02.Bart.the.Genius.720p.WEB-DL into title: The Simpsons, season: 1, episode: [2], episode_title: Bart the Genius, screen_size: 720p, source: Web, type: episode, parsing_time: 0.08952498435974121, absolute_episode: [], quality: 720p WEB-DL, total_time: 0.08957958221435547
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Matched release /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E02.Bart.the.Genius.720p.WEB-DL to a series in your database: The Simpsons using guessit title: The Simpsons
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] New guessit parse for item /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E02.Bart.the.Genius.720p.WEB-DL
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Trying guessit cache for item /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E02.Bart.the.Genius.720p.WEB-DL
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] 71663: Formatting pattern: Season %S -> Season 1
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Found codec for The Simpsons Homer's Odyssey
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Parsed /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E03.Homers.Odyssey.720p.WEB-DL into title: The Simpsons, season: 1, episode: [3], episode_title: Homers Odyssey, screen_size: 720p, source: Web, type: episode, parsing_time: 0.15137648582458496, absolute_episode: [], quality: 720p WEB-DL, total_time: 0.15143346786499023
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Matched release /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E03.Homers.Odyssey.720p.WEB-DL to a series in your database: The Simpsons using guessit title: The Simpsons
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] New guessit parse for item /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E03.Homers.Odyssey.720p.WEB-DL
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Trying guessit cache for item /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E03.Homers.Odyssey.720p.WEB-DL
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] 71663: Formatting pattern: %S.N.S%0SE03.%E.N.%Q.N -> The.Simpsons.S01E03.Homers.Odyssey.720p.WEB-DL
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Found codec for The Simpsons Homer's Odyssey
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Parsed /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E03.Homers.Odyssey.720p.WEB-DL into title: The Simpsons, season: 1, episode: [3], episode_title: Homers Odyssey, screen_size: 720p, source: Web, type: episode, parsing_time: 0.08723783493041992, absolute_episode: [], quality: 720p WEB-DL, total_time: 0.0872950553894043
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Matched release /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E03.Homers.Odyssey.720p.WEB-DL to a series in your database: The Simpsons using guessit title: The Simpsons
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] New guessit parse for item /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E03.Homers.Odyssey.720p.WEB-DL
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Trying guessit cache for item /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E03.Homers.Odyssey.720p.WEB-DL
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] 71663: Formatting pattern: Season %S -> Season 1
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Found codec for The Simpsons There's No Disgrace Like Home
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Parsed /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E04.Theres.No.Disgrace.Like.Home.720p.WEB-DL into title: The Simpsons, season: 1, episode: [4], episode_title: Theres No Disgrace Like Home, screen_size: 720p, source: Web, type: episode, parsing_time: 0.09069561958312988, absolute_episode: [], quality: 720p WEB-DL, total_time: 0.09074950218200684
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Matched release /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E04.Theres.No.Disgrace.Like.Home.720p.WEB-DL to a series in your database: The Simpsons using guessit title: The Simpsons
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] New guessit parse for item /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E04.Theres.No.Disgrace.Like.Home.720p.WEB-DL
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Trying guessit cache for item /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E04.Theres.No.Disgrace.Like.Home.720p.WEB-DL
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] 71663: Formatting pattern: %S.N.S%0SE04.%E.N.%Q.N -> The.Simpsons.S01E04.Theres.No.Disgrace.Like.Home.720p.WEB-DL
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Found codec for The Simpsons There's No Disgrace Like Home
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Parsed /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E04.Theres.No.Disgrace.Like.Home.720p.WEB-DL into title: The Simpsons, season: 1, episode: [4], episode_title: Theres No Disgrace Like Home, screen_size: 720p, source: Web, type: episode, parsing_time: 0.09115457534790039, absolute_episode: [], quality: 720p WEB-DL, total_time: 0.09121346473693848
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Matched release /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E04.Theres.No.Disgrace.Like.Home.720p.WEB-DL to a series in your database: The Simpsons using guessit title: The Simpsons
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] New guessit parse for item /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E04.Theres.No.Disgrace.Like.Home.720p.WEB-DL
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Trying guessit cache for item /_serier/Serier/The Simpsons/Season 1/The.Simpsons.S01E04.Theres.No.Disgrace.Like.Home.720p.WEB-DL
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] 71663: Formatting pattern: Season %S -> Season 1
2022-05-27 21:17:50 DEBUG	APIv2-Thread-57 :: [2061388] Found codec for The Simpsons Bart the General
```
</details>


Discussion:

Resolving patch:
diff --git a/medusa/server/api/v2/series_operation.py b/medusa/server/api/v2/series_operation.py
--- a/medusa/server/api/v2/series_operation.py
+++ b/medusa/server/api/v2/series_operation.py
@@ -62,7 +62,9 @@ def post(self, series_slug):
             except ShowDirectoryNotFoundException:
                 return self._bad_request("Can't rename episodes when the show dir is missing.")
 
-            ep_obj_list = series.get_all_episodes(has_location=True)
+            filter_season = data.get('season')
+
+            ep_obj_list = series.get_all_episodes(has_location=True, season=filter_season)
             ep_obj_list = [x for x in ep_obj_list if x.location]
             ep_obj_rename_list = []
             for ep_obj in ep_obj_list:


Test patch: