Merge pull request #876 from josdion/development

add uploader member variable to subtitle class
pull/877/head
morpheus65535 5 years ago committed by GitHub
commit e04364d17d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)

@ -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)

@ -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

@ -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'})
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

@ -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

@ -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

@ -416,11 +416,11 @@
<thead>
<tr>
<th style="text-align: left;">Score:</th>
<th style="text-align: left;">Lang.:</th>
<th style="text-align: left;">HI:</th>
<th style="text-align: left;"></th>
<th style="text-align: left;">Provider:</th>
<th style="text-align: left;">Matching:</th>
<th style="text-align: left;">Releases:</th>
<th style="text-align: left;">Uploader:</th>
<th></th>
</tr>
</thead>
@ -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 = '<div class="ui tiny label" style="margin-bottom: 2px;">' + lng.toUpperCase() + '</div>';
if (data.hearing_impaired == "True") {
text += '<div class="ui tiny inverted label" style="background-color: #313335;">HI</div>';
}
return text;
}
},
{ data: 'hearing_impaired' },
{ data: null,
render: function ( data, type, row ) {
return '<a href="'+data.url+'" target="_blank">'+data.provider+'</a>';
@ -740,6 +745,11 @@
}
text += '</div></div>';
return text;
}
},
{ data: 'uploader',
render: function ( data, type, row ) {
return '<div class="ui tiny label">' + data + '</div>';
}
},
{ data: null,

@ -372,12 +372,12 @@
<thead>
<tr>
<th style="text-align: left;">Score:</th>
<th style="text-align: left;">Lang.:</th>
<th style="text-align: left;">HI:</th>
<th style="text-align: left;"></th>
<th style="text-align: left;">Provider:</th>
<th style="text-align: left;">Matching:</th>
<th style="text-align: left;">Releases:</th>
<th></th>details
<th style="text-align: left;">Uploader:</th>
<th></th>
</tr>
</thead>
</table>
@ -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 = '<div class="ui tiny label" style="margin-bottom: 2px;">' + lng.toUpperCase() + '</div>';
if (data.hearing_impaired == "True") {
text += '<div class="ui tiny inverted label" style="background-color: #313335;">HI</div>';
}
return text;
}
},
{ data: 'hearing_impaired' },
{ data: null,
render: function ( data, type, row ) {
return '<a href="'+data.url+'" target="_blank">'+data.provider+'</a>';
@ -680,6 +685,11 @@
}
text += '</div></div>';
return text;
}
},
{ data: 'uploader',
render: function ( data, type, row ) {
return '<div class="ui tiny label">' + data + '</div>';
}
},
{ data: null,

Loading…
Cancel
Save