Skip to content

Commit c1eb247

Browse files
committed
[save-xml] Use pathlib.Path.
1 parent 0e7aef5 commit c1eb247

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

scenedetect/_cli/commands.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -336,15 +336,13 @@ def _save_xml_fcpx(
336336
# TODO: We should calculate duration from the scene list.
337337
duration = context.video_stream.duration
338338
duration = str(duration.get_seconds()) + "s" # TODO: Is float okay here?
339-
# TODO: This should be an absolute path, but the path types between VideoStream impls aren't
340-
# consistent. Need to make a breaking change to the API so that they return pathlib.Path types.
341-
path = context.video_stream.path
339+
path = Path(context.video_stream.path).absolute()
342340
ElementTree.SubElement(
343341
resources,
344342
"asset",
345343
id=ASSET_ID,
346344
name=video_name,
347-
src=path,
345+
src=str(path),
348346
duration=duration,
349347
hasVideo="1",
350348
hasAudio="1", # TODO: Handle case of no audio.
@@ -444,8 +442,8 @@ def _save_xml_fcp(
444442

445443
file_ref = ElementTree.SubElement(clip, "file", id=f"file{i + 1}")
446444
ElementTree.SubElement(file_ref, "name").text = context.video_stream.name
447-
# TODO: Turn this into absolute path, see TODO in the FCPX function for details.
448-
path = context.video_stream.path
445+
path = Path(context.video_stream.path).absolute()
446+
# TODO: Can we just use path.as_uri() here?
449447
ElementTree.SubElement(file_ref, "pathurl").text = f"file://{path}"
450448

451449
media_ref = ElementTree.SubElement(file_ref, "media")

0 commit comments

Comments
 (0)