mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-01-06 06:52:07 +08:00
Fixed Titrari provider #1438
This commit is contained in:
parent
bd0a2fe004
commit
f4df07fb83
1 changed files with 19 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
# coding=utf-8
|
# coding=utf-8
|
||||||
|
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
import os
|
||||||
import io
|
import io
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
|
@ -18,6 +19,7 @@ from .utils import FIRST_THOUSAND_OR_SO_USER_AGENTS as AGENT_LIST
|
||||||
from subliminal.exceptions import ProviderError
|
from subliminal.exceptions import ProviderError
|
||||||
from subliminal.providers import ParserBeautifulSoup
|
from subliminal.providers import ParserBeautifulSoup
|
||||||
from subliminal.video import Episode, Movie
|
from subliminal.video import Episode, Movie
|
||||||
|
from subliminal.subtitle import SUBTITLE_EXTENSIONS
|
||||||
from subzero.language import Language
|
from subzero.language import Language
|
||||||
|
|
||||||
# parsing regex definitions
|
# parsing regex definitions
|
||||||
|
@ -95,7 +97,7 @@ class TitrariProvider(Provider, ProviderSubtitleArchiveMixin):
|
||||||
languages = {Language(l) for l in ['ron', 'eng']}
|
languages = {Language(l) for l in ['ron', 'eng']}
|
||||||
languages.update(set(Language.rebuild(l, forced=True) for l in languages))
|
languages.update(set(Language.rebuild(l, forced=True) for l in languages))
|
||||||
api_url = 'https://www.titrari.ro/'
|
api_url = 'https://www.titrari.ro/'
|
||||||
query_advanced_search = 'cautareavansata'
|
query_advanced_search = 'cautaredevansata'
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.session = None
|
self.session = None
|
||||||
|
@ -226,5 +228,21 @@ class TitrariProvider(Provider, ProviderSubtitleArchiveMixin):
|
||||||
|
|
||||||
raise ProviderError('[#### Provider: titrari.ro] Unidentified archive type')
|
raise ProviderError('[#### Provider: titrari.ro] Unidentified archive type')
|
||||||
|
|
||||||
|
subtitle.releases = _get_releases_from_archive(archive)
|
||||||
subtitle.content = self.get_subtitle_from_archive(subtitle, archive)
|
subtitle.content = self.get_subtitle_from_archive(subtitle, archive)
|
||||||
|
|
||||||
|
|
||||||
|
def _get_releases_from_archive(archive):
|
||||||
|
releases = []
|
||||||
|
for name in archive.namelist():
|
||||||
|
# discard hidden files
|
||||||
|
if os.path.split(name)[-1].startswith('.'):
|
||||||
|
continue
|
||||||
|
|
||||||
|
# discard non-subtitle files
|
||||||
|
if not name.lower().endswith(SUBTITLE_EXTENSIONS):
|
||||||
|
continue
|
||||||
|
|
||||||
|
releases.append(os.path.splitext(os.path.split(name)[1])[0])
|
||||||
|
|
||||||
|
return releases
|
||||||
|
|
Loading…
Reference in a new issue