Update app.py
Browse files
app.py
CHANGED
|
@@ -116,7 +116,6 @@ def generate_cmx_edl(edl_title, segments, source_name, fps=25):
|
|
| 116 |
def generate_xml(sequence_name, segments, source_name, fps=25):
|
| 117 |
"""Constructs a Hybrid XML compatible with both Premiere and Resolve."""
|
| 118 |
|
| 119 |
-
# Static UUID to ensure linking
|
| 120 |
master_id = "masterfile-1"
|
| 121 |
|
| 122 |
lines = []
|
|
@@ -153,7 +152,6 @@ def generate_xml(sequence_name, segments, source_name, fps=25):
|
|
| 153 |
tl_start = timeline_head_frames
|
| 154 |
tl_end = tl_start + duration_frames
|
| 155 |
|
| 156 |
-
# Truncate clip names for Premiere safety (max 80 chars)
|
| 157 |
raw_note = seg.get('note', 'Junior Editor Selection')
|
| 158 |
clip_note = (raw_note[:75] + '..') if len(raw_note) > 75 else raw_note
|
| 159 |
|
|
@@ -167,24 +165,34 @@ def generate_xml(sequence_name, segments, source_name, fps=25):
|
|
| 167 |
lines.append(f'\t\t\t\t\t<out>{src_out_frames}</out>')
|
| 168 |
lines.append(f'\t\t\t\t\t<masterclipid>{master_id}</masterclipid>')
|
| 169 |
|
| 170 |
-
# ---
|
| 171 |
-
# 1. <pathurl>: Used by Resolve.
|
| 172 |
-
# 2. <
|
| 173 |
-
# 3. NO <media> block: Avoids confusing Resolve.
|
| 174 |
lines.append(f'\t\t\t\t\t<file id="{master_id}">')
|
| 175 |
lines.append(f'\t\t\t\t\t\t<name>{source_name}</name>')
|
| 176 |
lines.append(f'\t\t\t\t\t\t<pathurl>file://localhost/{source_name}.mov</pathurl>')
|
| 177 |
lines.append(f'\t\t\t\t\t\t<rate><timebase>{int(fps)}</timebase></rate>')
|
| 178 |
-
lines.append(f'\t\t\t\t\t\t<duration>8640000</duration>')
|
| 179 |
lines.append(f'\t\t\t\t\t\t<timecode>')
|
| 180 |
lines.append(f'\t\t\t\t\t\t\t<rate><timebase>{int(fps)}</timebase></rate>')
|
| 181 |
lines.append(f'\t\t\t\t\t\t\t<string>00:00:00:00</string>')
|
| 182 |
lines.append(f'\t\t\t\t\t\t\t<frame>0</frame>')
|
| 183 |
lines.append(f'\t\t\t\t\t\t\t<displayformat>NDF</displayformat>')
|
| 184 |
lines.append(f'\t\t\t\t\t\t</timecode>')
|
| 185 |
-
lines.append(f'\t\t\t\t\t</file>')
|
| 186 |
-
# -------------------------------
|
| 187 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 188 |
lines.append(f'\t\t\t\t</clipitem>')
|
| 189 |
|
| 190 |
gap_seconds = seg.get('gap', 0.0)
|
|
|
|
| 116 |
def generate_xml(sequence_name, segments, source_name, fps=25):
|
| 117 |
"""Constructs a Hybrid XML compatible with both Premiere and Resolve."""
|
| 118 |
|
|
|
|
| 119 |
master_id = "masterfile-1"
|
| 120 |
|
| 121 |
lines = []
|
|
|
|
| 152 |
tl_start = timeline_head_frames
|
| 153 |
tl_end = tl_start + duration_frames
|
| 154 |
|
|
|
|
| 155 |
raw_note = seg.get('note', 'Junior Editor Selection')
|
| 156 |
clip_note = (raw_note[:75] + '..') if len(raw_note) > 75 else raw_note
|
| 157 |
|
|
|
|
| 165 |
lines.append(f'\t\t\t\t\t<out>{src_out_frames}</out>')
|
| 166 |
lines.append(f'\t\t\t\t\t<masterclipid>{master_id}</masterclipid>')
|
| 167 |
|
| 168 |
+
# --- UNIVERSAL FILE DEFINITION ---
|
| 169 |
+
# 1. <pathurl>: Used by Resolve to find the file.
|
| 170 |
+
# 2. <media>: Used by Premiere to understand the file structure.
|
|
|
|
| 171 |
lines.append(f'\t\t\t\t\t<file id="{master_id}">')
|
| 172 |
lines.append(f'\t\t\t\t\t\t<name>{source_name}</name>')
|
| 173 |
lines.append(f'\t\t\t\t\t\t<pathurl>file://localhost/{source_name}.mov</pathurl>')
|
| 174 |
lines.append(f'\t\t\t\t\t\t<rate><timebase>{int(fps)}</timebase></rate>')
|
| 175 |
+
lines.append(f'\t\t\t\t\t\t<duration>8640000</duration>')
|
| 176 |
lines.append(f'\t\t\t\t\t\t<timecode>')
|
| 177 |
lines.append(f'\t\t\t\t\t\t\t<rate><timebase>{int(fps)}</timebase></rate>')
|
| 178 |
lines.append(f'\t\t\t\t\t\t\t<string>00:00:00:00</string>')
|
| 179 |
lines.append(f'\t\t\t\t\t\t\t<frame>0</frame>')
|
| 180 |
lines.append(f'\t\t\t\t\t\t\t<displayformat>NDF</displayformat>')
|
| 181 |
lines.append(f'\t\t\t\t\t\t</timecode>')
|
|
|
|
|
|
|
| 182 |
|
| 183 |
+
# --- MEDIA BLOCK (Required by Premiere) ---
|
| 184 |
+
lines.append(f'\t\t\t\t\t\t<media>')
|
| 185 |
+
lines.append(f'\t\t\t\t\t\t\t<video>')
|
| 186 |
+
lines.append(f'\t\t\t\t\t\t\t\t<samplecharacteristics><width>1920</width><height>1080</height></samplecharacteristics>')
|
| 187 |
+
lines.append(f'\t\t\t\t\t\t\t</video>')
|
| 188 |
+
lines.append(f'\t\t\t\t\t\t\t<audio>')
|
| 189 |
+
lines.append(f'\t\t\t\t\t\t\t\t<samplecharacteristics><depth>16</depth><samplerate>48000</samplerate></samplecharacteristics>')
|
| 190 |
+
lines.append(f'\t\t\t\t\t\t\t\t<channelcount>2</channelcount>')
|
| 191 |
+
lines.append(f'\t\t\t\t\t\t\t</audio>')
|
| 192 |
+
lines.append(f'\t\t\t\t\t\t</media>')
|
| 193 |
+
# ------------------------------------------
|
| 194 |
+
|
| 195 |
+
lines.append(f'\t\t\t\t\t</file>')
|
| 196 |
lines.append(f'\t\t\t\t</clipitem>')
|
| 197 |
|
| 198 |
gap_seconds = seg.get('gap', 0.0)
|