Replace use of with_stem + with_suffix to with_name

This commit is contained in:
rlaphoenix 2023-02-10 19:13:31 +00:00
parent 0a5f359217
commit faabfb550c
1 changed files with 16 additions and 14 deletions

View File

@ -74,16 +74,17 @@ def crop(path: Path, aspect: str, letter: bool, offset: int, preview: bool) -> N
if preview: if preview:
out_path = ["-f", "mpegts", "-"] # pipe out_path = ["-f", "mpegts", "-"] # pipe
else: else:
out_path = [str(video_path.with_stem(".".join(filter(bool, [ out_path = [str(video_path.with_name(".".join(filter(bool, [
video_path.stem, video_path.stem,
video_track.language, video_track.language,
"crop", "crop",
str(offset or "") str(offset or ""),
]))).with_suffix({ {
# ffmpeg's MKV muxer does not yet support HDR # ffmpeg's MKV muxer does not yet support HDR
"HEVC": ".h265", "HEVC": "h265",
"AVC": ".h264" "AVC": "h264"
}.get(video_track.commercial_name, ".mp4")))] }.get(video_track.commercial_name, ".mp4")
]))))]
ffmpeg_call = subprocess.Popen([ ffmpeg_call = subprocess.Popen([
executable, "-y", executable, "-y",
@ -143,16 +144,17 @@ def range_(path: Path, full: bool, preview: bool) -> None:
if preview: if preview:
out_path = ["-f", "mpegts", "-"] # pipe out_path = ["-f", "mpegts", "-"] # pipe
else: else:
out_path = [str(video_path.with_stem(".".join(filter(bool, [ out_path = [str(video_path.with_name(".".join(filter(bool, [
video_path.stem, video_path.stem,
video_track.language, video_track.language,
"range", "range",
["limited", "full"][full] ["limited", "full"][full],
]))).with_suffix({ {
# ffmpeg's MKV muxer does not yet support HDR # ffmpeg's MKV muxer does not yet support HDR
"HEVC": ".h265", "HEVC": "h265",
"AVC": ".h264" "AVC": "h264"
}.get(video_track.commercial_name, ".mp4")))] }.get(video_track.commercial_name, ".mp4")
]))))]
ffmpeg_call = subprocess.Popen([ ffmpeg_call = subprocess.Popen([
executable, "-y", executable, "-y",