Page 1 of 1

Folder hierarchy

Posted: Thu Mar 03, 2016 12:06 pm
by mkis
Hello everybody,

could someone help me with a hierarchy problem?

I'll try to describe the situation:

We use a MAM for working on our jobs and storing them in the MAM database
We need to import files into the MAM-jobs via SOAP and a hotfolder.
What I get is a folder named as the jobnumber, and various subfolders with the delivered files.

First I need to check in the MAM database, if there is a job with this jobnumber already, if not create one (all via SOAP in a Switch Script) The trigger for that is the topfolder, so I need the first folder as a switch job.

Then the script in switch should create groups in the MAM database job, in the same structure as the subfolders in the incoming folder After that a switch script create a controlfile for every file to import them in the database via a MAM hotfolder.

So in one hand I need the main folder as a trigger for creating the MAM databasejob via SOAP, the subfolders for creating the jobgroups in this MAM databasejob, but on the other hand that all files for importing them in the databasejob in the belonging jobgroup

The main problem is to get all hierarchy information from the folder structure, but also leave the job folder as it is.
In the "submit hierarchy" the settings for "subfolder-level" has to be "0" and the "attach hierarchy information - subfolder-level" has to be "5".
But this doesn't work :(
I hope, I'd explained that it is clear for you...

Thanks for your help!

Michael

Re: Folder hierarchy

Posted: Thu Mar 03, 2016 3:44 pm
by gabrielp
I'm unfamiliar with most of what you're doing, so for me, I'll need some background. What is MAM? Your the database of your MIS? How does MAM-jobs give you a folder? How are you executing SOAP via a hotfolder?

Re: Folder hierarchy

Posted: Fri Mar 04, 2016 11:10 am
by mkis
Gabriel,

thanks for your reply.
The MAM is our Media Asset Management, where we store all out productionfiles in libraries and jobs
There is a SOAP API to this system and an import hotfolder, that needs a textfile for importing data.
Via SOAP (started from a Switch Script), the jobticket in the MAM is opened.
After that the jobgroups inside the jobticket should be created also via SOAP from the same Switch Script.
Then Switch should create a textfile containing the information, from where files and in which job and jobgroup it should be imported.

So I need all information about the main folder, subfolders and files for the import script in Switch.
The SOAP Calls and Scripts are not the problem.

So the switch workflow will get a folder with subfolders and files to be imported.
The problem is, that the script has to be triggered only once by the incoming jobfolder, but also all information about the subfolders and files are needed for this script.
The "Ungroup Job" is not an option, because it would start the script for every file.

This is very specific case, I'll hope, this is clearer now...

Thanks,
Michael

Re: Folder hierarchy

Posted: Mon Mar 07, 2016 11:17 am
by mkis
Hello,

this is the final code, I use now, if someone need it.
You can call a function from every subfolder inside a jobfolder

Code: Select all

function jobArrived( s : Switch, job : Job ) {
	readDir(job, job.getPath());
}

function readDir(job, path){
	var dir = new Dir( path ),
		 allDirs = dir.entryList("*", Dir.Dirs|Dir.NoDotAndDotDot, Dir.Name);
	
		for (var x = 0; x < allDirs.length; x++) {
			folder = allDirs[x];
			// BEGIN YOUR FUNCTION HERE
			
			// END YOUR FUNCTION HERE
			
			// INTO SUBFOLDERS
			readDir(job, path + "/" + folder);
		}
		//DRINK COFFEE
}
Michael