예제 #1
0
def check_old_queue():
    """ Check for old queue (when a new queue is not present) """
    old = False
    if not os.path.exists(os.path.join(cfg.admin_dir.get_path(), QUEUE_FILE_NAME)):
        for ver in (QUEUE_VERSION -1 , QUEUE_VERSION - 2, QUEUE_VERSION - 3):
            data = load_admin(QUEUE_FILE_TMPL % str(ver))
            if data:
                break
        try:
            old = bool(data and isinstance(data, tuple) and len(data[1]))
        except (TypeError, IndexError):
            pass
        if old and sabnzbd.WIN32 and ver < 10 and sabnzbd.DIR_LCLDATA != sabnzbd.DIR_HOME \
            and misc.is_relative_path(cfg.download_dir()):
            # For Windows and when version < 10: adjust old default location
            cfg.download_dir.set('Documents/' + cfg.download_dir())
    return old
예제 #2
0
파일: __init__.py 프로젝트: febo635/sabnzbd
def check_old_queue():
    """ Check for old queue (when a new queue is not present) """
    old = False
    if not os.path.exists(
            os.path.join(cfg.admin_dir.get_path(), QUEUE_FILE_NAME)):
        for ver in (QUEUE_VERSION - 1, QUEUE_VERSION - 2, QUEUE_VERSION - 3):
            data = load_admin(QUEUE_FILE_TMPL % str(ver))
            if data:
                break
        try:
            old = bool(data and isinstance(data, tuple) and len(data[1]))
        except (TypeError, IndexError):
            pass
        if old and sabnzbd.WIN32 and ver < 10 and sabnzbd.DIR_LCLDATA != sabnzbd.DIR_HOME \
            and misc.is_relative_path(cfg.download_dir()):
            # For Windows and when version < 10: adjust old default location
            cfg.download_dir.set('Documents/' + cfg.download_dir())
    return old