added uploader to legendasdivx subtitles

This commit is contained in:
Bazarr 2020-05-03 16:27:03 +01:00
parent 2e798bec0b
commit 21bd7bc792
1 changed files with 13 additions and 9 deletions

View File

@ -13,7 +13,7 @@ from subliminal_patch.providers import Provider
from subliminal.providers import ParserBeautifulSoup from subliminal.providers import ParserBeautifulSoup
from subliminal_patch.subtitle import Subtitle from subliminal_patch.subtitle import Subtitle
from subliminal.video import Episode, Movie from subliminal.video import Episode, Movie
from subliminal.subtitle import SUBTITLE_EXTENSIONS, fix_line_ending,guess_matches from subliminal.subtitle import SUBTITLE_EXTENSIONS, fix_line_ending, guess_matches
from subzero.language import Language from subzero.language import Language
from subliminal_patch.score import get_scores from subliminal_patch.score import get_scores
@ -27,11 +27,12 @@ class LegendasdivxSubtitle(Subtitle):
super(LegendasdivxSubtitle, self).__init__(language) super(LegendasdivxSubtitle, self).__init__(language)
self.language = language self.language = language
self.page_link = data['link'] self.page_link = data['link']
self.hits=data['hits'] self.hits = data['hits']
self.exact_match=data['exact_match'] self.exact_match = data['exact_match']
self.description=data['description'].lower() self.description = data['description'].lower()
self.video = video self.video = video
self.videoname =data['videoname'] self.videoname = data['videoname']
self.uploader = data['uploader']
@property @property
def id(self): def id(self):
@ -109,9 +110,6 @@ class LegendasdivxSubtitle(Subtitle):
# matches |= guess_matches(video, guessit(self.description)) # matches |= guess_matches(video, guessit(self.description))
return matches return matches
class LegendasdivxProvider(Provider): class LegendasdivxProvider(Provider):
"""Legendasdivx Provider.""" """Legendasdivx Provider."""
languages = {Language('por', 'BR')} | {Language('por')} languages = {Language('por', 'BR')} | {Language('por')}
@ -204,14 +202,20 @@ class LegendasdivxProvider(Provider):
logger.warning('skipping subbox on %s' % self.searchurl.format(query=querytext)) logger.warning('skipping subbox on %s' % self.searchurl.format(query=querytext))
continue continue
# get subtitle uploader
sub_header = _subbox.find("div", {"class" :"sub_header"})
uploader = sub_header.find("a").text if sub_header else '<n/a>'
exact_match = False exact_match = False
if video.name.lower() in description.get_text().lower(): if video.name.lower() in description.get_text().lower():
exact_match = True exact_match = True
data = {'link': self.site + '/modules.php' + download.get('href'), data = {'link': self.site + '/modules.php' + download.get('href'),
'exact_match': exact_match, 'exact_match': exact_match,
'hits': hits, 'hits': hits,
'uploader': uploader,
'videoname': videoname, 'videoname': videoname,
'description': description.get_text() } 'description': description.get_text()
}
subtitles.append( subtitles.append(
LegendasdivxSubtitle(lang, video, data) LegendasdivxSubtitle(lang, video, data)
) )