nixfiles/musicutil/utils/do_replaygain.py

20 lines
423 B
Python
Raw Normal View History

2022-02-06 15:20:12 +00:00
from ..types import File
from ..meta import r128gain_path, ffmpeg_path
from subprocess import run as run_command
2022-02-06 16:18:14 +00:00
def do_replaygain(
file: File,
skip_if_existing: bool = True) -> None:
2022-02-06 15:51:42 +00:00
command_args = [
2022-02-06 15:20:12 +00:00
r128gain_path,
"-f", ffmpeg_path,
2022-02-06 15:51:42 +00:00
"-v", "warning",
2022-02-06 15:20:12 +00:00
file.join_path_to()
2022-02-06 15:51:42 +00:00
]
2022-02-06 16:18:14 +00:00
if skip_if_existing:
2022-02-06 15:51:42 +00:00
command_args.append("-s")
2022-02-06 16:18:14 +00:00
run_command(command_args)