diff --git a/sabnzbd/api.py b/sabnzbd/api.py index f94da75..edd0da6 100644 --- a/sabnzbd/api.py +++ b/sabnzbd/api.py @@ -52,7 +52,7 @@ from sabnzbd.utils.json import JsonWriter from sabnzbd.utils.pathbrowser import folders_at_path from sabnzbd.misc import loadavg, to_units, diskfree, disktotal, get_ext, \ get_filename, int_conv, globber, time_format, remove_all, \ - starts_with_path, cat_convert, job_admin_dir + starts_with_path, cat_convert from sabnzbd.encoding import xml_name, unicoder, special_fixer, platform_encode, html_escape from sabnzbd.postproc import PostProcessor from sabnzbd.articlecache import ArticleCache @@ -1756,7 +1756,7 @@ def build_history(start=None, limit=None, verbose=False, verbose_list=None, sear path not in retry_folders and \ starts_with_path(path, cfg.download_dir.get_path()) and \ os.path.exists(path)) and \ - not bool(globber(job_admin_dir(path), 'SABnzbd_n*')) \ + not bool(globber(os.path.join(path, JOB_ADMIN), 'SABnzbd_n*')) \ ) if item['retry']: retry_folders.append(path) diff --git a/sabnzbd/constants.py b/sabnzbd/constants.py index 184387e..7e12ddf 100644 --- a/sabnzbd/constants.py +++ b/sabnzbd/constants.py @@ -62,8 +62,7 @@ BOOKMARK_FILE_NAME = 'bookmarks.sab' SCAN_FILE_NAME = 'watched_data.sab' TERM_FLAG_FILE = 'running.sab' FUTURE_Q_FOLDER = 'future' -JOB_ADMIN = '.admin' -JOB_ADMIN_OLD = '__ADMIN__' +JOB_ADMIN = '__ADMIN__' VERIFIED_FILE = '__verified__' QCHECK_FILE = '__skip_qcheck__' RENAMES_FILE = '__renames__' diff --git a/sabnzbd/misc.py b/sabnzbd/misc.py index 3a7c105..7a2f5fb 100644 --- a/sabnzbd/misc.py +++ b/sabnzbd/misc.py @@ -39,7 +39,7 @@ except: import sabnzbd from sabnzbd.decorators import synchronized -from sabnzbd.constants import DEFAULT_PRIORITY, FUTURE_Q_FOLDER, JOB_ADMIN, JOB_ADMIN_OLD, GIGI, Status, MEBI +from sabnzbd.constants import DEFAULT_PRIORITY, FUTURE_Q_FOLDER, JOB_ADMIN, GIGI, Status, MEBI import sabnzbd.config as config import sabnzbd.cfg as cfg from sabnzbd.encoding import unicoder, latin1 @@ -268,7 +268,7 @@ def sanitize_foldername(name): #------------------------------------------------------------------------------ def flag_file(path, flag, create=False): """ Create verify flag file or return True if it already exists """ - path = job_admin_dir(path) + path = os.path.join(path, JOB_ADMIN) path = os.path.join(path, flag) if create: try: @@ -906,7 +906,7 @@ def get_admin_path(newstyle, name, future): if future: return os.path.join(cfg.admin_dir.get_path(), FUTURE_Q_FOLDER) else: - return job_admin_dir(os.path.join(cfg.download_dir.get_path(), name)) + return os.path.join(os.path.join(cfg.download_dir.get_path(), name), JOB_ADMIN) else: return cfg.cache_dir.get_path() @@ -1380,20 +1380,3 @@ def set_permissions(path, recursive=True): set_chmod(path, umask, report) else: set_chmod(path, umask_file, report) - - -def job_admin_dir(folder): - """ Return appropriate admin folder name """ - oldpath = os.path.join(folder, JOB_ADMIN_OLD) - newpath = os.path.join(folder, JOB_ADMIN) - if not os.path.isdir(oldpath): - return newpath - if os.path.isdir(oldpath): - if sabnzbd.WIN32: - # Avoid renames when on Windows, just use old name - return oldpath - else: - logging.debug('Rename old admin path to new admin path: %s to %s', oldpath, newpath) - renamer(oldpath, newpath) - return newpath - return newpath diff --git a/sabnzbd/nzbqueue.py b/sabnzbd/nzbqueue.py index c3ee5d8..2f6e194 100644 --- a/sabnzbd/nzbqueue.py +++ b/sabnzbd/nzbqueue.py @@ -27,12 +27,12 @@ import datetime import sabnzbd from sabnzbd.trylist import TryList from sabnzbd.nzbstuff import NzbObject -from sabnzbd.misc import exit_sab, cat_to_opts, job_admin_dir, \ +from sabnzbd.misc import exit_sab, cat_to_opts, \ get_admin_path, remove_all, globber from sabnzbd.panic import panic_queue import sabnzbd.database as database from sabnzbd.decorators import NZBQUEUE_LOCK, synchronized, synchronized_CV -from sabnzbd.constants import QUEUE_FILE_NAME, QUEUE_VERSION, FUTURE_Q_FOLDER, \ +from sabnzbd.constants import QUEUE_FILE_NAME, QUEUE_VERSION, FUTURE_Q_FOLDER, JOB_ADMIN, \ LOW_PRIORITY, NORMAL_PRIORITY, HIGH_PRIORITY, TOP_PRIORITY, \ REPAIR_PRIORITY, STOP_PRIORITY, VERIFIED_FILE, \ PNFO_BYTES_FIELD, PNFO_BYTES_LEFT_FIELD, Status @@ -155,7 +155,7 @@ class NzbQueue(TryList): return not bool([True for x in verified if not verified[x]]) name = os.path.basename(folder) - path = job_admin_dir(folder) + path = os.path.join(folder, JOB_ADMIN) if hasattr(new_nzb, 'filename'): filename = new_nzb.filename else: diff --git a/sabnzbd/nzbstuff.py b/sabnzbd/nzbstuff.py index 3fed597..453fecf 100644 --- a/sabnzbd/nzbstuff.py +++ b/sabnzbd/nzbstuff.py @@ -34,14 +34,14 @@ except ImportError: # SABnzbd modules import sabnzbd -from sabnzbd.constants import sample_match, GIGI, ATTRIB_FILE, \ +from sabnzbd.constants import sample_match, GIGI, ATTRIB_FILE, JOB_ADMIN, \ DEFAULT_PRIORITY, LOW_PRIORITY, NORMAL_PRIORITY, \ HIGH_PRIORITY, PAUSED_PRIORITY, TOP_PRIORITY, DUP_PRIORITY, \ RENAMES_FILE, Status from sabnzbd.misc import to_units, cat_to_opts, cat_convert, sanitize_foldername, \ get_unique_path, get_admin_path, remove_all, format_source_url, \ sanitize_filename, globber, sanitize_foldername, int_conv, \ - set_permissions, job_admin_dir + set_permissions import sabnzbd.cfg as cfg from sabnzbd.trylist import TryList from sabnzbd.encoding import unicoder, platform_encode, latin1, name_fixer @@ -670,7 +670,7 @@ class NzbObject(TryList): # Determine "incomplete" folder wdir = os.path.join(cfg.download_dir.get_path(), self.work_name) - adir = job_admin_dir(wdir) + adir = os.path.join(wdir, JOB_ADMIN) # Duplicate checking, needs to be done before the backup duplicate = (not reuse) and nzb and dup_check and sabnzbd.backup_exists(filename) @@ -681,7 +681,7 @@ class NzbObject(TryList): else: wdir = get_unique_path(wdir, create_dir=True) set_permissions(wdir) - adir = job_admin_dir(wdir) + adir = os.path.join(wdir, JOB_ADMIN) if not os.path.exists(adir): os.mkdir(adir) diff --git a/sabnzbd/postproc.py b/sabnzbd/postproc.py index 2791573..10d5af2 100644 --- a/sabnzbd/postproc.py +++ b/sabnzbd/postproc.py @@ -36,7 +36,7 @@ from sabnzbd.misc import real_path, get_unique_path, create_dirs, move_to_path, set_permissions, cleanup_empty_directories from sabnzbd.tvsort import Sorter from sabnzbd.constants import REPAIR_PRIORITY, TOP_PRIORITY, POSTPROC_QUEUE_FILE_NAME, \ - POSTPROC_QUEUE_VERSION, sample_match, Status, VERIFIED_FILE, JOB_ADMIN, JOB_ADMIN_OLD + POSTPROC_QUEUE_VERSION, sample_match, JOB_ADMIN, Status, VERIFIED_FILE from sabnzbd.encoding import TRANS, unicoder from sabnzbd.newzbin import Bookmarks import sabnzbd.emailer as emailer @@ -351,7 +351,7 @@ def process_job(nzo): nzo.status = Status.MOVING nzo.set_action_line(T('Moving'), '...') for root, dirs, files in os.walk(workdir): - if not root.endswith(JOB_ADMIN) and not root.endswith(JOB_ADMIN_OLD): + if not root.endswith(JOB_ADMIN): for file_ in files: path = os.path.join(root, file_) new_path = path.replace(workdir, tmp_workdir_complete)