From 21bd7bc792074b89b7858ffe8989ebbab0d682f4 Mon Sep 17 00:00:00 2001 From: Bazarr Date: Sun, 3 May 2020 16:27:03 +0100 Subject: [PATCH] added uploader to legendasdivx subtitles --- .../providers/legendasdivx.py | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/libs/subliminal_patch/providers/legendasdivx.py b/libs/subliminal_patch/providers/legendasdivx.py index 6247792af..227364794 100644 --- a/libs/subliminal_patch/providers/legendasdivx.py +++ b/libs/subliminal_patch/providers/legendasdivx.py @@ -13,7 +13,7 @@ from subliminal_patch.providers import Provider from subliminal.providers import ParserBeautifulSoup from subliminal_patch.subtitle import Subtitle 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 subliminal_patch.score import get_scores @@ -27,11 +27,12 @@ class LegendasdivxSubtitle(Subtitle): super(LegendasdivxSubtitle, self).__init__(language) self.language = language self.page_link = data['link'] - self.hits=data['hits'] - self.exact_match=data['exact_match'] - self.description=data['description'].lower() + self.hits = data['hits'] + self.exact_match = data['exact_match'] + self.description = data['description'].lower() self.video = video - self.videoname =data['videoname'] + self.videoname = data['videoname'] + self.uploader = data['uploader'] @property def id(self): @@ -109,9 +110,6 @@ class LegendasdivxSubtitle(Subtitle): # matches |= guess_matches(video, guessit(self.description)) return matches - - - class LegendasdivxProvider(Provider): """Legendasdivx Provider.""" languages = {Language('por', 'BR')} | {Language('por')} @@ -204,14 +202,20 @@ class LegendasdivxProvider(Provider): logger.warning('skipping subbox on %s' % self.searchurl.format(query=querytext)) continue + # get subtitle uploader + sub_header = _subbox.find("div", {"class" :"sub_header"}) + uploader = sub_header.find("a").text if sub_header else '' + exact_match = False if video.name.lower() in description.get_text().lower(): exact_match = True data = {'link': self.site + '/modules.php' + download.get('href'), 'exact_match': exact_match, 'hits': hits, + 'uploader': uploader, 'videoname': videoname, - 'description': description.get_text() } + 'description': description.get_text() + } subtitles.append( LegendasdivxSubtitle(lang, video, data) )