Skip to content

Commit

Permalink
Watch option for files find
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Harald - TSA-H committed Jun 3, 2024
1 parent f819f3e commit 8c3054f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
16 changes: 11 additions & 5 deletions files_find/Files Find/bin/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ var sort_order = filterById(o_job["proc_data"]["inputs"], "sort_order")["value"]
console.log("Input sort_order: " + sort_order);
var output_type = filterById(o_job["proc_data"]["inputs"], "output_type")["value"]; //custom date is in hours
console.log("Input output_type: " + output_type);
var use_watchdb = filterById(o_job["proc_data"]["inputs"], "use_watchdb")["value"]; //only output "new" files
console.log("Input use_watchdb: " + use_watchdb);


var skip_size_val = -1
var skip_size_operator = ">";
Expand Down Expand Up @@ -105,8 +108,8 @@ async function main(){

dir_func(root_path, async function (err, files) {

//todo: only do this when lock is enabled
lockWatchDb();
if (use_watchdb)
lockWatchDb();

if (err){
console.log("Error \n" + err + "\n");
Expand Down Expand Up @@ -182,6 +185,11 @@ async function main(){

}

//skip already known files

if (use_watchdb)
all_files = await processWatchDb(all_files);

//output found items count
o_out_count["data"] = all_files.length;

Expand All @@ -191,9 +199,7 @@ async function main(){
//skip sizes
all_files = filter_size(all_files);

//skip already known files

all_files = await processWatchDb(all_files);


//fill single output file output parameters
var o_out_array = filterByTerm(o_job["proc_data"]["outputs"],"output_files");
Expand Down
4 changes: 4 additions & 0 deletions files_find/Files Find/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
<b>Skip Folders/Files</b><br/>
Do not include Folders/Files in output list<br/>
<br/>
<b>Only new Files</b><br/>
If enabled, the processor will remember which files have been already processed in a json file in Processors/db/cache/Files Find/watch_%proc_guid%<br/>
Processed Filenames will be "forgotten" if they are missing for one run in the watchfolder.
<br/>
<b>File Variable</b><br/>
If you provide a user_variable here, like %s_file_list%, it will be populated with the JSON array of found files<br/>
<br/>
Expand Down
2 changes: 1 addition & 1 deletion files_find/Files Find/node.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"description":"Finds and waits for files",
"guid": "512dccee-88e1-45b1-906c-9c8f53724805",
"proc_script":"processor.bat",
"version":"1.6.1"
"version":"1.6.2"
}

0 comments on commit 8c3054f

Please sign in to comment.