Exemplo n.º 1
0
 def __init__(self, query: str = "", verbose=False):
     PreSearch.__init__(self, query)
     BaseLog.__init__(self, verbose=verbose)
     self.set_log_prefix("PREDB_LIVE")
Exemplo n.º 2
0
def handle_files(files: List[Path], cli_args: argparse.Namespace):
    log = BaseLog(verbose=True)
    log.set_log_prefix("FILE")
    count = len(files)
    for file_path in files:
        query = query_from_path(file_path, use_metadata=cli_args.use_metadata)
        if not query:
            log.error(
                f"could not generate query for filename: {file_path.name}")
        _search = PreDbOrgSearch(query, verbose=cli_args.verbose)
        if not _search.search():
            if cli_args.rename:
                log.warn(
                    f"could not find release, not renaming file {file_path.name}"
                )
                continue
            else:
                log.warn(f"could not find release using query: {query}")
                continue
        if cli_args.rename:
            if not file_path.exists():
                log.warn(
                    f"found release but {file_path} does not exist, will not rename..."
                )
                continue
            if ".4k." in file_path.name:
                _results = _search.get_results(match="2160p")
            else:
                _results = _search.get_results(match="1080p")
            if not _results:
                log.warn(
                    f"could not find any releases with correct resolution for {_path.name}"
                )
            new_file_name = _results[0]
            if not new_file_name.endswith(file_path.suffix):
                new_file_name = new_file_name + file_path.suffix
            file_path.rename(new_file_name)
            print_rename_info(file_path, new_file_name, line=count > 1)
        else:
            log.log("results:")
            for _result in _search.get_results():
                print(" " * 5, _result)
Exemplo n.º 3
0
 def __init__(self, verbose=False):
     BaseLog.__init__(self, verbose=verbose)
     self.set_log_prefix("RIPPER")