1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-23 16:23:41 +00:00

Fixed addic7ed provider that wasn't able to find all shows. #1619

This commit is contained in:
morpheus65535 2021-11-30 12:02:19 -05:00
parent c60c7513a5
commit 4b8f0dbe81

View file

@ -285,29 +285,26 @@ class Addic7edProvider(_Addic7edProvider):
logger.info('Getting show ids')
region.set(self.last_show_ids_fetch_key, datetime.datetime.now())
r = self.session.get(self.server_url, timeout=60)
r = self.session.get(self.server_url + 'shows.php', timeout=60)
r.raise_for_status()
soup = ParserBeautifulSoup(r.content.decode('utf-8', 'ignore'), ['lxml', 'html.parser'])
# populate the show ids
show_ids = {}
shows = soup.find(id='qsShow')
shows = soup.select('td > h3 > a[href^="/show/"]')
for show in shows:
if hasattr(show, 'attrs'):
try:
show_id = int(show.attrs['value'])
except ValueError:
continue
show_clean = sanitize(show.text, default_characters=self.sanitize_characters)
try:
show_id = int(show['href'][6:])
except ValueError:
continue
if show_id != 0:
show_clean = sanitize(show.text, default_characters=self.sanitize_characters)
show_ids[show_clean] = show_id
match = series_year_re.match(show_clean)
if match and match.group(2) and match.group(1) not in show_ids:
# year found, also add it without year
show_ids[match.group(1)] = show_id
show_ids[show_clean] = show_id
match = series_year_re.match(show_clean)
if match and match.group(2) and match.group(1) not in show_ids:
# year found, also add it without year
show_ids[match.group(1)] = show_id
soup.decompose()
soup = None