Skip to content

Commit

Permalink
custom metadata: added metadata_request_only: true
Browse files Browse the repository at this point in the history
  • Loading branch information
martinrode committed Oct 23, 2024
1 parent 40d4bf7 commit 8fe5950
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 29 deletions.
28 changes: 21 additions & 7 deletions fas_config/cookbook_metadata_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@ name: example_metadata
description: recipe to add dummy exmaple metadata
recipes:
example:
class: _metadata
metadata:
- file: "example_metadata.json"
execs:
- service: node
commands:
- prog: node
args:
- "-e"
# read custom_metadata.json (arg 1) and write to example_metadata.json (arg 2)
- "console.error('Current working directory:', process.cwd()); require('fs').createReadStream(process.argv[1]).pipe(require('fs').createWriteStream(process.argv[2]));"
- "%_exec.pluginDir%/fas_config/custom_metadata.json"
- type: file_out
file:
name: "example_metadata.json"
example-request-only:
class: _metadata
metadata:
- file: "example_metadata.json"
Expand All @@ -15,18 +31,16 @@ recipes:
args:
- "-e"
- "require('fs').createReadStream(process.argv[1]).pipe(process.stdout)"
- "%_exec.pluginDir%/fas_config/custom_mapping.json"
- "%_exec.pluginDir%/fas_config/request_only_mapping.json"
execs:
- service: node
commands:
- prog: node
args:
- type: "value"
value: "%_exec.pluginDir%/server/recipe/meta.js"
- type: file_in
file:
name: "source.file"
url: "%_source.url%"
- "-e"
# read request_only_metadata.json (arg 1) and write to example_metadata.json (arg 2)
- "console.error('Current working directory:', process.cwd()); require('fs').createReadStream(process.argv[1]).pipe(require('fs').createWriteStream(process.argv[2]));"
- "%_exec.pluginDir%/fas_config/request_only_metadata.json"
- type: file_out
file:
name: "example_metadata.json"
1 change: 0 additions & 1 deletion fas_config/cookbook_metadata_pdf2text.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ recipes:
fulltext: true
execs:
- service: metadata
extension: "<nils>"
commands:
- prog: java
stdout:
Expand Down
13 changes: 13 additions & 0 deletions fas_config/custom_metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"Zonk": {
"Honk": "henk"
},
"_fulltext": {
"text": ["horst sieht torsten"]
},
"_technical_metadata": {
"huhu": {
"gut": "sieht torsten"
}
}
}
6 changes: 6 additions & 0 deletions fas_config/custom_produce.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ custommetadata:
extensions:
- png
- jpg
- recipename: fylr_example:example_metadata:example-request-only
includeversions: false
metadata_request_only: true
extensions:
- png
- jpg

classes:
image:
Expand Down
File renamed without changes.
23 changes: 2 additions & 21 deletions server/recipe/meta.js → fas_config/request_only_metadata.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
const fs = require('fs');
let fn = ""
if (process.argv.length === 4) {
fn = process.argv[3]
} else {
process.exit(1)
}
fs.writeFileSync(fn, JSON.stringify({
"Zonk": {
"Honk": "henk"
},
{
"plugin-example": {
"chat-gpt": {
"fields": {
Expand Down Expand Up @@ -65,14 +55,5 @@ fs.writeFileSync(fn, JSON.stringify({
},
"timestamp": "2024-10-18T13:15:11+02:00"
}
},
"_fulltext": {
"text": ["horst sieht torsten"]
},
"_technical_metadata": {
"huhu": {
"gut": "sieht torsten"
}
}
}))
console.log("wrote file", fn)
}

0 comments on commit 8fe5950

Please sign in to comment.