Skip to content
Snippets Groups Projects
Commit 26a873fb authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

metadata -> auxdata switchero

parent 793d0440
No related branches found
No related tags found
1 merge request!455Update branch with changes from master
// Extract the archive content listings of a directory and save them to each file's metadata property
// Extract the archive content listings of a directory and save them to each file's auxdata property
"use strict";
......@@ -11,24 +11,24 @@ function inventory_archives(dir_code, filespec, hash) {
return false;
}
var list = filebase.get_list(filespec, FileBase.DETAIL.METADATA );
var list = filebase.get_list(filespec, FileBase.DETAIL.AUXDATA );
for(var i in list) {
var file = list[i];
if(file.metadata !== undefined) {
print(file.vpath + " already has metadata");
if(file.auxdata !== undefined) {
print(file.vpath + " already has auxdata");
continue;
}
var metadata = {};
var auxdata = {};
try {
metadata.archive_contents = Archive(filebase.get_path(file)).list(hash);
auxdata.archive_contents = Archive(filebase.get_path(file)).list(hash);
} catch(e) {
print(file.vpath + " is not a supported archive");
continue;
}
file.metadata = JSON.stringify(metadata);
file.auxdata = JSON.stringify(auxdata);
if(!filebase.update(file.name, file, /* use_diz_always: */false, /* readd_always: */true))
alert("Error updating " + file.vpath);
print(file.vpath + " metadata updated");
print(file.vpath + " auxdata updated");
}
filebase.close();
return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment