diff --git a/bazarr/get_subtitle.py b/bazarr/get_subtitle.py index c0d1d50e1..4bfe42d3e 100644 --- a/bazarr/get_subtitle.py +++ b/bazarr/get_subtitle.py @@ -356,6 +356,11 @@ def manual_search(path, language, hi, forced, providers, providers_auth, sceneNa if len(releases) == 0: releases = ['n/a'] + if s.uploader and s.uploader.strip(): + s_uploader = s.uploader.strip() + else: + s_uploader = 'n/a' + subtitles_list.append( dict(score=round((score / max_score * 100), 2), orig_score=score, @@ -364,7 +369,7 @@ def manual_search(path, language, hi, forced, providers, providers_auth, sceneNa provider=s.provider_name, subtitle=codecs.encode(pickle.dumps(s.make_picklable()), "base64").decode(), url=s.page_link, matches=list(matches), dont_matches=list(not_matched), - release_info=releases)) + release_info=releases, uploader=s_uploader)) final_subtitles = sorted(subtitles_list, key=lambda x: (x['orig_score'], x['score_without_hash']), reverse=True) diff --git a/libs/subliminal_patch/providers/opensubtitles.py b/libs/subliminal_patch/providers/opensubtitles.py index 34007ed4e..466b6199f 100644 --- a/libs/subliminal_patch/providers/opensubtitles.py +++ b/libs/subliminal_patch/providers/opensubtitles.py @@ -327,6 +327,7 @@ class OpenSubtitlesProvider(ProviderRetryMixin, _OpenSubtitlesProvider): hash, movie_name, movie_release_name, movie_year, movie_imdb_id, series_season, series_episode, query_parameters, filename, encoding, movie_fps, skip_wrong_fps=self.skip_wrong_fps) + subtitle.uploader = _subtitle_item['UserNickName'] logger.debug('Found subtitle %r by %s', subtitle, matched_by) subtitles.append(subtitle) diff --git a/libs/subliminal_patch/providers/subssabbz.py b/libs/subliminal_patch/providers/subssabbz.py index 2f9321c12..d5e501edb 100644 --- a/libs/subliminal_patch/providers/subssabbz.py +++ b/libs/subliminal_patch/providers/subssabbz.py @@ -132,7 +132,7 @@ class SubsSabBzProvider(Provider): logger.debug('No subtitles found') return subtitles - soup = BeautifulSoup(response.content, 'html.parser') + soup = BeautifulSoup(response.content, 'lxml') rows = soup.findAll('tr', {'class': 'subs-row'}) # Search on first 20 rows only @@ -142,8 +142,12 @@ class SubsSabBzProvider(Provider): element = a_element_wrapper.find('a') if element: link = element.get('href') + element = row.find('a', href = re.compile(r'.*showuser=.*')) + uploader = element.get_text() if element else None logger.info('Found subtitle link %r', link) subtitles = subtitles + self.download_archive_and_add_subtitle_files(link, language, video) + for s in subtitles: + s.uploader = uploader return subtitles diff --git a/libs/subliminal_patch/providers/subsunacs.py b/libs/subliminal_patch/providers/subsunacs.py index 72e0febc7..99832e19f 100644 --- a/libs/subliminal_patch/providers/subsunacs.py +++ b/libs/subliminal_patch/providers/subsunacs.py @@ -135,16 +135,22 @@ class SubsUnacsProvider(Provider): logger.debug('No subtitles found') return subtitles - soup = BeautifulSoup(response.content, 'html.parser') - rows = soup.findAll('td', {'class': 'tdMovie'}) + soup = BeautifulSoup(response.content, 'lxml') + rows = soup.findAll('tr', onmouseover=True) # Search on first 20 rows only for row in rows[:20]: - element = row.find('a', {'class': 'tooltip'}) - if element: - link = element.get('href') - logger.info('Found subtitle link %r', link) - subtitles = subtitles + self.download_archive_and_add_subtitle_files('https://subsunacs.net' + link, language, video) + a_element_wrapper = row.find('td', {'class': 'tdMovie'}) + if a_element_wrapper: + element = a_element_wrapper.find('a', {'class': 'tooltip'}) + if element: + link = element.get('href') + element = row.find('a', href = re.compile(r'.*/search\.php\?t=1\&memid=.*')) + uploader = element.get_text() if element else None + logger.info('Found subtitle link %r', link) + subtitles = subtitles + self.download_archive_and_add_subtitle_files('https://subsunacs.net' + link, language, video) + for s in subtitles: + s.uploader = uploader return subtitles diff --git a/libs/subliminal_patch/providers/yavkanet.py b/libs/subliminal_patch/providers/yavkanet.py index a74c28038..375d23f5f 100644 --- a/libs/subliminal_patch/providers/yavkanet.py +++ b/libs/subliminal_patch/providers/yavkanet.py @@ -121,7 +121,7 @@ class YavkaNetProvider(Provider): logger.debug('No subtitles found') return subtitles - soup = BeautifulSoup(response.content, 'html.parser') + soup = BeautifulSoup(response.content, 'lxml') rows = soup.findAll('tr', {'class': 'info'}) # Search on first 20 rows only @@ -129,8 +129,12 @@ class YavkaNetProvider(Provider): element = row.find('a', {'class': 'selector'}) if element: link = element.get('href') + element = row.find('a', {'class': 'click'}) + uploader = element.get_text() if element else None logger.info('Found subtitle link %r', link) subtitles = subtitles + self.download_archive_and_add_subtitle_files('http://yavka.net/' + link, language, video) + for s in subtitles: + s.uploader = uploader return subtitles diff --git a/libs/subliminal_patch/subtitle.py b/libs/subliminal_patch/subtitle.py index ad39f031b..ce89e74d3 100644 --- a/libs/subliminal_patch/subtitle.py +++ b/libs/subliminal_patch/subtitle.py @@ -54,6 +54,7 @@ class Subtitle(Subtitle_): is_pack = False asked_for_release_group = None asked_for_episode = None + uploader = None # string - uploader username pack_data = None _guessed_encoding = None diff --git a/views/episodes.tpl b/views/episodes.tpl index 82bb6f739..1fb735894 100644 --- a/views/episodes.tpl +++ b/views/episodes.tpl @@ -416,11 +416,11 @@ Score: - Lang.: - HI: + Provider: Matching: Releases: + Uploader: @@ -694,14 +694,19 @@ }, { data: null, render: function ( data, type, row ) { + let lng = data.language; if ( data.language === "pt" && is_pb === true && is_pt === false) { - return 'pb' - } else { - return data.language + lng = 'pb' } + + let text = '
' + lng.toUpperCase() + '
'; + if (data.hearing_impaired == "True") { + text += '
HI
'; + } + + return text; } }, - { data: 'hearing_impaired' }, { data: null, render: function ( data, type, row ) { return ''+data.provider+''; @@ -740,6 +745,11 @@ } text += ''; return text; + } + }, + { data: 'uploader', + render: function ( data, type, row ) { + return '
' + data + '
'; } }, { data: null, diff --git a/views/movie.tpl b/views/movie.tpl index c53849d77..0ce04eb6a 100644 --- a/views/movie.tpl +++ b/views/movie.tpl @@ -372,12 +372,12 @@ Score: - Lang.: - HI: + Provider: Matching: Releases: - details + Uploader: + @@ -632,16 +632,21 @@ }, { data: null, render: function ( data, type, row ) { + let lng = data.language; if ( data.language === "pt" && is_pb === true && is_pt === false) { - return 'pb' + lng = 'pb' } else if ( data.language === "pt:forced" && is_pb === true && is_pt === false) { - return 'pb:forced' - } else { - return data.language + lng = 'pb:forced' + } + + let text = '
' + lng.toUpperCase() + '
'; + if (data.hearing_impaired == "True") { + text += '
HI
'; } + + return text; } }, - { data: 'hearing_impaired' }, { data: null, render: function ( data, type, row ) { return ''+data.provider+''; @@ -680,6 +685,11 @@ } text += ''; return text; + } + }, + { data: 'uploader', + render: function ( data, type, row ) { + return '
' + data + '
'; } }, { data: null,