Skip to content

Commit

Permalink
Finish todos
Browse files Browse the repository at this point in the history
  • Loading branch information
WyattBlue committed Aug 13, 2023
1 parent 2cea337 commit 2736b8b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
15 changes: 5 additions & 10 deletions auto_editor/formats/final_cut_pro.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
def get_colorspace(src: FileInfo) -> str:
# See: https://developer.apple.com/documentation/professional_video_applications/fcpxml_reference/asset#3686496

if len(src.videos) == 0:
if not src.videos:
return "1-1-1 (Rec. 709)"

s = src.videos[0]
Expand All @@ -41,16 +41,11 @@ def get_colorspace(src: FileInfo) -> str:


def fcp_xml(group_name: str, output: str, tl: v3) -> None:
# TODOs:
# - Allow fractional timebases
# - Don't hardcode stereo audio layout

assert int(tl.tb) == tl.tb

def fraction(val: int) -> str:
if val == 0:
return "0s"
return f"{val}/{tl.tb}s"
return f"{val * tl.tb.denominator}/{tl.tb.numerator}s"

for _, _src in tl.sources.items():
src = _src
Expand Down Expand Up @@ -82,7 +77,7 @@ def fraction(val: int) -> str:
format="r1",
hasAudio="1" if tl.a and tl.a[0] else "0",
audioSources="1",
audioChannels="2",
audioChannels=f"{2 if not src.audios else src.audios[0].channels}",
duration=fraction(tl_dur),
)
SubElement(r2, "media-rep", kind="original-media", src=src.path.resolve().as_uri())
Expand All @@ -96,8 +91,8 @@ def fraction(val: int) -> str:
format="r1",
tcStart="0s",
tcFormat="NDF",
audioLayout="stereo",
audioRate=f"{tl.sr // 1000}k",
audioLayout="mono" if src.audios and src.audios[0].channels == 1 else "stereo",
audioRate="44.1k" if tl.sr == 44100 else "48k",
)
spine = SubElement(sequence, "spine")

Expand Down
1 change: 0 additions & 1 deletion auto_editor/preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def all_cuts(tl: v3, in_len: int) -> list[int]:
tb = tl.tb
oe: list[tuple[int, int]] = []

# TODO: Make offset_end_pairs work on overlapping clips.
for clip in tl.a[0]:
oe.append((clip.offset, clip.offset + clip.dur))

Expand Down

0 comments on commit 2736b8b

Please sign in to comment.