Browse Source

Revert "Use ".admin" instead of "__ADMIN__" as job admin folder to support some non-standard Unix systems."

This reverts commit 1b05bc9ed2.
pull/111/head
shypike 12 years ago
parent
commit
003ee07dee
  1. 4
      sabnzbd/api.py
  2. 3
      sabnzbd/constants.py
  3. 23
      sabnzbd/misc.py
  4. 6
      sabnzbd/nzbqueue.py
  5. 8
      sabnzbd/nzbstuff.py
  6. 4
      sabnzbd/postproc.py

4
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)

3
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__'

23
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

6
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:

8
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)

4
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)

Loading…
Cancel
Save