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 diff --git a/couchpotato/core/helpers/variable.py b/couchpotato/core/helpers/variable.py index 15f9936d..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 @@ -137,16 +137,18 @@ 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] + 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 return False -def tryInt(s, default=0): +def tryInt(s, default = 0): try: return int(s) except: return default diff --git a/init/ubuntu b/init/ubuntu old mode 100644 new mode 100755