Referencing image sequence filenames from ae script

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
futurestack
Posts: 6
Joined: April 21st, 2008, 8:35 am

Specifically what I'm trying to do is this: I have some heinous renders and we are doing multiple machine rendering. Let's say one of the machine glitches and I have a large number of bad frames. It would be faster to identify them by hand than to rerender the whole thing. So here is my plan:

1 ) bring an image sequence into a new comp.
2 ) scrub through the image sequence and add markers
3 ) have AE delete marked frames from the footage directory
4 ) fix the error and rerender the missing frames to the footage dir

I've accomplished this with a couple of hacks. It requires the target layer to be selected and to have markers. my method is to create an empty text layer, and add an expression with timeToFrames onto the sourceText property. I loop through the markers and use the timeToFrames layer to populate the list of frame #'s. I then move up the footage tree to obtain the source name. I chop up the source name to remove existing number and image suffix, then use that plus the text layer sourceText to construct all the relevant filenames.

The 2 things I can't figure out:

a) how to avoid "hard coding" the starting frame # in the script (my sequence starts at mySeq_[00447-04210]) for example. I think this could be detected with some serious regex skill but I'm not up to it. To make things worse, we usually have numerical dates in our filenames so it'd be more like mySeq_111208_00447.png

b) how to loop through the folder and delete the named files in a script. I've already gotten it working in a hacky way by outputting a huge boolean search string:

Code: Select all

titles_111008_00448.png OR titles_111008_00643.png OR titles_111008_00644.png ...
which I can then feed into spotlight and delete the files, which is slow and involves an extra step. Not to mention spotlight is not the most reliable technology. Any clues on how to do this in jsx?

If I can get this fixed up and reliable I'll add error checking and all the nice stuff and post it.

Regards,
Andrew
futurestack
Posts: 6
Joined: April 21st, 2008, 8:35 am

ok I've got the file deletion code working. this is incredibly slow, especially with large image sequences because it's just brute force matching. I'm sure there's a more elegant method but I'm just happy to have results atm.

Code: Select all

	var targetFolder = new Folder(targetFolderPath);
	var theFiles = targetFolder.getFiles();
	var removedNum = 0;

	$.write("About to search for "+framesToRemove.length+" frames.\n");
	for( var i = 0 ; i < framesToRemove.length; i++ )
	{
		var matched= false;
		$.write("Attempting to remove:"+framesToRemove[i]+"\n");

		for(  var j = 0; j < theFiles.length; j ++)
		{
			var compareFileName  = theFiles[j].name.toString();
			var compareListName = framesToRemove[i].toString();
			if( compareFileName == compareListName )
			{
				var  f  = theFiles[j];//= new File();//targetFolder.Files[i];
				$.write("MATCH:"+compareFileName+"|"+compareListName+"\n");
				++removedNum;
				f.rename("deleted_"+f.displayName);
                                /*f.remove(); */ //option to delete, this should be a gui option later

				matched = true;
				var theFiles = targetFolder.getFiles();// not sure if this is necessary since we're progressing upward from 0...
			}
		}	
		$.write("Did not match."\n");
}
Post Reply