A:输出同级文件夹
This commit is contained in:
1 parent
4e9cec2c18
commit
534e281b0e
1 file changed
+6
-13
+6
-13
@@ -1,8 +1,8 @@
|
||||
"""
|
||||
Convert all music under E:\\Music (except E:\\Music\\工具) to AAC (.m4a) using ffmpeg.
|
||||
Outputs are written under E:\\Music\\工具\\TypeChange\\out mirroring the folder
|
||||
structure under SOURCE_ROOT; if two source files map to the same target path,
|
||||
the last one wins and a summary of overwrites is printed at the end.
|
||||
Outputs are written flat into E:\\Music\\工具\\TypeChange\\out; if two source files
|
||||
or existing outputs share the same name, the last one wins and a summary of
|
||||
overwrites is printed at the end.
|
||||
|
||||
Notes:
|
||||
- If the source is already `.m4a`, it is copied as-is by default (no re-encode).
|
||||
@@ -20,7 +20,7 @@ from pathlib import Path
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
|
||||
# Source and destination roots
|
||||
SOURCE_ROOT = Path(r"E:\Music\完成\专辑")
|
||||
SOURCE_ROOT = Path(r"E:\Music")
|
||||
SKIP_ROOT = SOURCE_ROOT / "工具"
|
||||
OUT_ROOT = Path(r"E:\Music\工具\TypeChange\out")
|
||||
|
||||
@@ -108,15 +108,8 @@ def iter_source_files():
|
||||
|
||||
|
||||
def build_output_path(src: Path) -> Path:
|
||||
"""Mirror SOURCE_ROOT folder structure under OUT_ROOT, changing extension to .m4a."""
|
||||
try:
|
||||
relative = src.relative_to(SOURCE_ROOT)
|
||||
except ValueError:
|
||||
try:
|
||||
relative = src.resolve().relative_to(SOURCE_ROOT.resolve())
|
||||
except (OSError, RuntimeError, ValueError):
|
||||
relative = Path(src.name)
|
||||
return OUT_ROOT / relative.with_suffix(".m4a")
|
||||
"""Place all outputs in OUT_ROOT, using only the filename with .m4a extension."""
|
||||
return OUT_ROOT / src.with_suffix(".m4a").name
|
||||
|
||||
|
||||
def find_external_cover_image(src: Path) -> Path | None:
|
||||
|
||||
Reference in new issue
Block a user