Add tech acronym to metadata

This commit is contained in:
2026-03-24 18:31:05 +01:00
parent 323dfb72d6
commit c69fc1cbba
2 changed files with 20 additions and 12 deletions

View File

@@ -1,3 +1,17 @@
/**
* @typedef MetadataTerms
* @property {String} papyrus,
* @property {String} author,
* @property {String} title,
* @property {String} edition,
* @property {String} technique,
* @property {String} techniqueAcronym,
* @property {String} pca,
* @property {String} date,
* @property {String} imageAuthor,
* @property {String} license,
* @property {String} copyright
*/
class ManifestMetadata {
papyrus = '';
@@ -5,6 +19,7 @@ class ManifestMetadata {
title = '';
edition = '';
technique = '';
techniqueAcronym = '';
pca = null;
date = '';
imageAuthor = '';
@@ -14,18 +29,7 @@ class ManifestMetadata {
/**
* @todo Maybe this doesn't make any sense??
* @param {
* {papyrus,
* author,
* title,
* edition,
* technique,
* pca,
* date,
* imageAuthor,
* license,
* copyright}
* } metadata
* @param {MetadataTerms} metadata
*/
constructor(metadata) {
this.papyrus = metadata.papyrus ?? this.papyrus;
@@ -35,6 +39,8 @@ class ManifestMetadata {
// There should always be a technique value
// in the metadata param
this.technique = metadata.technique;
// Return the key that corresponds to the technique value
this.techniqueAcronym = metadata.techniqueAcronym.toUpperCase();
this.date = metadata.date ?? this.date;
this.imageAuthor = metadata.imageAuthor ?? this.imageAuthor
this.license = metadata.license ?? this.license;
@@ -52,6 +58,7 @@ class ManifestMetadata {
{label:"Title", value: this.title},
{label:"Reference edition", value: this.edition},
{label:"Technique", value: this.technique},
{label:"Technique acronym", value: this.techniqueAcronym},
{label:"Date (Year)", value: this.date},
{label:"Image Author", value: this.imageAuthor},
{label:"License", value: this.license},

View File

@@ -171,6 +171,7 @@ async function getImageName(name, manifestId) {
function createMetadata(manifest, imgFilename) {
let metadata = parse(imgFilename, manifest.technique);
metadata.technique = TECH_NAMES[manifest.technique];
metadata.techniqueAcronym = manifest.technique;
return new ManifestMetadata(metadata);
}