From ed7b9e6564988f0baf7e018cac7052ff2de4fd7e Mon Sep 17 00:00:00 2001 From: Ruud Date: Wed, 25 Apr 2012 21:34:31 +0200 Subject: [PATCH 01/20] Improved searching --- couchpotato/core/plugins/searcher/main.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/couchpotato/core/plugins/searcher/main.py b/couchpotato/core/plugins/searcher/main.py index 72350d8..5a3aaf8 100644 --- a/couchpotato/core/plugins/searcher/main.py +++ b/couchpotato/core/plugins/searcher/main.py @@ -190,7 +190,8 @@ class Searcher(Plugin): log.info('Wrong: Outside retention, age is %s, needs %s or lower: %s' % (nzb['age'], retention, nzb['name'])) return False - nzb_words = re.split('\W+', simplifyString(nzb['name'])) + movie_name = simplifyString(nzb['name']) + nzb_words = re.split('\W+', movie_name) required_words = self.conf('required_words').split(',') if self.conf('required_words') and not list(set(nzb_words) & set(required_words)): @@ -203,6 +204,12 @@ class Searcher(Plugin): log.info("Wrong: '%s' blacklisted words: %s" % (nzb['name'], ", ".join(blacklisted))) return False + pron_tags = ['xxx', 'sex', 'anal', 'tits', 'fuck', 'porn', 'orgy', 'milf', 'boobs'] + for p_tag in pron_tags: + if p_tag in movie_name: + log.info('Wrong: %s, probably pr0n' % (nzb['name'])) + return False + #qualities = fireEvent('quality.all', single = True) preferred_quality = fireEvent('quality.single', identifier = quality['identifier'], single = True) @@ -313,10 +320,10 @@ class Searcher(Plugin): check_movie = fireEvent('scanner.name_year', check_name, single = True) try: - check_words = re.split('\W+', check_movie.get('name', '')) - movie_words = re.split('\W+', simplifyString(movie_name)) + check_words = filter(None, re.split('\W+', check_movie.get('name', ''))) + movie_words = filter(None, re.split('\W+', simplifyString(movie_name))) - if len(list(set(check_words) - set(movie_words))) == 0: + if len(check_words) > 0 and len(movie_words) > 0 and len(list(set(check_words) - set(movie_words))) == 0: return True except: pass From 269fc66e4c34d334276ee13b7b285b583fe99d1a Mon Sep 17 00:00:00 2001 From: Ruud Date: Wed, 25 Apr 2012 21:41:45 +0200 Subject: [PATCH 02/20] Added .ts to searcher --- couchpotato/core/plugins/quality/main.py | 2 +- couchpotato/core/plugins/scanner/main.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/plugins/quality/main.py b/couchpotato/core/plugins/quality/main.py index e6fa1b6..3c5ad7b 100644 --- a/couchpotato/core/plugins/quality/main.py +++ b/couchpotato/core/plugins/quality/main.py @@ -18,7 +18,7 @@ class QualityPlugin(Plugin): qualities = [ {'identifier': 'bd50', 'hd': True, 'size': (15000, 60000), 'label': 'BR-Disk', 'alternative': ['bd25'], 'allow': ['1080p'], 'ext':[], 'tags': ['bdmv', 'certificate', ('complete', 'bluray')]}, {'identifier': '1080p', 'hd': True, 'size': (5000, 20000), 'label': '1080P', 'width': 1920, 'alternative': [], 'allow': [], 'ext':['mkv', 'm2ts']}, - {'identifier': '720p', 'hd': True, 'size': (3500, 10000), 'label': '720P', 'width': 1280, 'alternative': [], 'allow': [], 'ext':['mkv', 'm2ts']}, + {'identifier': '720p', 'hd': True, 'size': (3500, 10000), 'label': '720P', 'width': 1280, 'alternative': [], 'allow': [], 'ext':['mkv', 'm2ts', 'ts']}, {'identifier': 'brrip', 'hd': True, 'size': (700, 7000), 'label': 'BR-Rip', 'alternative': ['bdrip'], 'allow': ['720p'], 'ext':['avi']}, {'identifier': 'dvdr', 'size': (3000, 10000), 'label': 'DVD-R', 'alternative': [], 'allow': [], 'ext':['iso', 'img'], 'tags': ['pal', 'ntsc', 'video_ts', 'audio_ts']}, {'identifier': 'dvdrip', 'size': (600, 2400), 'label': 'DVD-Rip', 'alternative': ['dvdrip'], 'allow': [], 'ext':['avi', 'mpg', 'mpeg']}, diff --git a/couchpotato/core/plugins/scanner/main.py b/couchpotato/core/plugins/scanner/main.py index a36742d..469642c 100644 --- a/couchpotato/core/plugins/scanner/main.py +++ b/couchpotato/core/plugins/scanner/main.py @@ -31,7 +31,7 @@ class Scanner(Plugin): ignored_in_path = ['_unpack', '_failed_', '_unknown_', '_exists_', '.appledouble', '.appledb', '.appledesktop', os.path.sep + '._', '.ds_store', 'cp.cpnfo'] #unpacking, smb-crap, hidden files ignore_names = ['extract', 'extracting', 'extracted', 'movie', 'movies', 'film', 'films', 'download', 'downloads', 'video_ts', 'audio_ts', 'bdmv', 'certificate'] extensions = { - 'movie': ['mkv', 'wmv', 'avi', 'mpg', 'mpeg', 'mp4', 'm2ts', 'iso', 'img', 'mdf'], + 'movie': ['mkv', 'wmv', 'avi', 'mpg', 'mpeg', 'mp4', 'm2ts', 'iso', 'img', 'mdf', 'ts'], 'movie_extra': ['mds'], 'dvd': ['vts_*', 'vob'], 'nfo': ['nfo', 'txt', 'tag'], From ac15df31d803746e5d98f1273bb8db736c4ef60c Mon Sep 17 00:00:00 2001 From: Ruud Date: Wed, 25 Apr 2012 21:57:47 +0200 Subject: [PATCH 03/20] Properly split and strip words. fixes #137 --- couchpotato/core/notifications/core/main.py | 4 ++-- couchpotato/core/notifications/notifymyandroid/main.py | 2 +- couchpotato/core/notifications/notifymywp/main.py | 2 +- couchpotato/core/plugins/manage/main.py | 2 +- couchpotato/core/plugins/movie/main.py | 6 +++--- couchpotato/core/plugins/score/scores.py | 2 +- couchpotato/core/plugins/searcher/main.py | 4 ++-- couchpotato/core/providers/nzb/newznab/main.py | 6 +++--- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/couchpotato/core/notifications/core/main.py b/couchpotato/core/notifications/core/main.py index c3a1621..4c20094 100644 --- a/couchpotato/core/notifications/core/main.py +++ b/couchpotato/core/notifications/core/main.py @@ -56,7 +56,7 @@ class CoreNotifier(Notification): addEvent('library.update_finish', lambda data: fireEvent('notify.frontend', type = 'library.update', data = data)) def markAsRead(self): - ids = getParam('ids').split(',') + ids = [x.strip() for x in getParam('ids').split(',')] db = get_session() @@ -78,7 +78,7 @@ class CoreNotifier(Notification): q = db.query(Notif) if limit_offset: - splt = limit_offset.split(',') + splt = [x.strip() for x in limit_offset.split(',')] limit = splt[0] offset = 0 if len(splt) is 1 else splt[1] q = q.limit(limit).offset(offset) diff --git a/couchpotato/core/notifications/notifymyandroid/main.py b/couchpotato/core/notifications/notifymyandroid/main.py index 45b07cd..2f84317 100644 --- a/couchpotato/core/notifications/notifymyandroid/main.py +++ b/couchpotato/core/notifications/notifymyandroid/main.py @@ -11,7 +11,7 @@ class NotifyMyAndroid(Notification): if self.isDisabled(): return nma = pynma.PyNMA() - keys = self.conf('api_key').split(',') + keys = [x.strip() for x in self.conf('api_key').split(',')] nma.addkey(keys) nma.developerkey(self.conf('dev_key')) diff --git a/couchpotato/core/notifications/notifymywp/main.py b/couchpotato/core/notifications/notifymywp/main.py index 7c294bf..203fdad 100644 --- a/couchpotato/core/notifications/notifymywp/main.py +++ b/couchpotato/core/notifications/notifymywp/main.py @@ -10,7 +10,7 @@ class NotifyMyWP(Notification): def notify(self, message = '', data = {}): if self.isDisabled(): return - keys = self.conf('api_key').split(',') + keys = [x.strip() for x in self.conf('api_key').split(',')] p = PyNMWP(keys, self.conf('dev_key')) response = p.push(application = self.default_title, event = message, description = message, priority = self.conf('priority'), batch_mode = len(keys) > 1) diff --git a/couchpotato/core/plugins/manage/main.py b/couchpotato/core/plugins/manage/main.py index 52b4227..73e1069 100644 --- a/couchpotato/core/plugins/manage/main.py +++ b/couchpotato/core/plugins/manage/main.py @@ -77,6 +77,6 @@ class Manage(Plugin): def directories(self): try: - return self.conf('library', default = '').split('::') + return [x.strip() for x in self.conf('library', default = '').split('::')] except: return [] diff --git a/couchpotato/core/plugins/movie/main.py b/couchpotato/core/plugins/movie/main.py index 06394bc..e18d000 100644 --- a/couchpotato/core/plugins/movie/main.py +++ b/couchpotato/core/plugins/movie/main.py @@ -139,7 +139,7 @@ class MoviePlugin(Plugin): if limit_offset: - splt = limit_offset.split(',') + splt = [x.strip() for x in limit_offset.split(',')] limit = splt[0] offset = 0 if len(splt) is 1 else splt[1] q2 = q2.limit(limit).offset(offset) @@ -324,7 +324,7 @@ class MoviePlugin(Plugin): available_status = fireEvent('status.get', 'available', single = True) - ids = params.get('id').split(',') + ids = [x.strip() for x in params.get('id').split(',')] for movie_id in ids: m = db.query(Movie).filter_by(id = movie_id).first() @@ -356,7 +356,7 @@ class MoviePlugin(Plugin): params = getParams() - ids = params.get('id').split(',') + ids = [x.strip() for x in params.get('id').split(',')] for movie_id in ids: self.delete(movie_id) diff --git a/couchpotato/core/plugins/score/scores.py b/couchpotato/core/plugins/score/scores.py index 1a2f2b8..2cace04 100644 --- a/couchpotato/core/plugins/score/scores.py +++ b/couchpotato/core/plugins/score/scores.py @@ -40,7 +40,7 @@ def nameScore(name, year): # Contains preferred word nzb_words = re.split('\W+', simplifyString(name)) - preferred_words = Env.setting('preferred_words', section = 'searcher').split(',') + preferred_words = [x.strip() for x in Env.setting('preferred_words', section = 'searcher').split(',')] for word in preferred_words: if word.strip() and word.strip().lower() in nzb_words: score = score + 100 diff --git a/couchpotato/core/plugins/searcher/main.py b/couchpotato/core/plugins/searcher/main.py index 5a3aaf8..4c26f4c 100644 --- a/couchpotato/core/plugins/searcher/main.py +++ b/couchpotato/core/plugins/searcher/main.py @@ -192,13 +192,13 @@ class Searcher(Plugin): movie_name = simplifyString(nzb['name']) nzb_words = re.split('\W+', movie_name) - required_words = self.conf('required_words').split(',') + required_words = [x.strip() for x in self.conf('required_words').split(',')] if self.conf('required_words') and not list(set(nzb_words) & set(required_words)): log.info("NZB doesn't contain any of the required words.") return False - ignored_words = self.conf('ignored_words').split(',') + ignored_words = [x.strip() for x in self.conf('ignored_words').split(',')] blacklisted = list(set(nzb_words) & set(ignored_words)) if self.conf('ignored_words') and blacklisted: log.info("Wrong: '%s' blacklisted words: %s" % (nzb['name'], ", ".join(blacklisted))) diff --git a/couchpotato/core/providers/nzb/newznab/main.py b/couchpotato/core/providers/nzb/newznab/main.py index 5ec6743..99fb771 100644 --- a/couchpotato/core/providers/nzb/newznab/main.py +++ b/couchpotato/core/providers/nzb/newznab/main.py @@ -157,9 +157,9 @@ class Newznab(NZBProvider, RSS): def getHosts(self): - uses = str(self.conf('use')).split(',') - hosts = self.conf('host').split(',') - api_keys = self.conf('api_key').split(',') + uses = [x.strip() for x in str(self.conf('use')).split(',')] + hosts = [x.strip() for x in self.conf('host').split(',')] + api_keys = [x.strip() for x in self.conf('api_key').split(',')] list = [] for nr in range(len(hosts)): From b936576d6d2f2ff164f372b94d20eb9557ded6b9 Mon Sep 17 00:00:00 2001 From: Ruud Date: Wed, 25 Apr 2012 22:31:22 +0200 Subject: [PATCH 04/20] Get apikey with username and password. closes #142 --- couchpotato/__init__.py | 18 ++++++++++++++++++ couchpotato/templates/api.html | 6 ++++++ 2 files changed, 24 insertions(+) diff --git a/couchpotato/__init__.py b/couchpotato/__init__.py index 799a298..8386ed9 100644 --- a/couchpotato/__init__.py +++ b/couchpotato/__init__.py @@ -1,6 +1,8 @@ from couchpotato.api import api_docs, api_docs_missing from couchpotato.core.auth import requires_auth from couchpotato.core.event import fireEvent +from couchpotato.core.helpers.request import getParams, jsonified +from couchpotato.core.helpers.variable import md5 from couchpotato.core.logger import CPLog from couchpotato.environment import Env from flask.app import Flask @@ -51,6 +53,22 @@ def apiDocs(): del api_docs_missing[''] return render_template('api.html', fireEvent = fireEvent, routes = sorted(routes), api_docs = api_docs, api_docs_missing = sorted(api_docs_missing)) +@web.route('getkey/') +def getApiKey(): + + api = None + params = getParams() + username = Env.setting('username') + password = Env.setting('password') + + if (params.get('u') == md5(username) or not username) and (params.get('p') == password or not password): + api = Env.setting('api_key') + + return jsonified({ + 'success': api is not None, + 'api_key': api + }) + @app.errorhandler(404) def page_not_found(error): index_url = url_for('web.index') diff --git a/couchpotato/templates/api.html b/couchpotato/templates/api.html index ec067f9..f0e76e3 100644 --- a/couchpotato/templates/api.html +++ b/couchpotato/templates/api.html @@ -18,6 +18,12 @@
You can also use the API over another domain using JSONP, the callback function should be in 'callback_func'
{{ fireEvent('app.api_url', single = True)|safe }}/updater.info/?callback_func=myfunction
+
+
+ Get the API key: +
/getkey/?p=md5(password)&u=md5(username)
+ Will return {"api_key": "XXXXXXXXXX", "success": true}. When username or password is empty you don't need to md5 it. +
{% for route in routes %} From 263a972b88f0281c2556bb1d0eae4588fe41f3ec Mon Sep 17 00:00:00 2001 From: Ruud Date: Wed, 25 Apr 2012 22:50:05 +0200 Subject: [PATCH 05/20] If downloaders are disabled, keep searching for all qualities. closes #135 --- couchpotato/core/plugins/searcher/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/plugins/searcher/main.py b/couchpotato/core/plugins/searcher/main.py index 4c26f4c..530c4ce 100644 --- a/couchpotato/core/plugins/searcher/main.py +++ b/couchpotato/core/plugins/searcher/main.py @@ -123,7 +123,11 @@ class Searcher(Plugin): for nzb in sorted_results: - return self.download(data = nzb, movie = movie) + downloaded = self.download(data = nzb, movie = movie) + if downloaded: + return True + else: + break else: log.info('Better quality (%s) already available or snatched for %s' % (quality_type['quality']['label'], default_title)) fireEvent('movie.restatus', movie['id']) From d489b574f0b75be03516914aa89668a509e67c08 Mon Sep 17 00:00:00 2001 From: Ruud Date: Fri, 27 Apr 2012 10:05:59 +0200 Subject: [PATCH 06/20] Remove dev check --- couchpotato/core/plugins/scanner/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/plugins/scanner/main.py b/couchpotato/core/plugins/scanner/main.py index 469642c..8b183f3 100644 --- a/couchpotato/core/plugins/scanner/main.py +++ b/couchpotato/core/plugins/scanner/main.py @@ -263,7 +263,7 @@ class Scanner(Plugin): file_too_new = tryInt(time.time() - file_time) break - if file_too_new and not Env.get('dev'): + if file_too_new: log.info('Files seem to be still unpacking or just unpacked (created on %s), ignoring for now: %s' % (time.ctime(file_time), identifier)) continue From c2cb188d445ee71764ad372c00e1aab2b7a9441c Mon Sep 17 00:00:00 2001 From: Ruud Date: Fri, 27 Apr 2012 10:23:05 +0200 Subject: [PATCH 07/20] HTTPS for nzbs.org --- couchpotato/core/providers/nzb/nzbs/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/couchpotato/core/providers/nzb/nzbs/main.py b/couchpotato/core/providers/nzb/nzbs/main.py index 4a8d9a0..4281f81 100644 --- a/couchpotato/core/providers/nzb/nzbs/main.py +++ b/couchpotato/core/providers/nzb/nzbs/main.py @@ -13,10 +13,10 @@ log = CPLog(__name__) class Nzbs(NZBProvider, RSS): urls = { - 'download': 'http://nzbs.org/index.php?action=getnzb&nzbid=%s%s', - 'nfo': 'http://nzbs.org/index.php?action=view&nzbid=%s&nfo=1', - 'detail': 'http://nzbs.org/index.php?action=view&nzbid=%s', - 'api': 'http://nzbs.org/rss.php', + 'download': 'https://nzbs.org/index.php?action=getnzb&nzbid=%s%s', + 'nfo': 'https://nzbs.org/index.php?action=view&nzbid=%s&nfo=1', + 'detail': 'https://nzbs.org/index.php?action=view&nzbid=%s', + 'api': 'https://nzbs.org/rss.php', } cat_ids = [ From 7b1ef3c99408a48af74035447a79b93000bfcf14 Mon Sep 17 00:00:00 2001 From: Ruud Date: Fri, 27 Apr 2012 10:53:45 +0200 Subject: [PATCH 08/20] Don't search for empty movies. fixes #153 --- couchpotato/core/providers/movie/couchpotatoapi/main.py | 1 + couchpotato/core/providers/movie/imdbapi/main.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/providers/movie/couchpotatoapi/main.py b/couchpotato/core/providers/movie/couchpotatoapi/main.py index 040bc2e..26e42df 100644 --- a/couchpotato/core/providers/movie/couchpotatoapi/main.py +++ b/couchpotato/core/providers/movie/couchpotatoapi/main.py @@ -27,6 +27,7 @@ class CouchPotatoApi(MovieProvider): def getReleaseDate(self, identifier = None): + if identifier is None: return {} try: headers = {'X-CP-Version': fireEvent('app.version', single = True)} data = self.urlopen((self.api_url % ('eta')) + (identifier + '/'), headers = headers) diff --git a/couchpotato/core/providers/movie/imdbapi/main.py b/couchpotato/core/providers/movie/imdbapi/main.py index bde256a..568b413 100644 --- a/couchpotato/core/providers/movie/imdbapi/main.py +++ b/couchpotato/core/providers/movie/imdbapi/main.py @@ -27,7 +27,7 @@ class IMDBAPI(MovieProvider): name_year = fireEvent('scanner.name_year', q, single = True) - if not name_year.get('name'): + if not q or not name_year.get('name'): return [] cache_key = 'imdbapi.cache.%s' % q @@ -45,6 +45,9 @@ class IMDBAPI(MovieProvider): def getInfo(self, identifier = None): + if not identifier: + return {} + cache_key = 'imdbapi.cache.%s' % identifier cached = self.getCache(cache_key, self.urls['info'] % identifier) From aed6e4ab06c11b0d042129bb2fc5c5a301a26e1d Mon Sep 17 00:00:00 2001 From: Ruud Date: Fri, 27 Apr 2012 11:07:59 +0200 Subject: [PATCH 09/20] Merge pull request #152 from garlandkr/master Removed group setting for init --- init/ubuntu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/ubuntu b/init/ubuntu index 8abc9e7..d6af148 100644 --- a/init/ubuntu +++ b/init/ubuntu @@ -45,7 +45,7 @@ case "$1" in start) echo "Starting $DESC" rm -rf $PID_PATH || return 1 - install -d --mode=0755 -o $RUN_AS -g $RUN_AS $PID_PATH || return 1 + install -d --mode=0755 -o $RUN_AS $PID_PATH || return 1 start-stop-daemon -d $APP_PATH -c $RUN_AS --start --background --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS ;; stop) From af6026666218de02bd69ca51beca62955098be82 Mon Sep 17 00:00:00 2001 From: Ruud Date: Fri, 27 Apr 2012 11:18:43 +0200 Subject: [PATCH 10/20] Check if file exists before adding it to movie_files. fixes #146 --- couchpotato/core/plugins/scanner/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/couchpotato/core/plugins/scanner/main.py b/couchpotato/core/plugins/scanner/main.py index 8b183f3..e71d5c2 100644 --- a/couchpotato/core/plugins/scanner/main.py +++ b/couchpotato/core/plugins/scanner/main.py @@ -165,6 +165,9 @@ class Scanner(Plugin): for file_path in files: + if not os.path.exists(file_path): + continue + # Remove ignored files if self.isSampleFile(file_path): leftovers.append(file_path) From b2ad1f12b5b0f0938e2d7444ae16ba0a1ec88b66 Mon Sep 17 00:00:00 2001 From: Ruud Date: Fri, 27 Apr 2012 13:00:46 +0200 Subject: [PATCH 11/20] Wrong logging format --- couchpotato/core/plugins/renamer/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/couchpotato/core/plugins/renamer/main.py b/couchpotato/core/plugins/renamer/main.py index 5096641..672ad8e 100644 --- a/couchpotato/core/plugins/renamer/main.py +++ b/couchpotato/core/plugins/renamer/main.py @@ -328,7 +328,7 @@ class Renamer(Plugin): try: os.remove(src) except: - log.error('Failed removing %s: %s', (src, traceback.format_exc())) + log.error('Failed removing %s: %s' % (src, traceback.format_exc())) # Remove matching releases for release in remove_releases: @@ -336,14 +336,14 @@ class Renamer(Plugin): try: db.delete(release) except: - log.error('Failed removing %s: %s', (release.identifier, traceback.format_exc())) + log.error('Failed removing %s: %s' % (release.identifier, traceback.format_exc())) if group['dirname'] and group['parentdir']: try: log.info('Deleting folder: %s' % group['parentdir']) self.deleteEmptyFolder(group['parentdir']) except: - log.error('Failed removing %s: %s', (group['parentdir'], traceback.format_exc())) + log.error('Failed removing %s: %s' % (group['parentdir'], traceback.format_exc())) # Search for trailers etc fireEventAsync('renamer.after', group) From 7df659a3029d50a92a2f1500f4a80710d1e66344 Mon Sep 17 00:00:00 2001 From: Ruud Date: Fri, 27 Apr 2012 13:26:12 +0200 Subject: [PATCH 12/20] Kickasstorrent fix #156 --- couchpotato/core/providers/torrent/kickasstorrents/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/providers/torrent/kickasstorrents/main.py b/couchpotato/core/providers/torrent/kickasstorrents/main.py index 8a2fe76..dd5e375 100644 --- a/couchpotato/core/providers/torrent/kickasstorrents/main.py +++ b/couchpotato/core/providers/torrent/kickasstorrents/main.py @@ -127,7 +127,7 @@ class KickAssTorrents(TorrentProvider): return tryInt(age) def download(self, url = '', nzb_id = ''): - compressed_data = super(KickAssTorrents, self).download(url = url, nzb_id = nzb_id) + compressed_data = self.urlopen(url = url, headers = {'Referer': 'http://kat.ph/'}) compressedstream = StringIO.StringIO(compressed_data) gzipper = gzip.GzipFile(fileobj = compressedstream) From 0e9c086b2fcc51afe133d7bd28cb25ce7bf96a81 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 28 Apr 2012 19:52:07 +0200 Subject: [PATCH 13/20] Show status of release. fixes #159 #165 --- couchpotato/core/plugins/movie/static/movie.css | 5 ++++- couchpotato/core/plugins/movie/static/movie.js | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/couchpotato/core/plugins/movie/static/movie.css b/couchpotato/core/plugins/movie/static/movie.css index 9b82598..56521c2 100644 --- a/couchpotato/core/plugins/movie/static/movie.css +++ b/couchpotato/core/plugins/movie/static/movie.css @@ -279,7 +279,8 @@ border: 0; } .movies .options .table .provider { - width: 130px; + width: 120px; + text-overflow: ellipsis; } .movies .options .table .name { width: 350px; @@ -290,6 +291,8 @@ .movies .options .table.files .name { width: 605px; } .movies .options .table .type { width: 130px; } .movies .options .table .is_available { width: 90px; } + .movies .options .table .age, + .movies .options .table .size { width: 40px; } .movies .options .table a { width: 30px !important; diff --git a/couchpotato/core/plugins/movie/static/movie.js b/couchpotato/core/plugins/movie/static/movie.js index bbe526d..5544ed4 100644 --- a/couchpotato/core/plugins/movie/static/movie.js +++ b/couchpotato/core/plugins/movie/static/movie.js @@ -270,8 +270,9 @@ var ReleaseAction = new Class({ // Header new Element('div.item.head').adopt( new Element('span.name', {'text': 'Release name'}), + new Element('span.status', {'text': 'Status'}), new Element('span.quality', {'text': 'Quality'}), - new Element('span.size', {'text': 'Size (MB)'}), + new Element('span.size', {'text': 'Size'}), new Element('span.age', {'text': 'Age'}), new Element('span.score', {'text': 'Score'}), new Element('span.provider', {'text': 'Provider'}) @@ -288,9 +289,10 @@ var ReleaseAction = new Class({ } catch(e){} new Element('div', { - 'class': 'item ' + status.identifier + 'class': 'item' }).adopt( new Element('span.name', {'text': self.get(release, 'name'), 'title': self.get(release, 'name')}), + new Element('span.status', {'text': status.identifier, 'class': 'release_status '+status.identifier}), new Element('span.quality', {'text': quality.get('label')}), new Element('span.size', {'text': (self.get(release, 'size') || 'unknown')}), new Element('span.age', {'text': self.get(release, 'age')}), From 7d68c5ad89404cb25a4ab9036d31943e670274c5 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 28 Apr 2012 19:59:30 +0200 Subject: [PATCH 14/20] Return branch in update.info. closes #161 --- couchpotato/core/_base/updater/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/_base/updater/main.py b/couchpotato/core/_base/updater/main.py index f518222..eb34906 100644 --- a/couchpotato/core/_base/updater/main.py +++ b/couchpotato/core/_base/updater/main.py @@ -96,7 +96,8 @@ class BaseUpdater(Plugin): 'last_check': self.last_check, 'update_version': self.update_version, 'version': self.getVersion(), - 'repo_name': '%s/%s' % (self.repo_user, self.repo_name) + 'repo_name': '%s/%s' % (self.repo_user, self.repo_name), + 'branch': self.branch, } def check(self): From ab5bfd704b32521cbd46519567a2f144d63ec35d Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 28 Apr 2012 20:04:14 +0200 Subject: [PATCH 15/20] Relative docs url --- couchpotato/core/_base/_core/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/_base/_core/__init__.py b/couchpotato/core/_base/_core/__init__.py index d90fa59..2aca8e2 100644 --- a/couchpotato/core/_base/_core/__init__.py +++ b/couchpotato/core/_base/_core/__init__.py @@ -55,7 +55,7 @@ config = [{ 'name': 'api_key', 'default': uuid4().hex, 'readonly': 1, - 'description': 'Let 3rd party app do stuff. Docs', + 'description': 'Let 3rd party app do stuff. Docs', }, { 'name': 'debug', From a2e364a7d7334047dbbd0bc18aec48002730357e Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 28 Apr 2012 20:13:17 +0200 Subject: [PATCH 16/20] Show normal file path --- couchpotato/core/plugins/quality/main.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/couchpotato/core/plugins/quality/main.py b/couchpotato/core/plugins/quality/main.py index 3c5ad7b..e38b818 100644 --- a/couchpotato/core/plugins/quality/main.py +++ b/couchpotato/core/plugins/quality/main.py @@ -161,26 +161,25 @@ class QualityPlugin(Plugin): for cur_file in files: size = (os.path.getsize(cur_file) / 1024 / 1024) if os.path.isfile(cur_file) else 0 words = re.split('\W+', cur_file.lower()) - safe_cur_file = toSafeString(cur_file) for quality in self.all(): # Check tags if quality['identifier'] in words: - log.debug('Found via identifier "%s" in %s' % (quality['identifier'], safe_cur_file)) + log.debug('Found via identifier "%s" in %s' % (quality['identifier'], cur_file)) return self.setCache(hash, quality) if list(set(quality.get('alternative', [])) & set(words)): - log.debug('Found %s via alt %s in %s' % (quality['identifier'], quality.get('alternative'), safe_cur_file)) + log.debug('Found %s via alt %s in %s' % (quality['identifier'], quality.get('alternative'), cur_file)) return self.setCache(hash, quality) for tag in quality.get('tags', []): if isinstance(tag, tuple) and '.'.join(tag) in '.'.join(words): - log.debug('Found %s via tag %s in %s' % (quality['identifier'], quality.get('tags'), safe_cur_file)) + log.debug('Found %s via tag %s in %s' % (quality['identifier'], quality.get('tags'), cur_file)) return self.setCache(hash, quality) if list(set(quality.get('tags', [])) & set(words)): - log.debug('Found %s via tag %s in %s' % (quality['identifier'], quality.get('tags'), safe_cur_file)) + log.debug('Found %s via tag %s in %s' % (quality['identifier'], quality.get('tags'), cur_file)) return self.setCache(hash, quality) # Check on unreliable stuff From 121cb3c7b40bac4295fbbf115edfd322fb9d608b Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 28 Apr 2012 20:23:20 +0200 Subject: [PATCH 17/20] Remove update message after update. fixes #163 --- couchpotato/core/_base/updater/static/updater.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/couchpotato/core/_base/updater/static/updater.js b/couchpotato/core/_base/updater/static/updater.js index 202540d..899f879 100644 --- a/couchpotato/core/_base/updater/static/updater.js +++ b/couchpotato/core/_base/updater/static/updater.js @@ -79,6 +79,8 @@ var UpdaterBase = new Class({ if(json.success){ App.restart('Please wait while CouchPotato is being updated with more awesome stuff.', 'Updating'); App.checkAvailable.delay(500, App); + if(self.message) + self.message.destroy(); } } }); From 05b294c2312a0b6bf08356de81f7aa8f30ca61e7 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 28 Apr 2012 22:14:51 +0200 Subject: [PATCH 18/20] Make sure KAT downloads the correct torrent. fixes #166 --- couchpotato/core/providers/base.py | 8 ++++++-- couchpotato/core/providers/torrent/kickasstorrents/main.py | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/providers/base.py b/couchpotato/core/providers/base.py index 64e7011..826c7d9 100644 --- a/couchpotato/core/providers/base.py +++ b/couchpotato/core/providers/base.py @@ -65,9 +65,13 @@ class YarrProvider(Provider): def belongsTo(self, url, host = None): try: hostname = urlparse(url).hostname - download_url = host if host else self.urls['download'] - if hostname in download_url: + if host and hostname in host: return self + else: + for url_type in self.urls: + download_url = self.urls[url_type] + if hostname in download_url: + return self except: log.debug('Url % s doesn\'t belong to %s' % (url, self.getName())) diff --git a/couchpotato/core/providers/torrent/kickasstorrents/main.py b/couchpotato/core/providers/torrent/kickasstorrents/main.py index dd5e375..6a039c7 100644 --- a/couchpotato/core/providers/torrent/kickasstorrents/main.py +++ b/couchpotato/core/providers/torrent/kickasstorrents/main.py @@ -17,6 +17,7 @@ class KickAssTorrents(TorrentProvider): 'test': 'http://www.kat.ph/', 'detail': 'http://www.kat.ph/%s-t%s.html', 'search': 'http://www.kat.ph/%s-i%s/', + 'download': 'http://torcache.net/', } cat_ids = [ From cdfad20cb280500b3fcc860b9a7704f89e941aac Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 28 Apr 2012 22:40:37 +0200 Subject: [PATCH 19/20] Newzbin DTD update. fixes #157 --- couchpotato/core/providers/nzb/newzbin/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/providers/nzb/newzbin/main.py b/couchpotato/core/providers/nzb/newzbin/main.py index c25c266..d68bbae 100644 --- a/couchpotato/core/providers/nzb/newzbin/main.py +++ b/couchpotato/core/providers/nzb/newzbin/main.py @@ -89,7 +89,7 @@ class Newzbin(NZBProvider, RSS): title = self.getTextElement(nzb, "title") if 'error' in title.lower(): continue - REPORT_NS = 'http://www.newzbin.com/DTD/2007/feeds/report/'; + REPORT_NS = 'http://www.newzbin2.es/DTD/2007/feeds/report/'; # Add attributes to name try: From c7bc0f43790916b9ec8f9ae20a4cafdfc1ad861e Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 28 Apr 2012 22:57:26 +0200 Subject: [PATCH 20/20] Customize meta renaming. closes #158 --- .../core/providers/metadata/xbmc/__init__.py | 22 ++++++++++++++++++++++ couchpotato/core/providers/metadata/xbmc/main.py | 6 +++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/couchpotato/core/providers/metadata/xbmc/__init__.py b/couchpotato/core/providers/metadata/xbmc/__init__.py index 2a9510e..71de827 100644 --- a/couchpotato/core/providers/metadata/xbmc/__init__.py +++ b/couchpotato/core/providers/metadata/xbmc/__init__.py @@ -20,19 +20,41 @@ config = [{ }, { 'name': 'meta_nfo', + 'label': 'NFO', 'default': True, 'type': 'bool', }, { + 'name': 'meta_nfo_name', + 'label': 'NFO filename', + 'default': '%s.nfo', + 'advanced': True, + 'description': '%s is the rootname of the movie. For example "/path/to/movie cd1.mkv" will be "/path/to/movie"' + }, + { 'name': 'meta_fanart', + 'label': 'Fanart', 'default': True, 'type': 'bool', }, { + 'name': 'meta_fanart_name', + 'label': 'Fanart filename', + 'default': '%s-fanart.jpg', + 'advanced': True, + }, + { 'name': 'meta_thumbnail', + 'label': 'Thumbnail', 'default': True, 'type': 'bool', }, + { + 'name': 'meta_thumbnail_name', + 'label': 'Thumbnail filename', + 'default': '%s.tbn', + 'advanced': True, + }, ], }, ], diff --git a/couchpotato/core/providers/metadata/xbmc/main.py b/couchpotato/core/providers/metadata/xbmc/main.py index 2908c6f..7797cce 100644 --- a/couchpotato/core/providers/metadata/xbmc/main.py +++ b/couchpotato/core/providers/metadata/xbmc/main.py @@ -15,13 +15,13 @@ class XBMC(MetaDataBase): return os.path.join(data['destination_dir'], data['filename']) def getFanartName(self, root): - return '%s-fanart.jpg' % root + return self.conf('meta_fanart_name') % root def getThumbnailName(self, root): - return '%s.tbn' % root + return self.conf('meta_thumbnail_name') % root def getNfoName(self, root): - return '%s.nfo' % root + return self.conf('meta_nfo_name') % root def getNfo(self, movie_info = {}, data = {}): nfoxml = Element('movie')