From 876c60271082c2f701882db6108934a66ab1e104 Mon Sep 17 00:00:00 2001 From: Ruud Date: Wed, 11 Jun 2014 12:29:31 +0200 Subject: [PATCH] Code cleanup --- couchpotato/__init__.py | 2 +- couchpotato/core/_base/downloader/main.py | 3 +++ .../_base/downloader/static/downloaders.js | 5 +++-- couchpotato/core/_base/updater/main.py | 2 +- couchpotato/core/downloaders/nzbvortex.py | 4 ++-- couchpotato/core/downloaders/sabnzbd.py | 2 +- couchpotato/core/downloaders/synology.py | 1 + couchpotato/core/downloaders/utorrent.py | 2 +- couchpotato/core/media/__init__.py | 2 +- couchpotato/core/media/_base/media/main.py | 1 - .../core/media/_base/providers/base.py | 3 +++ .../core/media/_base/providers/nzb/newznab.py | 2 +- .../_base/providers/torrent/ilovetorrents.py | 1 + .../_base/providers/torrent/torrentday.py | 1 - .../core/media/_base/search/static/search.css | 1 - couchpotato/core/media/movie/charts/main.py | 1 + .../core/media/movie/charts/static/charts.css | 1 - .../media/movie/providers/info/fanarttv.py | 17 +++++--------- .../media/movie/providers/info/themoviedb.py | 2 +- .../movie/providers/torrent/sceneaccess.py | 1 - .../media/movie/providers/trailer/base.py | 3 +++ .../core/media/movie/suggestion/main.py | 1 - couchpotato/core/plugins/base.py | 2 +- couchpotato/core/plugins/file.py | 4 ++-- couchpotato/core/plugins/log/main.py | 4 ++-- couchpotato/core/plugins/log/static/log.css | 2 +- couchpotato/core/plugins/renamer.py | 2 +- .../core/plugins/wizard/static/wizard.js | 4 ++-- couchpotato/core/settings.py | 1 - couchpotato/static/scripts/api.js | 4 ++-- .../static/scripts/library/question.js | 22 +++++++++---------- couchpotato/static/scripts/page/settings.js | 4 ++-- couchpotato/static/style/main.css | 2 ++ 33 files changed, 56 insertions(+), 53 deletions(-) diff --git a/couchpotato/__init__.py b/couchpotato/__init__.py index 092bd406..fb6b4dc3 100644 --- a/couchpotato/__init__.py +++ b/couchpotato/__init__.py @@ -45,7 +45,7 @@ class WebHandler(BaseHandler): self.write({'success': False, 'error': 'Failed returning results'}) -def addView(route, func, static = False): +def addView(route, func): views[route] = func diff --git a/couchpotato/core/_base/downloader/main.py b/couchpotato/core/_base/downloader/main.py index 80890e4a..70e5cc9c 100644 --- a/couchpotato/core/_base/downloader/main.py +++ b/couchpotato/core/_base/downloader/main.py @@ -72,6 +72,9 @@ class DownloaderBase(Provider): return return self.download(data = data, media = media, filedata = filedata) + def download(self, *args, **kwargs): + return False + def _getAllDownloadStatus(self, download_ids): if self.isDisabled(manual = True, data = {}): return diff --git a/couchpotato/core/_base/downloader/static/downloaders.js b/couchpotato/core/_base/downloader/static/downloaders.js index ec85ce3d..45215158 100644 --- a/couchpotato/core/_base/downloader/static/downloaders.js +++ b/couchpotato/core/_base/downloader/static/downloaders.js @@ -40,15 +40,16 @@ var DownloadersBase = new Class({ button.set('text', button_name); + var message; if(json.success){ - var message = new Element('span.success', { + message = new Element('span.success', { 'text': 'Connection successful' }).inject(button, 'after') } else { var msg_text = 'Connection failed. Check logs for details.'; if(json.hasOwnProperty('msg')) msg_text = json.msg; - var message = new Element('span.failed', { + message = new Element('span.failed', { 'text': msg_text }).inject(button, 'after') } diff --git a/couchpotato/core/_base/updater/main.py b/couchpotato/core/_base/updater/main.py index 5a47fc06..27f9917a 100644 --- a/couchpotato/core/_base/updater/main.py +++ b/couchpotato/core/_base/updater/main.py @@ -10,7 +10,7 @@ from threading import RLock from couchpotato.api import addApiView from couchpotato.core.event import addEvent, fireEvent, fireEventAsync -from couchpotato.core.helpers.encoding import ss, sp +from couchpotato.core.helpers.encoding import sp from couchpotato.core.logger import CPLog from couchpotato.core.plugins.base import Plugin from couchpotato.environment import Env diff --git a/couchpotato/core/downloaders/nzbvortex.py b/couchpotato/core/downloaders/nzbvortex.py index 92ece6d6..9094055f 100644 --- a/couchpotato/core/downloaders/nzbvortex.py +++ b/couchpotato/core/downloaders/nzbvortex.py @@ -130,7 +130,7 @@ class NZBVortex(DownloaderBase): url = cleanHost(self.conf('host'), ssl = self.conf('ssl')) + 'api/' + call try: - data = self.urlopen('%s?%s' % (url, params), *args, verify_ssl = False, **kwargs) + data = self.urlopen('%s?%s' % (url, params), *args, **kwargs) if data: return json.loads(data) @@ -154,7 +154,7 @@ class NZBVortex(DownloaderBase): url = cleanHost(self.conf('host')) + 'api/app/apilevel' try: - data = self.urlopen(url, show_error = False, verify_ssl = False) + data = self.urlopen(url, show_error = False) self.api_level = float(json.loads(data).get('apilevel')) except URLError as e: if hasattr(e, 'code') and e.code == 403: diff --git a/couchpotato/core/downloaders/sabnzbd.py b/couchpotato/core/downloaders/sabnzbd.py index 57e1dca5..cd51cb87 100644 --- a/couchpotato/core/downloaders/sabnzbd.py +++ b/couchpotato/core/downloaders/sabnzbd.py @@ -194,7 +194,7 @@ class Sabnzbd(DownloaderBase): 'output': 'json' })) - data = self.urlopen(url, timeout = 60, show_error = False, verify_ssl = False, headers = {'User-Agent': Env.getIdentifier()}, **kwargs) + data = self.urlopen(url, timeout = 60, show_error = False, headers = {'User-Agent': Env.getIdentifier()}, **kwargs) if use_json: d = json.loads(data) if d.get('error'): diff --git a/couchpotato/core/downloaders/synology.py b/couchpotato/core/downloaders/synology.py index 125d750a..2c12536f 100644 --- a/couchpotato/core/downloaders/synology.py +++ b/couchpotato/core/downloaders/synology.py @@ -90,6 +90,7 @@ class SynologyRPC(object): self.download_url = 'http://%s:%s/webapi/DownloadStation/task.cgi' % (host, port) self.auth_url = 'http://%s:%s/webapi/auth.cgi' % (host, port) + self.sid = None self.username = username self.password = password self.destination = destination diff --git a/couchpotato/core/downloaders/utorrent.py b/couchpotato/core/downloaders/utorrent.py index 7ff5930d..3164681c 100644 --- a/couchpotato/core/downloaders/utorrent.py +++ b/couchpotato/core/downloaders/utorrent.py @@ -168,7 +168,7 @@ class uTorrent(DownloaderBase): status = 'busy' if (torrent[1] & self.status_flags['STARTED'] or torrent[1] & self.status_flags['QUEUED']) and torrent[4] == 1000: status = 'seeding' - elif (torrent[1] & self.status_flags['ERROR']): + elif torrent[1] & self.status_flags['ERROR']: status = 'failed' elif torrent[4] == 1000: status = 'completed' diff --git a/couchpotato/core/media/__init__.py b/couchpotato/core/media/__init__.py index f0abd28c..6c17e6db 100644 --- a/couchpotato/core/media/__init__.py +++ b/couchpotato/core/media/__init__.py @@ -1,7 +1,7 @@ import os import traceback -from couchpotato import get_db, CPLog +from couchpotato import CPLog from couchpotato.core.event import addEvent, fireEvent, fireEventAsync from couchpotato.core.helpers.encoding import toUnicode from couchpotato.core.plugins.base import Plugin diff --git a/couchpotato/core/media/_base/media/main.py b/couchpotato/core/media/_base/media/main.py index c1fdd92b..3c1bf694 100644 --- a/couchpotato/core/media/_base/media/main.py +++ b/couchpotato/core/media/_base/media/main.py @@ -125,7 +125,6 @@ class MediaPlugin(MediaBase): imdb_id = getImdb(str(media_id)) - media = None if imdb_id: media = db.get('media', 'imdb-%s' % imdb_id, with_doc = True)['doc'] else: diff --git a/couchpotato/core/media/_base/providers/base.py b/couchpotato/core/media/_base/providers/base.py index 6bcf3332..587545c8 100644 --- a/couchpotato/core/media/_base/providers/base.py +++ b/couchpotato/core/media/_base/providers/base.py @@ -129,6 +129,9 @@ class YarrProvider(Provider): else: return [] + def buildUrl(self, *args, **kwargs): + pass + def login(self): # Check if we are still logged in every hour diff --git a/couchpotato/core/media/_base/providers/nzb/newznab.py b/couchpotato/core/media/_base/providers/nzb/newznab.py index 13655eed..628a55f2 100644 --- a/couchpotato/core/media/_base/providers/nzb/newznab.py +++ b/couchpotato/core/media/_base/providers/nzb/newznab.py @@ -91,7 +91,7 @@ class Base(NZBProvider, RSS): # Extract a password from the description password = re.search('(?:' + self.passwords_regex + ')(?: *)(?:\:|\=)(?: *)(.*?)\|\n|$', description, flags = re.I).group(1) if password: - name = name + ' {{%s}}' % password.strip() + name += ' {{%s}}' % password.strip() except: log.debug('Error getting details of "%s": %s', (name, traceback.format_exc())) diff --git a/couchpotato/core/media/_base/providers/torrent/ilovetorrents.py b/couchpotato/core/media/_base/providers/torrent/ilovetorrents.py index eac2c476..33edff7f 100644 --- a/couchpotato/core/media/_base/providers/torrent/ilovetorrents.py +++ b/couchpotato/core/media/_base/providers/torrent/ilovetorrents.py @@ -51,6 +51,7 @@ class Base(TorrentProvider): results_table = None data_split = splitString(data, ' .spinner, .mask{ text-transform: none; line-height: 1; -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; font-size: 15px; color: #FFF; }