mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-02-25 15:25:57 +08:00
Improved supersubtitles to detect properly forced subtitles. #2226
This commit is contained in:
parent
5f509cd0a0
commit
71f17a2024
1 changed files with 11 additions and 1 deletions
|
@ -152,6 +152,7 @@ class SuperSubtitlesProvider(Provider, ProviderSubtitleArchiveMixin):
|
||||||
languages = {Language('hun', 'HU')} | {Language(lang) for lang in [
|
languages = {Language('hun', 'HU')} | {Language(lang) for lang in [
|
||||||
'hun', 'eng'
|
'hun', 'eng'
|
||||||
]}
|
]}
|
||||||
|
languages.update(set(Language.rebuild(language, forced=True) for language in languages))
|
||||||
video_types = (Episode, Movie)
|
video_types = (Episode, Movie)
|
||||||
# https://www.feliratok.eu/?search=&soriSorszam=&nyelv=&sorozatnev=The+Flash+%282014%29&sid=3212&complexsearch=true&knyelv=0&evad=4&epizod1=1&cimke=0&minoseg=0&rlsr=0&tab=all
|
# https://www.feliratok.eu/?search=&soriSorszam=&nyelv=&sorozatnev=The+Flash+%282014%29&sid=3212&complexsearch=true&knyelv=0&evad=4&epizod1=1&cimke=0&minoseg=0&rlsr=0&tab=all
|
||||||
server_url = 'https://www.feliratok.eu/'
|
server_url = 'https://www.feliratok.eu/'
|
||||||
|
@ -480,6 +481,14 @@ class SuperSubtitlesProvider(Provider, ProviderSubtitleArchiveMixin):
|
||||||
sub_downloadlink = sub_downloadlink.group() if sub_downloadlink else ''
|
sub_downloadlink = sub_downloadlink.group() if sub_downloadlink else ''
|
||||||
sub_downloadlink = self.server_url + sub_downloadlink
|
sub_downloadlink = self.server_url + sub_downloadlink
|
||||||
|
|
||||||
|
# detect forced subtitles
|
||||||
|
szinkronoshoz_sub = table.find("div", {"class": "magyar"})
|
||||||
|
sub_forced = False
|
||||||
|
if szinkronoshoz_sub:
|
||||||
|
sub_forced = 'szinkronoshoz' in szinkronoshoz_sub.text
|
||||||
|
if sub_forced or 'forced' in sub_downloadlink:
|
||||||
|
sub_language = Language.rebuild(sub_language, forced=True)
|
||||||
|
|
||||||
sub_id = re.search(r"(?<=felirat=).*(?=\">)", link)
|
sub_id = re.search(r"(?<=felirat=).*(?=\">)", link)
|
||||||
sub_id = sub_id.group() if sub_id else ''
|
sub_id = sub_id.group() if sub_id else ''
|
||||||
sub_year = video.year
|
sub_year = video.year
|
||||||
|
@ -534,6 +543,7 @@ class SuperSubtitlesProvider(Provider, ProviderSubtitleArchiveMixin):
|
||||||
archive = get_archive_from_bytes(r.content)
|
archive = get_archive_from_bytes(r.content)
|
||||||
|
|
||||||
if archive is None:
|
if archive is None:
|
||||||
raise APIThrottled(f"Invalid archive from {subtitle.page_link}")
|
subtitle.content = r.content
|
||||||
|
return
|
||||||
|
|
||||||
subtitle.content = get_subtitle_from_archive(archive, episode=subtitle.episode or None)
|
subtitle.content = get_subtitle_from_archive(archive, episode=subtitle.episode or None)
|
||||||
|
|
Loading…
Reference in a new issue