Private GIT

Skip to content
Snippets Groups Projects
Commit 238fc144 authored by labrys's avatar labrys
Browse files

Fix file size conversion for alpharatio

parent ea230b5a
Branches
Tags
No related merge requests found
...@@ -24,6 +24,7 @@ import traceback ...@@ -24,6 +24,7 @@ import traceback
from sickbeard import logger from sickbeard import logger
from sickbeard import tvcache from sickbeard import tvcache
from sickbeard.bs4_parser import BS4Parser from sickbeard.bs4_parser import BS4Parser
from sickrage.helper.common import convert_size
from sickrage.providers.torrent.TorrentProvider import TorrentProvider from sickrage.providers.torrent.TorrentProvider import TorrentProvider
...@@ -109,13 +110,14 @@ class AlphaRatioProvider(TorrentProvider): ...@@ -109,13 +110,14 @@ class AlphaRatioProvider(TorrentProvider):
url = result.find('a', attrs={'title': 'Download'}) url = result.find('a', attrs={'title': 'Download'})
try: try:
title = link.contents[0] num_cells = len(cells)
download_url = self.urls['download'] % (url['href']) title = link.contents[0] if link.contents[0] else None
seeders = cells[len(cells) - 2].contents[0] download_url = self.urls['download'] % (url['href']) if url['href'] else None
leechers = cells[len(cells) - 1].contents[0] seeders = cells[num_cells - 2].contents[0] if cells[len(cells) - 2].contents[0] else 1
# FIXME leechers = cells[num_cells - 1].contents[0] if cells[len(cells) - 1].contents[0] else 0
size = -1 torrent_size = cells[len(cells) - 4].contents[0]
except (AttributeError, TypeError): size = convert_size(torrent_size) or -1
except (AttributeError, TypeError, KeyError, ValueError):
continue continue
if not all([title, download_url]): if not all([title, download_url]):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment