mirror of
https://github.com/morpheus65535/bazarr
synced 2025-03-15 00:18:48 +00:00
Fix for #915
This commit is contained in:
parent
4f481d16d1
commit
94fc3ae8dd
1 changed files with 11 additions and 7 deletions
|
@ -36,25 +36,29 @@ class ZimukuSubtitle(Subtitle):
|
|||
|
||||
provider_name = "zimuku"
|
||||
|
||||
def __init__(self, language, page_link, version, session):
|
||||
def __init__(self, language, page_link, version, session, year):
|
||||
super(ZimukuSubtitle, self).__init__(language, page_link=page_link)
|
||||
self.version = version
|
||||
self.release_info = version
|
||||
self.hearing_impaired = False
|
||||
self.encoding = "utf-8"
|
||||
self.session = session
|
||||
self.year = year
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
return self.version
|
||||
return self.page_link
|
||||
|
||||
def get_matches(self, video):
|
||||
matches = set()
|
||||
|
||||
if video.year == self.year:
|
||||
matches.add('year')
|
||||
|
||||
# episode
|
||||
if isinstance(video, Episode):
|
||||
# always make year a match
|
||||
info = guessit(self.version, {"type": "episode"})
|
||||
info["year"] = video.year
|
||||
# other properties
|
||||
matches |= guess_matches(video, info, partial=True)
|
||||
# movie
|
||||
|
@ -90,7 +94,7 @@ class ZimukuProvider(Provider):
|
|||
def terminate(self):
|
||||
self.session.close()
|
||||
|
||||
def _parse_episode_page(self, link):
|
||||
def _parse_episode_page(self, link, year):
|
||||
r = self.session.get(link)
|
||||
bs_obj = ParserBeautifulSoup(
|
||||
r.content.decode("utf-8", "ignore"), ["html.parser"]
|
||||
|
@ -118,7 +122,7 @@ class ZimukuProvider(Provider):
|
|||
backup_session.headers["Referer"] = link
|
||||
|
||||
subs.append(
|
||||
self.subtitle_class(language, sub_page_link, name, backup_session)
|
||||
self.subtitle_class(language, sub_page_link, name, backup_session, year)
|
||||
)
|
||||
|
||||
return subs
|
||||
|
@ -150,6 +154,7 @@ class ZimukuProvider(Provider):
|
|||
logger.debug("enter a non-shooter page")
|
||||
for item in soup.find_all("div", {"class": "item"}):
|
||||
title_a = item.find("p", class_="tt clearfix").find("a")
|
||||
subs_year = re.findall(r"\d{4}", title_a.text) or None
|
||||
if season:
|
||||
title = title_a.text
|
||||
season_cn1 = re.search("第(.*)季", title)
|
||||
|
@ -161,7 +166,7 @@ class ZimukuProvider(Provider):
|
|||
if season_cn1 != season_cn2:
|
||||
continue
|
||||
episode_link = self.server_url + title_a.attrs["href"]
|
||||
new_subs = self._parse_episode_page(episode_link)
|
||||
new_subs = self._parse_episode_page(episode_link, subs_year)
|
||||
subtitles += new_subs
|
||||
|
||||
# NOTE: shooter result pages are ignored due to the existence of assrt provider
|
||||
|
@ -331,7 +336,6 @@ def _extract_name(name):
|
|||
end += 1
|
||||
if end - start > result[1] - result[0]:
|
||||
result = [start, end]
|
||||
print(result)
|
||||
start = end
|
||||
end += 1
|
||||
new_name = name[result[0] : result[1]]
|
||||
|
|
Loading…
Add table
Reference in a new issue