mirror of
https://github.com/morpheus65535/bazarr
synced 2025-01-31 03:12:12 +00:00
Fix previously mess with providers registering on subssabbz and subsunacs
This commit is contained in:
parent
2e8cb7b1f5
commit
aafc55f3cb
3 changed files with 8 additions and 10 deletions
|
@ -37,7 +37,7 @@ class SubsSabBzSubtitle(Subtitle):
|
|||
|
||||
def get_matches(self, video):
|
||||
matches = set()
|
||||
|
||||
|
||||
video_filename = video.name
|
||||
video_filename = os.path.basename(video_filename)
|
||||
video_filename, _ = os.path.splitext(video_filename)
|
||||
|
@ -76,11 +76,11 @@ class SubsSabBzProvider(Provider):
|
|||
|
||||
def terminate(self):
|
||||
self.session.close()
|
||||
|
||||
|
||||
def query(self, language, video):
|
||||
subtitles = []
|
||||
isEpisode = isinstance(video, Episode)
|
||||
|
||||
|
||||
params = {
|
||||
'act': 'search',
|
||||
'movie': '',
|
||||
|
@ -112,7 +112,7 @@ class SubsSabBzProvider(Provider):
|
|||
|
||||
soup = BeautifulSoup(response.content, 'html.parser')
|
||||
rows = soup.findAll('tr', {'class': 'subs-row'})
|
||||
|
||||
|
||||
# Search on first 10 rows only
|
||||
for row in rows[:10]:
|
||||
a_element_wrapper = row.find('td', { 'class': 'c2field' })
|
||||
|
@ -122,7 +122,7 @@ class SubsSabBzProvider(Provider):
|
|||
link = element.get('href')
|
||||
logger.info('Found subtitle link %r', link)
|
||||
subtitles = subtitles + self.download_archive_and_add_subtitle_files(link, language, video)
|
||||
|
||||
|
||||
return subtitles
|
||||
|
||||
def list_subtitles(self, video, languages):
|
||||
|
@ -130,7 +130,7 @@ class SubsSabBzProvider(Provider):
|
|||
|
||||
def download_subtitle(self, subtitle):
|
||||
pass
|
||||
|
||||
|
||||
def process_archive_subtitle_files(self, archiveStream, language, video):
|
||||
subtitles = []
|
||||
type = 'episode' if isinstance(video, Episode) else 'movie'
|
||||
|
@ -141,11 +141,11 @@ class SubsSabBzProvider(Provider):
|
|||
subtitle.content = archiveStream.read(file_name)
|
||||
subtitles.append(subtitle)
|
||||
return subtitles
|
||||
|
||||
|
||||
def download_archive_and_add_subtitle_files(self, link, language, video ):
|
||||
logger.info('Downloading subtitle %r', link)
|
||||
request = self.session.get(link, headers={
|
||||
'Referer': 'http://subs.sab.bz/index.php?'
|
||||
'Referer': 'http://subs.sab.bz/index.php?'
|
||||
})
|
||||
request.raise_for_status()
|
||||
|
|
@ -63,5 +63,3 @@ subliminal.refiner_manager.register('drone = subliminal_patch.refiners.drone:ref
|
|||
subliminal.refiner_manager.register('filebot = subliminal_patch.refiners.filebot:refine')
|
||||
subliminal.refiner_manager.register('file_info_file = subliminal_patch.refiners.file_info_file:refine')
|
||||
subliminal.refiner_manager.register('symlinks = subliminal_patch.refiners.symlinks:refine')
|
||||
subliminal.refiner_manager.register('subsunacs = subliminal.providers.subsunacs:SubsUnacsProvider')
|
||||
subliminal.refiner_manager.register('subssabbz = subliminal.providers.subssabbz:SubsSabBzProvider')
|
Loading…
Reference in a new issue