1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-27 18:17:46 +00:00

add uploader member variable to subtitle class

Add uploader member variable to subtitle class and update subssabbz, subsunacs and yavkanet to retrieve the uplader username.
This commit is contained in:
josdion 2020-03-22 09:58:31 +02:00
parent 03b181701e
commit e09d84e09c
4 changed files with 24 additions and 9 deletions

View file

@ -132,7 +132,7 @@ class SubsSabBzProvider(Provider):
logger.debug('No subtitles found') logger.debug('No subtitles found')
return subtitles return subtitles
soup = BeautifulSoup(response.content, 'html.parser') soup = BeautifulSoup(response.content, 'lxml')
rows = soup.findAll('tr', {'class': 'subs-row'}) rows = soup.findAll('tr', {'class': 'subs-row'})
# Search on first 20 rows only # Search on first 20 rows only
@ -142,8 +142,12 @@ class SubsSabBzProvider(Provider):
element = a_element_wrapper.find('a') element = a_element_wrapper.find('a')
if element: if element:
link = element.get('href') 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) logger.info('Found subtitle link %r', link)
subtitles = subtitles + self.download_archive_and_add_subtitle_files(link, language, video) subtitles = subtitles + self.download_archive_and_add_subtitle_files(link, language, video)
for s in subtitles:
s.uploader = uploader
return subtitles return subtitles

View file

@ -135,16 +135,22 @@ class SubsUnacsProvider(Provider):
logger.debug('No subtitles found') logger.debug('No subtitles found')
return subtitles return subtitles
soup = BeautifulSoup(response.content, 'html.parser') soup = BeautifulSoup(response.content, 'lxml')
rows = soup.findAll('td', {'class': 'tdMovie'}) rows = soup.findAll('tr', onmouseover=True)
# Search on first 20 rows only # Search on first 20 rows only
for row in rows[:20]: for row in rows[:20]:
element = row.find('a', {'class': 'tooltip'}) a_element_wrapper = row.find('td', {'class': 'tdMovie'})
if element: if a_element_wrapper:
link = element.get('href') element = a_element_wrapper.find('a', {'class': 'tooltip'})
logger.info('Found subtitle link %r', link) if element:
subtitles = subtitles + self.download_archive_and_add_subtitle_files('https://subsunacs.net' + link, language, video) 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 return subtitles

View file

@ -121,7 +121,7 @@ class YavkaNetProvider(Provider):
logger.debug('No subtitles found') logger.debug('No subtitles found')
return subtitles return subtitles
soup = BeautifulSoup(response.content, 'html.parser') soup = BeautifulSoup(response.content, 'lxml')
rows = soup.findAll('tr', {'class': 'info'}) rows = soup.findAll('tr', {'class': 'info'})
# Search on first 20 rows only # Search on first 20 rows only
@ -129,8 +129,12 @@ class YavkaNetProvider(Provider):
element = row.find('a', {'class': 'selector'}) element = row.find('a', {'class': 'selector'})
if element: if element:
link = element.get('href') 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) logger.info('Found subtitle link %r', link)
subtitles = subtitles + self.download_archive_and_add_subtitle_files('http://yavka.net/' + link, language, video) subtitles = subtitles + self.download_archive_and_add_subtitle_files('http://yavka.net/' + link, language, video)
for s in subtitles:
s.uploader = uploader
return subtitles return subtitles

View file

@ -54,6 +54,7 @@ class Subtitle(Subtitle_):
is_pack = False is_pack = False
asked_for_release_group = None asked_for_release_group = None
asked_for_episode = None asked_for_episode = None
uploader = None # string - uploader username
pack_data = None pack_data = None
_guessed_encoding = None _guessed_encoding = None