From b183e866bc771e8f5e143d69dfdee4c37a3440b9 Mon Sep 17 00:00:00 2001 From: Steve Cassidy Date: Wed, 9 Oct 2024 13:24:59 +1100 Subject: [PATCH 1/2] Add option to change the name of the __object__ directory Signed-off-by: Steve Cassidy --- lib/collector.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/collector.js b/lib/collector.js index eab51ff..495d2c5 100644 --- a/lib/collector.js +++ b/lib/collector.js @@ -39,7 +39,6 @@ class CollectionObject { const rocrateOpts = {alwaysAsArray: true, resolveLinks: true}; if (crateDir) { // Load the RO-Crate from the specified directory - console.log("CRATE DIR", crateDir) const metaPath = path.join(crateDir, "ro-crate-metadata.json"); const json = JSON.parse(fs.readFileSync(metaPath)); this.crate = new ROCrate(json, rocrateOpts); @@ -166,6 +165,7 @@ function getOpts(extaOpts) { .option('-d --data-dir ', "Directory of data files with sub directories '/Sound files' (for .wav) and '/Transcripts' (.csv)") .option('-D --debug ', 'Use this in your collector to turn off some behaviour for debugging') .option('-m --multiple', 'Output multiple Objects rather than a single object') + .option('-d --object-dir ', 'Name for the folder containing object metadata, default "__object__"') program.parse(process.argv); return program.opts(); @@ -188,6 +188,7 @@ class Collector { this.repoPath = this.opts.repoPath || "../repo"; this.repoScratch = this.opts.repoScratch || "../scratch"; this.repoName = this.opts.repoName || "repository"; + this.objectDirName = this.opts.objectDir || "__object__"; this.debug = this.opts.debug; if (this.debug == "true") { // Force type coercion this.debug = true; @@ -206,7 +207,8 @@ class Collector { async connect() { this.repo = ocfl.storage({root: this.repoPath, layout: { - extensionName: '000N-path-direct-storage-layout' + extensionName: '000N-path-direct-storage-layout', + suffix: `/${this.objectDirName}`, }}); if (!await fs.pathExists(this.repoPath)) { From fcbc17d5b17c9226a12d92eb45dc2016dd68d384 Mon Sep 17 00:00:00 2001 From: Steve Cassidy Date: Wed, 9 Oct 2024 13:34:39 +1100 Subject: [PATCH 2/2] use -O for the object suffix option --- lib/collector.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/collector.js b/lib/collector.js index 495d2c5..c8a8375 100644 --- a/lib/collector.js +++ b/lib/collector.js @@ -165,7 +165,7 @@ function getOpts(extaOpts) { .option('-d --data-dir ', "Directory of data files with sub directories '/Sound files' (for .wav) and '/Transcripts' (.csv)") .option('-D --debug ', 'Use this in your collector to turn off some behaviour for debugging') .option('-m --multiple', 'Output multiple Objects rather than a single object') - .option('-d --object-dir ', 'Name for the folder containing object metadata, default "__object__"') + .option('-O --object-dir ', 'Name for the folder containing object metadata, default "__object__"') program.parse(process.argv); return program.opts();