summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormorpheus65535 <[email protected]>2021-06-14 15:29:39 -0400
committermorpheus65535 <[email protected]>2021-06-14 15:29:39 -0400
commitf4df07fb83b37bc4022723f2af572d5d77ae2316 (patch)
tree6c57db562339c3ce7d5d41301d1c387b2731a82b
parentbd0a2fe0045f01cfaba9c8c50a33455169cd81ed (diff)
downloadbazarr-f4df07fb83b37bc4022723f2af572d5d77ae2316.tar.gz
bazarr-f4df07fb83b37bc4022723f2af572d5d77ae2316.zip
Fixed Titrari provider #1438
-rw-r--r--libs/subliminal_patch/providers/titrari.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/libs/subliminal_patch/providers/titrari.py b/libs/subliminal_patch/providers/titrari.py
index b0773ed75..7ac00c3d7 100644
--- a/libs/subliminal_patch/providers/titrari.py
+++ b/libs/subliminal_patch/providers/titrari.py
@@ -1,6 +1,7 @@
# coding=utf-8
from __future__ import absolute_import
+import os
import io
import logging
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.providers import ParserBeautifulSoup
from subliminal.video import Episode, Movie
+from subliminal.subtitle import SUBTITLE_EXTENSIONS
from subzero.language import Language
# parsing regex definitions
@@ -95,7 +97,7 @@ class TitrariProvider(Provider, ProviderSubtitleArchiveMixin):
languages = {Language(l) for l in ['ron', 'eng']}
languages.update(set(Language.rebuild(l, forced=True) for l in languages))
api_url = 'https://www.titrari.ro/'
- query_advanced_search = 'cautareavansata'
+ query_advanced_search = 'cautaredevansata'
def __init__(self):
self.session = None
@@ -226,5 +228,21 @@ class TitrariProvider(Provider, ProviderSubtitleArchiveMixin):
raise ProviderError('[#### Provider: titrari.ro] Unidentified archive type')
+ subtitle.releases = _get_releases_from_archive(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