Skip to content

Commit 3b38774

Browse files
committed
Fixed Genres attribute data not populating for titles with paranthesis
1 parent c7db082 commit 3b38774

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

custom_components/plex_recently_added/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
"iot_class": "local_polling",
1010
"issue_tracker": "https://github.com/custom-components/sensor.plex_recently_added/issues",
1111
"requirements": [],
12-
"version": "0.6.0"
12+
"version": "0.6.1"
1313
}
1414

custom_components/plex_recently_added/tmdb_api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import aiohttp
2+
import re
23

34
TMDB_API_KEY = '1f7708bb9a218ab891a5d438b1b63992'
45
TMDB_SEARCH_URL = 'https://api.themoviedb.org/3/search/{media_type}?api_key={api_key}&query={query}'
@@ -14,6 +15,8 @@ async def get_tmdb_trailer_url(hass, title, media_type):
1415
else:
1516
return EMPTY_TMDB_RESULT.copy()
1617

18+
title = re.sub(r'\s*\(.*?\)', '', title).strip()
19+
1720
async with aiohttp.ClientSession() as session:
1821
# Search for the movie or TV show
1922
search_url = TMDB_SEARCH_URL.format(media_type=media_type, api_key=TMDB_API_KEY, query=title)

0 commit comments

Comments
 (0)