Skip to content

Commit 0001945

Browse files
committed
PD2V: Fix _get_d2v pathlib usage, stem and suffix was mixed up
1 parent 048396b commit 0001945

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pvsfunc/pd2v.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,20 +240,20 @@ def floor(self, cycle: int = None, offsets: List[int] = None):
240240
@staticmethod
241241
def _get_d2v(file_path: Path) -> Path:
242242
"""Demux video track and generate a D2V file for it if needed."""
243-
is_vob = file_path.stem.lower() == ".vob"
244-
d2v_path = file_path.with_stem(".d2v")
243+
is_vob = file_path.suffix.lower() == ".vob"
244+
d2v_path = file_path.with_suffix(".d2v")
245245
if d2v_path.is_file():
246246
print("Skipping generation as a D2V file already exists")
247247
return d2v_path
248248
# demux the mpeg stream if not a .VOB or .MPEG file
249249
demuxed_ext = [".mpeg", ".mpg", ".m2v", ".vob"]
250250
vid_path = file_path
251-
if file_path.stem.lower() in demuxed_ext:
251+
if file_path.suffix.lower() in demuxed_ext:
252252
print("Skipping demuxing of raw MPEG stream as it already exists or is unnecessary")
253253
else:
254-
vid_path = next((x for x in map(file_path.with_stem, demuxed_ext) if x.exists()), None)
254+
vid_path = next((x for x in map(file_path.with_suffix, demuxed_ext) if x.exists()), None)
255255
if not vid_path:
256-
vid_path = file_path.with_stem(demuxed_ext[0])
256+
vid_path = file_path.with_suffix(demuxed_ext[0])
257257
mkvextract_path = shutil.which("mkvextract")
258258
if not mkvextract_path:
259259
raise RuntimeError(

0 commit comments

Comments
 (0)