Commit 7b19a3c9 authored by echel0n's avatar echel0n
Browse files

Updated misc provider code

parent 3f23fd2b
# Changelog
- * 42d7ad6 - 2017-12-11: refactored remaining database calls to use custom database calls
- * 41dc16d - 2017-12-11: Updated misc provider code
- * 3f23fd2 - 2017-12-11: refactored remaining database calls to use custom database calls
- * cf0821c - 2017-12-11: Fixed issue #151 - using unicode instead of str to result post-process results
- * 4323d84 - 2017-12-10: Refactored database calls, resolves memory usage issues
- * 0d8b4d1 - 2017-12-10: Small memory footprint improvement
......
......@@ -294,10 +294,12 @@ class srDatabase(object):
os.rename(self.old_db_path + '-shm', '{}-shm.{}_old'.format(self.old_db_path, random))
def all(self, *args, **kwargs):
return (x['doc'] for x in self.db.all(*args, **kwargs, with_doc=True))
kwargs['with_doc'] = True
return (x['doc'] for x in self.db.all(*args, **kwargs))
def get_many(self, *args, **kwargs):
return (x['doc'] for x in self.db.get_many(*args, **kwargs, with_doc=True))
kwargs['with_doc'] = True
return (x['doc'] for x in self.db.get_many(*args, **kwargs))
def delete(self, *args):
return self.db.delete(*args)
......
......@@ -31,7 +31,7 @@ from sickrage.providers import TorrentProvider
class AlphaRatioProvider(TorrentProvider):
def __init__(self):
super(AlphaRatioProvider, self).__init__("AlphaRatio", 'http://alpharatio.cc', True)
super(AlphaRatioProvider, self).__init__("AlphaRatio", 'https://alpharatio.cc', True)
self.username = None
self.password = None
......
......@@ -58,7 +58,7 @@ class TokyoToshokanProvider(TorrentProvider):
search_params = {
"terms": search_string,
"type": 1, # get anime types
"type": 1
}
try:
......@@ -95,18 +95,16 @@ class TokyoToshokanProvider(TorrentProvider):
desc_top = top.find('td', class_='desc-top')
title = desc_top.get_text(strip=True)
download_url = desc_top.find('a')['href']
desc_bottom = bot.find('td', class_='desc-bot').get_text(strip=True)
size = convert_size(desc_bottom.split('|')[1].strip('Size: '), -1)
if not all([title, download_url]):
continue
stats = bot.find('td', class_='stats').get_text(strip=True)
sl = re.match(r'S:(?P<seeders>\d+)L:(?P<leechers>\d+)C:(?:\d+)ID:(?:\d+)',
stats.replace(' ', ''))
seeders = try_int(sl.group('seeders')) if sl else 0
leechers = try_int(sl.group('leechers')) if sl else 0
sl = re.match(r'S:(?P<seeders>\d+)L:(?P<leechers>\d+)C:(?:\d+)ID:(?:\d+)', stats.replace(' ', ''))
seeders = try_int(sl.group('seeders'), 0)
leechers = try_int(sl.group('leechers'), 0)
if not all([title, download_url]):
continue
desc_bottom = bot.find('td', class_='desc-bot').get_text(strip=True)
size = convert_size(desc_bottom.split('|')[1].strip('Size: '), -1)
results += [
{'title': title, 'link': download_url, 'size': size, 'seeders': seeders, 'leechers': leechers}
......
......@@ -48,12 +48,18 @@ class YggtorrentProvider(TorrentProvider):
# Miscellaneous Options
self.translation = {
'seconde': 'second',
'secondes': 'seconds',
'minute': 'minute',
'minutes': 'minutes',
'heure': 'hour',
'heures': 'hours',
'jour': 'day',
'jours': 'days',
'mois': 'month',
'an': 'year',
'année': 'year',
'ans': 'years',
'années': 'years'
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment