Skip to content

Commit

Permalink
Format with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
WyattBlue committed Jan 11, 2025
1 parent e12a6a9 commit 4c5f55b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions auto_editor/formats/fcp11.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def fraction(val: int) -> str:
SubElement(
resources,
"format",
id=f"r{i*2+1}",
id=f"r{i * 2 + 1}",
name=make_name(one_src, tl.tb),
frameDuration=fraction(1),
width=f"{tl.res[0]}",
Expand All @@ -90,11 +90,11 @@ def fraction(val: int) -> str:
r2 = SubElement(
resources,
"asset",
id=f"r{i*2+2}",
id=f"r{i * 2 + 2}",
name=one_src.path.stem,
start="0s",
hasVideo="1" if one_src.videos else "0",
format=f"r{i*2+1}",
format=f"r{i * 2 + 1}",
hasAudio="1" if one_src.audios else "0",
audioSources="1",
audioChannels=f"{2 if not one_src.audios else one_src.audios[0].channels}",
Expand Down
8 changes: 4 additions & 4 deletions auto_editor/formats/fcp7.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ def fcp7_write_xml(name: str, output: str, resolve: bool, tl: v3) -> None:
file_defs: set[str] = set() # Contains urls

for src in set(tl.sources):
the_id = f"file-{len(src_to_id)+1}"
the_id = f"file-{len(src_to_id) + 1}"
src_to_url[src] = f"{src.path.resolve()}"
src_to_id[src] = the_id

Expand Down Expand Up @@ -541,7 +541,7 @@ def make_filedef(clipitem: Element, src: FileInfo) -> None:
_in = f"{clip.offset}"
_out = f"{clip.offset + clip.dur}"

this_clipid = f"clipitem-{j+1}"
this_clipid = f"clipitem-{j + 1}"
clipitem = ET.SubElement(track, "clipitem", id=this_clipid)
ET.SubElement(clipitem, "name").text = src.path.stem
ET.SubElement(clipitem, "enabled").text = "TRUE"
Expand All @@ -562,14 +562,14 @@ def make_filedef(clipitem: Element, src: FileInfo) -> None:
link = ET.SubElement(clipitem, "link")
ET.SubElement(
link, "linkclipref"
).text = f"clipitem-{(len(tl.v[0]))+j+1}"
).text = f"clipitem-{(len(tl.v[0])) + j + 1}"
continue

for i in range(1 + len(src.audios) * 2): # `2` because stereo.
link = ET.SubElement(clipitem, "link")
ET.SubElement(
link, "linkclipref"
).text = f"clipitem-{(i*(len(tl.v[0])))+j+1}"
).text = f"clipitem-{(i * (len(tl.v[0]))) + j + 1}"
ET.SubElement(link, "mediatype").text = "video" if i == 0 else "audio"
ET.SubElement(link, "trackindex").text = f"{max(i, 1)}"
ET.SubElement(link, "clipindex").text = f"{j + 1}"
Expand Down
6 changes: 3 additions & 3 deletions auto_editor/render/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def apply_audio_normalization(
) -> None:
if norm["tag"] == "ebu":
first_pass = (
f"i={norm['i']}:lra={norm['lra']}:tp={norm['tp']}:" f"offset={norm['gain']}"
f"i={norm['i']}:lra={norm['lra']}:tp={norm['tp']}:offset={norm['gain']}"
)
log.debug(f"audio norm first pass: {first_pass}")
with av.open(f"{pre_master}") as container:
Expand Down Expand Up @@ -167,10 +167,10 @@ def process_audio_clip(
if clip.speed != 1:
if clip.speed > 10_000:
for _ in range(3):
args.append(graph.add("atempo", f"{clip.speed ** (1/3)}"))
args.append(graph.add("atempo", f"{clip.speed ** (1 / 3)}"))
elif clip.speed > 100:
for _ in range(2):
args.append(graph.add("atempo", f"{clip.speed ** 0.5}"))
args.append(graph.add("atempo", f"{clip.speed**0.5}"))
elif clip.speed >= 0.5:
args.append(graph.add("atempo", f"{clip.speed}"))
else:
Expand Down

0 comments on commit 4c5f55b

Please sign in to comment.