Skip to content

Commit

Permalink
Provider maintenance (#7250)
Browse files Browse the repository at this point in the history
* Fix torrent_checker for transmission on python3

* Update changelog

* No idea how or why

* grr

* Fixed beyond-hd parsing due to small layout changes.

* Fixed provider bj-share due to layout changes

* Fixed provider btdb due date format change in layout

* Remove group_index as we don't use it anymore.
  • Loading branch information
p0psicles authored and medariox committed Oct 11, 2019
1 parent 5ac7f35 commit 299b555
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
#### Fixes
- Fixed AnimeBytes daily search, for multi-ep results ([#7190](https://github.com/pymedusa/Medusa/pull/7190))
- Fixed rare UnicodeDecodeError when parsing titles with Python 2.7 ([#7192](https://github.com/pymedusa/Medusa/pull/7192))
- Fixed torrent checker for client Transmission running on python 3 ([#7250](https://github.com/pymedusa/Medusa/pull/7250))
- Fixed provider beyond-hd due to layout changes ([#7250](https://github.com/pymedusa/Medusa/pull/7250))
- Fixed provider bj-share due to layout changes ([#7250](https://github.com/pymedusa/Medusa/pull/7250))
- Fixed provider btdb due date format change in layout ([#7250](https://github.com/pymedusa/Medusa/pull/7250))

-----

Expand Down
2 changes: 1 addition & 1 deletion medusa/clients/torrent/transmission.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def remove_ratio_reached(self):
return

try:
returned_data = json.loads(self.response.content)
returned_data = json.loads(self.response.text)
except ValueError:
log.warning('Unexpected data received from Transmission: {resp}',
{'resp': self.response.content})
Expand Down
10 changes: 5 additions & 5 deletions medusa/providers/torrent/html/beyondhd.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ def parse(self, data, mode):
cells = result('td')

try:
link = cells[1].find('a')
link = cells[1].find('div')
download_url = urljoin(self.url, cells[2].find('a')['href'])
title = link.get_text(strip=True)
if not all([title, download_url]):
continue

seeders = int(cells[6].find('span').get_text())
leechers = int(cells[7].find('span').get_text())
seeders = int(cells[5].find('span').get_text())
leechers = int(cells[6].find('span').get_text())

# Filter unseeded torrent
if seeders < self.minseed:
Expand All @@ -128,10 +128,10 @@ def parse(self, data, mode):
title, seeders)
continue

torrent_size = cells[5].find('span').get_text()
torrent_size = cells[4].find('span').get_text()
size = convert_size(torrent_size, units=units) or -1

pubdate_raw = cells[4].find('span').get_text()
pubdate_raw = cells[3].find('span').get_text()
pubdate = self.parse_pubdate(pubdate_raw, human_time=True)

item = {
Expand Down
8 changes: 3 additions & 5 deletions medusa/providers/torrent/html/bjshare.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ def process_column_header(td):
for result in torrent_rows[1:]:
cells = result('td')
result_class = result.get('class')
# When "Grouping Torrents" is enabled, the structure of table change
group_index = -2 if 'group_torrent' in result_class else 0
try:
title = result.select('a[href^="torrents.php?id="]')[0].get_text()
title = re.sub(r'\s+', ' ', title).strip() # clean empty lines and multiple spaces
Expand All @@ -201,8 +199,8 @@ def process_column_header(td):
if not all([title, download_url]):
continue

seeders = try_int(cells[labels.index('Seeders') + group_index].get_text(strip=True))
leechers = try_int(cells[labels.index('Leechers') + group_index].get_text(strip=True))
seeders = try_int(cells[4].get_text(strip=True))
leechers = try_int(cells[5].get_text(strip=True))

# Filter unseeded torrent
if seeders < self.minseed:
Expand All @@ -224,7 +222,7 @@ def process_column_header(td):
torrent_details = torrent_details.replace('[', ' ').replace(']', ' ').replace('/', ' ')
torrent_details = torrent_details.replace('Full HD ', '1080p').replace('HD ', '720p')

torrent_size = cells[labels.index('Tamanho') + group_index].get_text(strip=True)
torrent_size = cells[2].get_text(strip=True)
size = convert_size(torrent_size) or -1

torrent_name = '{0} {1}'.format(title, torrent_details.strip()).strip()
Expand Down
2 changes: 1 addition & 1 deletion medusa/providers/torrent/html/btdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def parse(self, data, mode):
size = convert_size(torrent_size, default=-1)

pubdate_raw = spans[2].get_text()
pubdate = self.parse_pubdate(pubdate_raw)
pubdate = self.parse_pubdate(pubdate_raw, human_time=True)

item = {
'title': title,
Expand Down

0 comments on commit 299b555

Please sign in to comment.