Repository: pymedusa/Medusa

Issue:
Non-English posters are selected over English ones
**Describe the bug**
Medusa shows me the Ukrainian poster of Love, Death & Robots. This is because although the English poster has 6 votes on TMDB, the Ukrainian has the highest resolution and 1 vote, which results in a higher score in the poster selection algorithm.

It also seems like the Poster vote threshold has no effect, since the logs state a threshold of 2.9 votes but still a poster with 1 vote is selected.

**To Reproduce**
Steps to reproduce the behavior:
1. Add Love, Death & Robots from TMDB

**Expected behavior**
Medusa should preferably select English posters and only choose other languages if English isn't available.

**Screenshots**
![image](https://user-images.githubusercontent.com/12360257/173098384-15faf105-80c3-4d6a-bb7b-b34d8b92d055.png)

**Medusa (please complete the following information):**
 - OS: Docker
 - Branch: develop
 - Commit: [c8be773c883793df0fb94576e027bb4132d32dae](https://github.com/pymedusa/Medusa/commit/c8be773c883793df0fb94576e027bb4132d32dae)
 - Python version: 3.10.4
 - Database version: 44.19

**Debug logs (at least 50 lines):**
General > Advanced Settings > Enable debug
<details>

```
2022-06-10 17:10:48 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Setting permissions for /config/cache/images/tmdb/thumbnails/86831.poster.jpg to 438 as parent directory has 511
2022-06-10 17:10:48 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Searching for poster_thumb for series 86831
2022-06-10 17:10:48 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Setting permissions for /config/cache/images/tmdb/86831.poster.jpg to 438 as parent directory has 511
2022-06-10 17:10:48 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Searching for poster for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Full info for best poster for series 86831: {'bannerpath': '/90wzmrbwd4KieMUEcMAvE10U8K4.jpg', '_bannerpath': 'http://image.tmdb.org/t/p/original/90wzmrbwd4KieMUEcMAvE10U8K4.jpg', 'ratingcount': 1, 'rating': 5.312, 'width': 2000, 'height': 3000, 'aspect_ratio': 0.667, 'airs_time': '0:00AM', 'resolution': '2000x3000', 'res_index': 72, 'score_rated': 1.8121214628584645, 'score_weighted': 36.906060731429235}
2022-06-10 17:10:47 INFO	SHOWQUEUE-UPDATE :: [c8be773] Selected poster for series 86831 (score=36.906060731429235, score_bay=1.8121214628584645, rating=5.312, votes=1, res=2000x3000): http://image.tmdb.org/t/p/original/90wzmrbwd4KieMUEcMAvE10U8K4.jpg
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Weighted poster results for series 86831:
     Score     Rating  Votes      Resolution	URL
    36.906      5.312      1       2000x3000	http://image.tmdb.org/t/p/original/90wzmrbwd4KieMUEcMAvE10U8K4.jpg
    36.611      5.118      4       1500x2222	http://image.tmdb.org/t/p/original/t1G7e2ljVUs4YX7jjwyGYDCoT8K.jpg
    36.406      5.312      1       1920x2679	http://image.tmdb.org/t/p/original/fJuRQniJ00ZViY7MtgZyFX0ZGeY.jpg
    36.303      0.000      0       2000x3000	http://image.tmdb.org/t/p/original/8okrkCzXn9NBLqPweSSgA2efRrI.jpg
    36.303      0.000      0       2000x3000	http://image.tmdb.org/t/p/original/bzpyDlGm5zIr81EOiHQ9vOEq0yw.jpg
    35.915      5.390      6       1382x2048	http://image.tmdb.org/t/p/original/cRiDlzzZC5lL7fvImuSjs04SUIJ.jpg
    35.888      5.172      1       1500x2222	http://image.tmdb.org/t/p/original/58IcUJfo8l00OzIyJzsisqoYqrk.jpg
    35.750      5.246      2       1482x2222	http://image.tmdb.org/t/p/original/asDqvkE66EegtKJJXIRhBJPxscr.jpg
    35.426      5.198      7       1333x2000	http://image.tmdb.org/t/p/original/rlrRI2b6RvM9I9xOBTKqcTaehkE.jpg
    34.803      0.000      0       1482x2222	http://image.tmdb.org/t/p/original/vL5BQvXH96cJzmNK5n7QliQxy90.jpg
    34.803      0.000      0       1482x2222	http://image.tmdb.org/t/p/original/yukmN2nkaqUcZ5Un6aprkC9Vh7P.jpg
    34.250      5.246      2       1200x1600	http://image.tmdb.org/t/p/original/1QIANMkYHQrfHH2zKRWIPbf1SBx.jpg
    33.803      0.000      0       1333x2000	http://image.tmdb.org/t/p/original/yMrm357O8TV3zvLIprBQlPOG4Fe.jpg
    33.721      5.106      2       1080x1600	http://image.tmdb.org/t/p/original/dEJCQRvzSV1wDtdsnCyvqFOr1d.jpg
    33.406      5.312      1       1080x1600	http://image.tmdb.org/t/p/original/xIljZ4AxGPTr1uwDARaeBXUz5jP.jpg
    33.295      5.322      5       1000x1500	http://image.tmdb.org/t/p/original/yirhzFbggq8FHuAEnxCZUKr2B9H.jpg
    32.778      5.384      2       1000x1500	http://image.tmdb.org/t/p/original/r4ZleFGzt1kEDYRjcFdZwJCl7Th.jpg
    32.406      5.312      1       1000x1500	http://image.tmdb.org/t/p/original/iXVNyF9FMMImc2HloUkwndmJIoR.jpg
    32.303      0.000      0       1067x1600	http://image.tmdb.org/t/p/original/2ep7j7hV8gUzX7EmiHvvx3kaiYw.jpg
    31.888      5.172      1       1000x1416	http://image.tmdb.org/t/p/original/zC25FBaMbimIS0QYHddrvJIsQ0y.jpg
    31.888      5.172      1       1000x1416	http://image.tmdb.org/t/p/original/dYECiDXfeGIQohX722AfTXP2G15.jpg
    31.803      0.000      0       1000x1500	http://image.tmdb.org/t/p/original/mlCxG5pudRn4t7iKlDju2Vmgh5o.jpg
    31.803      0.000      0       1000x1500	http://image.tmdb.org/t/p/original/3fABWacGNcz90kJvdT0mFt1dSpW.jpg
    31.388      5.172      1       1000x1414	http://image.tmdb.org/t/p/original/aRbjOwtU2cwOf09GqJAVDSyQQAE.jpg
    31.388      5.172      1       1000x1414	http://image.tmdb.org/t/p/original/4jAXttZ2hlrzdC8fmQcv7Ctc2tz.jpg
    31.388      5.172      1       1000x1414	http://image.tmdb.org/t/p/original/dMuUAIwnzLZvnUIiEBhPfjvMn6l.jpg
    31.388      5.172      1       1000x1414	http://image.tmdb.org/t/p/original/fnWPZ4eJQlTrKhGyMlwUaSn9pTw.jpg
    31.388      5.172      1       1000x1414	http://image.tmdb.org/t/p/original/5hPosd5yld0HHS45QvZOpbR4OfO.jpg
    31.388      5.172      1       1000x1414	http://image.tmdb.org/t/p/original/wuAwUUqmJGQujqFCmoexM8F50uF.jpg
    31.388      5.172      1       1000x1414	http://image.tmdb.org/t/p/original/cls82CWOAhEZB3HMpfkVLZNXTik.jpg
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Poster threshold set to 2.9003744845637347 votes
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 336 total posters for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 800x1185 (58) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 1067x1600 (64) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 564x750 (42) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 780x1037 (47) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 500x665 (32) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 342x455 (23) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 185x246 (14) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 92x122 (1) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 550x825 (43) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 2 posters at 1500x2222 (70) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 2 posters at 1000x1416 (62) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 2 posters at 780x1105 (54) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 2 posters at 500x708 (38) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 8 posters at 1000x1414 (61) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 8 posters at 780x1103 (53) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 8 posters at 500x707 (37) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 10 posters at 342x484 (28) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 10 posters at 185x262 (19) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 8 posters at 1000x1413 (60) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 8 posters at 780x1102 (52) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 8 posters at 500x706 (36) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 8 posters at 342x483 (27) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 8 posters at 185x261 (18) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 18 posters at 154x218 (11) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 18 posters at 92x130 (5) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 2 posters at 1333x2000 (67) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 1200x1600 (66) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 780x1040 (48) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 500x667 (33) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 342x456 (24) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 185x247 (15) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 2 posters at 154x205 (8) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 92x123 (2) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 3 posters at 1482x2222 (69) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 902x1354 (59) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 640x960 (44) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 666x1000 (45) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 4 posters at 780x1171 (57) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 4 posters at 500x751 (41) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 4 posters at 342x514 (31) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 4 posters at 185x278 (22) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 2 posters at 768x1080 (49) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 2 posters at 780x1097 (51) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 2 posters at 500x703 (35) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 2 posters at 342x481 (26) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 2 posters at 185x260 (17) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 2 posters at 154x217 (10) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 2 posters at 92x129 (4) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 1920x2679 (71) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 780x1088 (50) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 500x697 (34) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 342x477 (25) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 185x258 (16) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 154x215 (9) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 92x128 (3) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 720x1080 (46) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 2 posters at 1080x1600 (65) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 3 posters at 2000x3000 (72) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 5 posters at 1000x1500 (63) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 15 posters at 780x1169 (56) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 15 posters at 500x750 (40) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 15 posters at 342x513 (30) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 15 posters at 185x277 (21) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 19 posters at 154x231 (13) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 19 posters at 92x138 (7) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 1 posters at 1382x2048 (68) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 6 posters at 780x1156 (55) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 6 posters at 500x741 (39) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 6 posters at 342x507 (29) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 6 posters at 185x274 (20) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 6 posters at 154x228 (12) resolution for series 86831
2022-06-10 17:10:47 DEBUG	SHOWQUEUE-UPDATE :: [c8be773] Found 6 posters at 92x136 (6) resolution for series 86831
```
</details>



Discussion:
Found the issue, the current code is calling https://api.themoviedb.org/3/tv/86831/images?params=include_image_language&api_key=API_KEY, which is not correct.

Instead it should be https://api.themoviedb.org/3/tv/86831/images?include_image_language=en,null&api_key=API_KEY

The `en,null` is need for backdrops where TMDB has no language info.

Resolving patch:
diff --git a/medusa/indexers/tmdb/api.py b/medusa/indexers/tmdb/api.py
--- a/medusa/indexers/tmdb/api.py
+++ b/medusa/indexers/tmdb/api.py
@@ -363,10 +363,8 @@ def _parse_images(self, tmdb_id):
         _images = {}
 
         # Let's get the different type of images available for this series
-        params = {'include_image_language': '{search_language}'.format(search_language=self.config['language'])}
-
         try:
-            images = self.tmdb.TV(tmdb_id).images(params=params)
+            images = self.tmdb.TV(tmdb_id).images()
         except (AttributeError, RequestException) as error:
             raise IndexerUnavailable('Error trying to get images. Cause: {cause}'.format(cause=error))
 
@@ -376,6 +374,14 @@ def _parse_images(self, tmdb_id):
                 if images and image_type not in _images:
                     _images[image_type] = {}
 
+                # Filter posters by language, backdrops don't have languages
+                if image_type == 'poster':
+                    search_language = self.config['language']
+                    images_for_language = [image for image in images if image['iso_639_1'] == search_language]
+                    # Use the language-limited list if anything was found, otherwise use all images
+                    if images_for_language:
+                        images = images_for_language
+
                 for image in images:
                     bid += 1
                     image_mapped = self._map_results(image, key_mappings=key_mapping)


Test patch: