From 1377b6315c81c475ea831cfb0b15e59375d44dae Mon Sep 17 00:00:00 2001 From: Ruud Date: Mon, 14 Oct 2013 22:05:32 +0200 Subject: [PATCH 1/4] Allow imdb id with int of 4-7 --- couchpotato/core/helpers/variable.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/helpers/variable.py b/couchpotato/core/helpers/variable.py index 15f9936d..79181d2b 100644 --- a/couchpotato/core/helpers/variable.py +++ b/couchpotato/core/helpers/variable.py @@ -137,7 +137,7 @@ def getImdb(txt, check_inside = False, multiple = False): output.close() try: - ids = re.findall('(tt\d{7})', txt) + ids = re.findall('(tt\d{4,7})', txt) if multiple: return list(set(ids)) if len(ids) > 0 else [] return ids[0] @@ -146,7 +146,7 @@ def getImdb(txt, check_inside = False, multiple = False): return False -def tryInt(s, default=0): +def tryInt(s, default = 0): try: return int(s) except: return default From ce68a374411a7e5655f277ad6c05ec6badc78dc4 Mon Sep 17 00:00:00 2001 From: Ruud Date: Mon, 14 Oct 2013 22:24:23 +0200 Subject: [PATCH 2/4] Zero fill imdb ids found --- couchpotato/core/helpers/variable.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/couchpotato/core/helpers/variable.py b/couchpotato/core/helpers/variable.py index 79181d2b..8c623f63 100644 --- a/couchpotato/core/helpers/variable.py +++ b/couchpotato/core/helpers/variable.py @@ -1,6 +1,6 @@ -import collections from couchpotato.core.helpers.encoding import simplifyString, toSafeString, ss from couchpotato.core.logger import CPLog +import collections import hashlib import os.path import platform @@ -138,9 +138,11 @@ def getImdb(txt, check_inside = False, multiple = False): try: ids = re.findall('(tt\d{4,7})', txt) + if multiple: - return list(set(ids)) if len(ids) > 0 else [] - return ids[0] + return list(set(['tt%07d' % tryInt(x[2:]) for x in ids])) if len(ids) > 0 else [] + + return 'tt%07d' % tryInt(ids[0][2:]) except IndexError: pass From 400643cbcdab1596335660f528be7776e3828c9e Mon Sep 17 00:00:00 2001 From: Einar Tryggvi Leifsson Date: Mon, 14 Oct 2013 20:27:21 +0000 Subject: [PATCH 3/4] Make ubuntu init script executable so it can be symlinked to /etc/init.d --- init/ubuntu | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 init/ubuntu diff --git a/init/ubuntu b/init/ubuntu old mode 100644 new mode 100755 From 4764925ae6644841b360b3f0908f4b19054f6c1e Mon Sep 17 00:00:00 2001 From: Ruud Date: Fri, 18 Oct 2013 17:13:06 +0200 Subject: [PATCH 4/4] Only skip data dir paths when updating source --- couchpotato/core/_base/updater/main.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/couchpotato/core/_base/updater/main.py b/couchpotato/core/_base/updater/main.py index f3b4b19c..aecf0c4f 100644 --- a/couchpotato/core/_base/updater/main.py +++ b/couchpotato/core/_base/updater/main.py @@ -298,6 +298,7 @@ class SourceUpdater(BaseUpdater): def replaceWith(self, path): app_dir = ss(Env.get('app_dir')) + data_dir = ss(Env.get('data_dir')) # Get list of files we want to overwrite self.deletePyc() @@ -329,12 +330,15 @@ class SourceUpdater(BaseUpdater): log.error('Failed overwriting file "%s": %s', (tofile, traceback.format_exc())) return False - if Env.get('app_dir') not in Env.get('data_dir'): - for still_exists in existing_files: - try: - os.remove(still_exists) - except: - log.error('Failed removing non-used file: %s', traceback.format_exc()) + for still_exists in existing_files: + + if data_dir in still_exists: + continue + + try: + os.remove(still_exists) + except: + log.error('Failed removing non-used file: %s', traceback.format_exc()) return True