Esempio n. 1
0
def start_scan(path,
               scan_for,
               scan_type,
               scan_title=None,
               scan_lookup_type=None,
               scan_lookup_id=None):
    section = utils.get_plex_section(conf.configs, path)
    if section <= 0:
        return False
    else:
        logger.info("Using Section ID '%d' for '%s'", section, path)
    if conf.configs['SERVER_USE_SQLITE']:
        db_exists, db_file = db.exists_file_root_path(path)
        if not db_exists and db.add_item(path, scan_for, section, scan_type):
            logger.info("Added '%s' to Plex Autoscan database.", path)
            logger.info("Proceeding with scan...")
        else:
            logger.info(
                "Already processing '%s' from same folder. Skip adding extra scan request to the queue.",
                db_file)
            resleep_paths.append(db_file)
            return False
    thread.start(plex.scan,
                 args=[
                     conf.configs, scan_lock, path, scan_for, section,
                     scan_type, resleep_paths, scan_title, scan_lookup_type,
                     scan_lookup_id
                 ])
    return True
Esempio n. 2
0
def start_scan(path, scan_for, scan_type):
    section = utils.get_plex_section(conf.configs, path)
    if section <= 0:
        return False
    else:
        logger.debug("Using section id: %d for '%s'", section, path)

    if conf.configs['SERVER_USE_SQLITE']:
        db_exists, db_file = db.exists_file_root_path(path)
        if not db_exists and db.add_item(path, scan_for, section, scan_type):
            logger.info("Added '%s' to database, proceeding with scan", path)
        else:
            logger.info(
                "Already processing '%s' from same folder, aborting adding an extra scan request to the queue", db_file)
            resleep_paths.append(db_file)
            return False

    thread.start(plex.scan, args=[conf.configs, scan_lock, path, scan_for, section, scan_type, resleep_paths])
    return True