From 6a174716af1c091b5c9262f48deac64fea68b8c3 Mon Sep 17 00:00:00 2001 From: Ruud Date: Mon, 1 Dec 2014 22:52:10 +0100 Subject: [PATCH] underscored variables --- .../core/downloaders/putio/__init__.py | 2 +- couchpotato/core/downloaders/putio/main.py | 32 ++++++++----------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/couchpotato/core/downloaders/putio/__init__.py b/couchpotato/core/downloaders/putio/__init__.py index af05e360..cabf9a3a 100644 --- a/couchpotato/core/downloaders/putio/__init__.py +++ b/couchpotato/core/downloaders/putio/__init__.py @@ -40,7 +40,7 @@ config = [{ }, { 'name': 'delete_file', - 'description': 'Set this to remove the file from putio after sucessful download Note: does nothing if you don\'t select download', + 'description': ('Set this to remove the file from putio after sucessful download','Does nothing if you don\'t select download'), 'type': 'bool', 'default': 0, }, diff --git a/couchpotato/core/downloaders/putio/main.py b/couchpotato/core/downloaders/putio/main.py index fca7032f..76ac2033 100644 --- a/couchpotato/core/downloaders/putio/main.py +++ b/couchpotato/core/downloaders/putio/main.py @@ -15,12 +15,8 @@ autoload = 'Putiodownload' class PutIO(DownloaderBase): protocol = ['torrent', 'torrent_magnet'] - status_support = True - downloadingList = [] - - # This is the location on the Internet of the Oauth helper server - oauthServerURL = 'https://api.couchpota.to/validate/putio/' - # oauthServerURL = 'http://localhost:3000/authorize/putio/' + downloading_list = [] + oauth_authenticate = 'https://api.couchpota.to/authorize/putio/' def __init__(self): addApiView('downloader.putio.getfrom', self.getFromPutio, docs = { @@ -44,10 +40,10 @@ class PutIO(DownloaderBase): # Note callback_host is NOT our address, it's the internet host that putio can call too callbackurl = None if self.conf('download'): - callbackurl = 'http://' + self.conf('callback_host') + '/' + '%sdownloader.putio.getfrom/' %Env.get('api_base'.strip('/')) + callbackurl = 'http://' + self.conf('callback_host') + '/' + '%sdownloader.putio.getfrom/' %Env.get('api_base'.strip('/')) resp = client.Transfer.add_url(url, callback_url = callbackurl) log.debug('resp is %s', resp.id); - return self.downloadReturnId(resp.id) + return self.downloadReturnId(resp.id) def test(self): try: @@ -63,10 +59,10 @@ class PutIO(DownloaderBase): callback_url = cleanHost(host) + '%sdownloader.putio.credentials/' % (Env.get('api_base').lstrip('/')) log.debug('callback_url is %s', callback_url) - target_url = self.oauthServerURL + "?target=" + callback_url + target_url = self.oauth_authenticate + "?target=" + callback_url log.debug('target_url is %s', target_url) - return { + return { 'success': True, 'url': target_url, } @@ -92,7 +88,7 @@ class PutIO(DownloaderBase): for t in transfers: if t.id in ids: - log.debug('downloading list is %s', self.downloadingList) + log.debug('downloading list is %s', self.downloading_list) if t.status == "COMPLETED" and self.conf('download') == False : status = 'completed' @@ -100,7 +96,7 @@ class PutIO(DownloaderBase): elif t.status == "COMPLETED" and self.conf('download') == True: # Assume we are done status = 'completed' - if not self.downloadingList: + if not self.downloading_list: now = datetime.datetime.utcnow() date_time = datetime.datetime.strptime(t.finished_at,"%Y-%m-%dT%H:%M:%S") # We need to make sure a race condition didn't happen @@ -108,8 +104,8 @@ class PutIO(DownloaderBase): # 5 minutes haven't passed so we wait status = 'busy' else: - # If we have the file_id in the downloadingList mark it as busy - if str(t.file_id) in self.downloadingList: + # If we have the file_id in the downloading_list mark it as busy + if str(t.file_id) in self.downloading_list: status = 'busy' else: status = 'busy' @@ -135,7 +131,7 @@ class PutIO(DownloaderBase): if str(f.id) == str(fid): client.File.download(f, dest = downloaddir, delete_after_download = self.conf('delete_file')) # Once the download is complete we need to remove it from the running list. - self.downloadingList.remove(fid) + self.downloading_list.remove(fid) return True @@ -149,8 +145,8 @@ class PutIO(DownloaderBase): } log.info('Put.io Download has been called file_id is %s', file_id) - if file_id not in self.downloadingList: - self.downloadingList.append(file_id) + if file_id not in self.downloading_list: + self.downloading_list.append(file_id) fireEventAsync('putio.download',fid = file_id) return { 'success': True, @@ -158,5 +154,5 @@ class PutIO(DownloaderBase): return { 'success': False, - } + }