From 4b1dc8a63e3bd7f1d7bef84a48f6f5beee0804f8 Mon Sep 17 00:00:00 2001 From: echel0n Date: Wed, 19 Mar 2014 23:17:18 -0700 Subject: [PATCH] Fixed small bug in the getUrl function for helpers. --- sickbeard/helpers.py | 13 ++++++------- sickbeard/scene_numbering.py | 1 - 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sickbeard/helpers.py b/sickbeard/helpers.py index 134834da..d1fcf2f1 100644 --- a/sickbeard/helpers.py +++ b/sickbeard/helpers.py @@ -204,13 +204,12 @@ def _remove_file_failed(file): def download_file(url, filename): try: - with closing(requests.get(url, stream=True)) as r: - with open(filename, 'wb') as fp: - for chunk in r.iter_content(chunk_size=(16 *1024)): - if chunk: - fp.write(chunk) - fp.flush() - fp.close() + r = requests.get(url, stream=True) + with open(filename, 'wb') as fp: + for chunk in r.iter_content(chunk_size=1024): + if chunk: + fp.write(chunk) + fp.flush() except requests.HTTPError, e: _remove_file_failed(filename) diff --git a/sickbeard/scene_numbering.py b/sickbeard/scene_numbering.py index 7b9afbf1..69e6c7b2 100644 --- a/sickbeard/scene_numbering.py +++ b/sickbeard/scene_numbering.py @@ -243,7 +243,6 @@ def _xem_refresh(indexer_id): try: logger.log(u'Looking up XEM scene mapping for show %s on %s' % (indexer_id, indexer,), logger.DEBUG) - #data = getURL('http://thexem.de/map/all?id=%s&origin=tvdb&destination=scene' % (indexer_id,)) data = None if 'Tvdb' in indexer: data = requests.get('http://thexem.de/map/all?id=%s&origin=tvdb&destination=scene' % (indexer_id,)).json()