From dd8ba3b70578087ee92efd06bd85350f289588a7 Mon Sep 17 00:00:00 2001 From: Dario Date: Tue, 11 Sep 2018 17:10:28 +0200 Subject: [PATCH] Fix Speedcd parsing and add pubdate (#5190) * Fix Speedcd parsing and add pubdate * Add missing RERIP * Update CHANGELOG.md --- CHANGELOG.md | 2 ++ medusa/providers/torrent/html/speedcd.py | 18 +++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da269d14a4..c1276728ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,11 @@ - Updated the API v2 endpoint to handle concurrent requests ([#4970](https://github.com/pymedusa/Medusa/pull/4970)) - Converted some of the show header to Vue ([#5087](https://github.com/pymedusa/Medusa/pull/5087)) - Converted "Add Show" options into a Vue SFC ([#4848](https://github.com/pymedusa/Medusa/pull/4848)) +- Added publishing date to Speed.CD provider ([#5190](https://github.com/pymedusa/Medusa/pull/5190)) #### Fixes - Fixed many release name parsing issues as a result of updating `guessit` ([#4244](https://github.com/pymedusa/Medusa/pull/4244)) +- Fixed Speed.CD provider exception during searches ([#5190](https://github.com/pymedusa/Medusa/pull/5190)) ----- diff --git a/medusa/providers/torrent/html/speedcd.py b/medusa/providers/torrent/html/speedcd.py index 2d3d9b95ac..968771ceb0 100644 --- a/medusa/providers/torrent/html/speedcd.py +++ b/medusa/providers/torrent/html/speedcd.py @@ -42,7 +42,7 @@ def __init__(self): } # Proper Strings - self.proper_strings = ['PROPER', 'REPACK', 'REAL'] + self.proper_strings = ['PROPER', 'REPACK', 'REAL', 'RERIP'] # Miscellaneous Options self.freeleech = False @@ -109,9 +109,6 @@ def parse(self, data, mode): :return: A list of items found """ - # Units - units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'] - items = [] with BS4Parser(data, 'html5lib') as html: @@ -129,14 +126,14 @@ def parse(self, data, mode): cells = row('td') try: - title = cells[1].find('a', class_='torrent').get_text() + title = cells[1].find('a').get_text() download_url = urljoin(self.url, cells[2].find(title='Download').parent['href']) if not all([title, download_url]): continue - seeders = try_int(cells[5].get_text(strip=True)) - leechers = try_int(cells[6].get_text(strip=True)) + seeders = try_int(cells[6].get_text(strip=True)) + leechers = try_int(cells[7].get_text(strip=True)) # Filter unseeded torrent if seeders < min(self.minseed, 1): @@ -148,7 +145,10 @@ def parse(self, data, mode): torrent_size = cells[4].get_text() torrent_size = torrent_size[:-2] + ' ' + torrent_size[-2:] - size = convert_size(torrent_size, units=units) or -1 + size = convert_size(torrent_size) or -1 + + pubdate_raw = cells[1].find('span', class_='elapsedDate').get_text() + pubdate = self.parse_pubdate(pubdate_raw, human_time=True) item = { 'title': title, @@ -156,7 +156,7 @@ def parse(self, data, mode): 'size': size, 'seeders': seeders, 'leechers': leechers, - 'pubdate': None, + 'pubdate': pubdate, } if mode != 'RSS': log.debug('Found result: {0} with {1} seeders and {2} leechers',