Skip to content

Commit

Permalink
Add option to use fcp10
Browse files Browse the repository at this point in the history
  • Loading branch information
WyattBlue committed Sep 26, 2024
1 parent 5f80a5e commit aa46fd1
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 12 deletions.
2 changes: 1 addition & 1 deletion auto_editor/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "25.2.0"
__version__ = "25.3.0"
20 changes: 12 additions & 8 deletions auto_editor/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ def parse_export(export: str, log: Log) -> dict[str, Any]:
"default": pAttrs("default"),
"premiere": pAttrs("premiere", name_attr),
"resolve-fcp7": pAttrs("resolve-fcp7", name_attr),
"final-cut-pro": pAttrs("final-cut-pro", name_attr),
"final-cut-pro": pAttrs(
"final-cut-pro", name_attr, pAttr("version", 11, is_int)
),
"resolve": pAttrs("resolve", name_attr),
"shotcut": pAttrs("shotcut"),
"json": pAttrs("json", pAttr("api", 3, is_int)),
Expand Down Expand Up @@ -232,17 +234,19 @@ def edit_media(paths: list[str], ffmpeg: FFmpeg, args: Args, log: Log) -> None:
fcp7_write_xml(export_ops["name"], output, is_resolve, tl, log)
return

if export in ("final-cut-pro", "resolve"):
if export == "final-cut-pro":
from auto_editor.formats.fcp11 import fcp11_write_xml

is_resolve = export.startswith("resolve")

if is_resolve:
from auto_editor.timeline import set_stream_to_0
ver = export_ops["version"]
fcp11_write_xml(export_ops["name"], ver, output, False, tl, log)
return

set_stream_to_0(tl, log)
if export == "resolve":
from auto_editor.formats.fcp11 import fcp11_write_xml
from auto_editor.timeline import set_stream_to_0

fcp11_write_xml(export_ops["name"], output, is_resolve, tl, log)
set_stream_to_0(tl, log)
fcp11_write_xml(export_ops["name"], 10, output, True, tl, log)
return

if export == "shotcut":
Expand Down
11 changes: 9 additions & 2 deletions auto_editor/formats/fcp11.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def make_name(src: FileInfo, tb: Fraction) -> str:


def fcp11_write_xml(
group_name: str, output: str, resolve: bool, tl: v3, log: Log
group_name: str, version: int, output: str, resolve: bool, tl: v3, log: Log
) -> None:
def fraction(val: int) -> str:
if val == 0:
Expand All @@ -66,7 +66,14 @@ def fraction(val: int) -> str:
src_dur = int(src.duration * tl.tb)
tl_dur = src_dur if resolve else tl.out_len()

fcpxml = Element("fcpxml", version="1.10" if resolve else "1.11")
if version == 11:
ver_str = "1.11"
elif version == 10:
ver_str = "1.10"
else:
log.error(f"Unknown final cut pro version: {version}")

fcpxml = Element("fcpxml", version=ver_str)
resources = SubElement(fcpxml, "resources")

for i, one_src in enumerate(tl.unique_sources()):
Expand Down
3 changes: 2 additions & 1 deletion auto_editor/subcommands/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@ def export():
test_file = f"resources/{test_name}"
results.add(run.main([test_file], []))
run.main([test_file], ["--edit", "none"])
results.add(run.main([test_file], ["-exf"]))
results.add(run.main([test_file], ["--export", "final-cut-pro:version=10"]))
results.add(run.main([test_file], ["--export", "final-cut-pro:version=11"]))
results.add(run.main([test_file], ["-exs"]))
results.add(run.main([test_file], ["--export_as_clip_sequence"]))
run.main([test_file], ["--stats"])
Expand Down
11 changes: 11 additions & 0 deletions changelogs/2024.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# 25.3.0

## Features
- Add `-dn` option. Allows data streams to be dropped from final output.
- Allow using older version of final cut pro. Example: `--export final-cut-pro:version=10`
## Fixes
- Add file "last modified time" to cache string. Fixes #536

**Full Changelog**: https:/WyattBlue/auto-editor/compare/25.2.0...25.3.0


# 25.2.0

## Features
Expand Down

0 comments on commit aa46fd1

Please sign in to comment.