1- import type { Font , Footage } from 'plainly-types' ;
1+ import type { Font , Footage , MissingFootage } from 'plainly-types' ;
22import { getAllComps , getFolderPath , getTextLayersByComp } from './utils' ;
33
44/**
@@ -20,14 +20,21 @@ function selectFolder(): Folder | string {
2020 * @returns {string|undefined } The name of the collected project folder, or undefined if no project is saved.
2121 */
2222function collectFiles ( ) : string | undefined {
23- const collectedData : { fonts : Font [ ] ; footage : Footage [ ] } = {
23+ const collectedData : {
24+ fonts : Font [ ] ;
25+ footage : Footage [ ] ;
26+ missingFootage : MissingFootage [ ] ;
27+ } = {
2428 fonts : [ ] ,
2529 footage : [ ] ,
30+ missingFootage : [ ] ,
2631 } ;
2732
2833 // collect paths
2934 collectedData . fonts = collectFonts ( ) ;
30- collectedData . footage = collectFootage ( ) ;
35+ const { footage, missingFootage } = collectFootage ( ) ;
36+ collectedData . footage = footage ;
37+ collectedData . missingFootage = missingFootage ;
3138
3239 // return full path
3340 return JSON . stringify ( collectedData ) ;
@@ -61,8 +68,12 @@ function collectFonts(): Font[] {
6168 return Object . values ( fonts ) ;
6269}
6370
64- function collectFootage ( ) : Footage [ ] {
71+ function collectFootage ( ) : {
72+ footage : Footage [ ] ;
73+ missingFootage : MissingFootage [ ] ;
74+ } {
6575 const footage : Footage [ ] = [ ] ;
76+ const missingFootage : MissingFootage [ ] = [ ] ;
6677
6778 // Go through all items in the project
6879 for ( let i = 1 ; i <= app . project . numItems ; i ++ ) {
@@ -74,16 +85,24 @@ function collectFootage(): Footage[] {
7485 // Determine the nested folder structure
7586 const relativePath = getFolderPath ( item . parentFolder ) ;
7687
77- footage . push ( {
78- itemId : item . id ,
79- itemName : item . file ?. name || '' ,
80- itemFsPath : item . file ?. fsName || '' ,
81- itemAeFolder : relativePath ,
82- isMissing : item . footageMissing || item . file === null ,
83- } ) ;
88+ if ( item . footageMissing || item . file === null ) {
89+ missingFootage . push ( {
90+ itemId : item . id ,
91+ itemAeFolder : relativePath ,
92+ isMissing : true ,
93+ } ) ;
94+ } else {
95+ footage . push ( {
96+ itemId : item . id ,
97+ itemName : item . file . name ,
98+ itemFsPath : item . file . fsName ,
99+ itemAeFolder : relativePath ,
100+ isMissing : false ,
101+ } ) ;
102+ }
84103 }
85104
86- return footage ;
105+ return { footage, missingFootage } ;
87106}
88107
89108export { collectFiles , selectFolder } ;
0 commit comments