|
|
@ -7,6 +7,7 @@ import subprocess |
|
|
|
import sys |
|
|
|
import re |
|
|
|
|
|
|
|
from joblib import Parallel, delayed |
|
|
|
from configparser import ConfigParser |
|
|
|
from copy import deepcopy |
|
|
|
from pathlib import Path |
|
|
@ -27,12 +28,15 @@ DRY_RUN: bool = config.get("libconv", "dry_run") != "false" |
|
|
|
DEDUCE_METADATA: bool = config.get("libconv", "deduce_metadata") == "true" |
|
|
|
FFMPEG_LOCATION: str = config.get("ffmpeg", "location") |
|
|
|
FFMPEG_OPTS: str = config.get("ffmpeg", "options") |
|
|
|
THREADS: int = int(config.get("libconv", "threads")) |
|
|
|
|
|
|
|
if DST_OVERWRITE: |
|
|
|
FFMPEG_OPTS += " -y" |
|
|
|
|
|
|
|
logging.basicConfig(level=logging.INFO) |
|
|
|
|
|
|
|
cmd_list: List[str] = [] |
|
|
|
|
|
|
|
# ----------------------------------------------------------------- # |
|
|
|
# file and folder operations |
|
|
|
|
|
|
@ -49,7 +53,7 @@ def mkdir(path: str): |
|
|
|
def execute(command: str): |
|
|
|
logging.debug(f"execute: {command}") |
|
|
|
if not DRY_RUN: |
|
|
|
os.system(command) |
|
|
|
cmd_list.append(command) |
|
|
|
|
|
|
|
# ----------------------------------------------------------------- # |
|
|
|
# cue sheet processing |
|
|
@ -210,6 +214,18 @@ def process_folder(path: str): |
|
|
|
logging.info("scanning subfolders") |
|
|
|
scan_folder(path) |
|
|
|
|
|
|
|
def execute_command_list(): |
|
|
|
logging.info(f"Executing all {len(cmd_list)} commands with {THREADS} parallel threads") |
|
|
|
|
|
|
|
if DRY_RUN: |
|
|
|
logging.info("Skipping execution as we are dry-running. Printing list as debug-info.") |
|
|
|
logging.debug(str(cmd_list)) |
|
|
|
return |
|
|
|
|
|
|
|
Parallel(n_jobs=THREADS)( |
|
|
|
delayed(os.system)(cmd) for cmd in cmd_list |
|
|
|
) |
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
logging.info(f"Using settings from {CONFIG_FILE}") |
|
|
|
|
|
|
@ -219,3 +235,5 @@ if __name__ == "__main__": |
|
|
|
logging.info("Overwrite of existing files active") |
|
|
|
|
|
|
|
process_folder(SRC_FOLDER) |
|
|
|
execute_command_list() |
|
|
|
|