|
3 | 3 | from fractions import Fraction
|
4 | 4 | from io import BytesIO
|
5 | 5 | from pathlib import Path
|
6 |
| -from typing import TYPE_CHECKING |
| 6 | +from typing import TYPE_CHECKING, cast |
7 | 7 |
|
8 | 8 | import bv
|
9 | 9 | import numpy as np
|
|
22 | 22 |
|
23 | 23 | if TYPE_CHECKING:
|
24 | 24 | from collections.abc import Iterator
|
25 |
| - from typing import Any |
26 | 25 |
|
27 | 26 | from auto_editor.__main__ import Args
|
28 | 27 |
|
@@ -436,10 +435,12 @@ def get(self, start: int, end: int) -> np.ndarray:
|
436 | 435 | return result # Return NumPy array with shape (channels, samples)
|
437 | 436 |
|
438 | 437 |
|
439 |
| -def _make_new_audio(tl: v3, fmt: bv.AudioFormat, args: Args, log: Log) -> list[Any]: |
| 438 | +def _make_new_audio( |
| 439 | + tl: v3, fmt: bv.AudioFormat, args: Args, log: Log |
| 440 | +) -> list[str | Iterator[AudioFrame]]: |
440 | 441 | sr = tl.sr
|
441 | 442 | tb = tl.tb
|
442 |
| - output: list[Any] = [] |
| 443 | + output: list[str | Iterator[AudioFrame]] = [] |
443 | 444 | samples: dict[tuple[FileInfo, int], Getter] = {}
|
444 | 445 |
|
445 | 446 | norm = parse_norm(args.audio_normalize, log)
|
@@ -511,7 +512,9 @@ def _make_new_audio(tl: v3, fmt: bv.AudioFormat, args: Args, log: Log) -> list[A
|
511 | 512 |
|
512 | 513 | if args.mix_audio_streams and len(output) > 1:
|
513 | 514 | new_a_file = f"{Path(log.temp, 'new_audio.wav')}"
|
514 |
| - mix_audio_files(sr, output, new_a_file) |
| 515 | + # When mix_audio_streams is True, output only contains strings |
| 516 | + audio_paths = cast(list[str], output) |
| 517 | + mix_audio_files(sr, audio_paths, new_a_file) |
515 | 518 | return [new_a_file]
|
516 | 519 |
|
517 | 520 | return output
|
0 commit comments