Test `save-fcp --format fcp7` produces a valid FCP7 xmeml file.
(tmp_path: Path)
| 1376 | |
| 1377 | |
| 1378 | def test_cli_save_fcp_fcp7(tmp_path: Path): |
| 1379 | """Test `save-fcp --format fcp7` produces a valid FCP7 xmeml file.""" |
| 1380 | from xml.etree import ElementTree |
| 1381 | |
| 1382 | exit_code, _ = invoke_cli( |
| 1383 | [ |
| 1384 | "-i", |
| 1385 | DEFAULT_VIDEO_PATH, |
| 1386 | "-o", |
| 1387 | str(tmp_path), |
| 1388 | "time", |
| 1389 | "-s", |
| 1390 | "2s", |
| 1391 | "-d", |
| 1392 | "4s", |
| 1393 | "detect-content", |
| 1394 | "save-fcp", |
| 1395 | "--format", |
| 1396 | "fcp7", |
| 1397 | ] |
| 1398 | ) |
| 1399 | assert exit_code == 0 |
| 1400 | output_path = tmp_path.joinpath(f"{DEFAULT_VIDEO_NAME}.xml") |
| 1401 | assert os.path.exists(output_path) |
| 1402 | |
| 1403 | root = ElementTree.parse(output_path).getroot() |
| 1404 | assert root.tag == "xmeml" |
| 1405 | assert root.attrib["version"] == "5" |
| 1406 | |
| 1407 | # NTSC flag is True for the 23.976 test video. |
| 1408 | ntsc = root.find("project/sequence/rate/ntsc") |
| 1409 | assert ntsc is not None and ntsc.text == "True" |
| 1410 | |
| 1411 | # samplecharacteristics carry width/height so Premiere/DaVinci can ingest. |
| 1412 | width = root.find("project/sequence/media/video/format/samplecharacteristics/width") |
| 1413 | height = root.find("project/sequence/media/video/format/samplecharacteristics/height") |
| 1414 | assert width is not None and width.text == "1280" |
| 1415 | assert height is not None and height.text == "544" |
| 1416 | |
| 1417 | # Two clipitems produced; first carries the full <file> block, rest reference it by id. |
| 1418 | clipitems = root.findall("project/sequence/media/video/track/clipitem") |
| 1419 | assert len(clipitems) == 2 |
| 1420 | |
| 1421 | first_file = clipitems[0].find("file") |
| 1422 | assert first_file is not None |
| 1423 | assert first_file.attrib["id"] == "file1" |
| 1424 | pathurl = first_file.find("pathurl") |
| 1425 | assert pathurl is not None and pathurl.text is not None |
| 1426 | assert pathurl.text.startswith("file://") |
| 1427 | assert pathurl.text.endswith("goldeneye.mp4") |
| 1428 | # Source duration is required for NLEs to seek into the media. |
| 1429 | assert first_file.find("duration") is not None |
| 1430 | |
| 1431 | # Subsequent clipitems reference the same file id without redeclaring. |
| 1432 | second_file = clipitems[1].find("file") |
| 1433 | assert second_file is not None |
| 1434 | assert second_file.attrib["id"] == "file1" |
| 1435 | assert second_file.find("pathurl") is None |
nothing calls this directly
no test coverage detected