Add no-op guard
This commit is contained in:
parent
dfc61b04a6
commit
6969e4d7cb
|
@ -23,6 +23,15 @@ def has_audio_in_lang(meta: Dict[str, Any], lang: str) -> bool:
|
|||
return False
|
||||
|
||||
|
||||
def has_audio_not_in_lang(meta: Dict[str, Any], lang: str) -> bool:
|
||||
for stream in meta["streams"]:
|
||||
if stream["codec_type"] == "audio":
|
||||
if stream.get("tags", {}).get("language") != lang:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def make_dubstrip_command(
|
||||
file: Path, outfile: Path, meta: Dict[str, Any], keep_lang: str
|
||||
) -> List[Union[str, Path]]:
|
||||
|
@ -55,6 +64,10 @@ def main() -> None:
|
|||
print(f"no audio in {args.keep}: leaving untouched.")
|
||||
continue
|
||||
|
||||
if not has_audio_not_in_lang(meta, args.keep):
|
||||
print(f"no audio not in {args.keep}: nothing to do.")
|
||||
continue
|
||||
|
||||
outfile = file.parent.joinpath("dubstriptmp-" + file.name)
|
||||
|
||||
cmd = make_dubstrip_command(file, outfile, meta, args.keep)
|
||||
|
|
Loading…
Reference in New Issue