Add tech acronym to metadata
This commit is contained in:
@@ -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 {
|
class ManifestMetadata {
|
||||||
papyrus = '';
|
papyrus = '';
|
||||||
@@ -5,6 +19,7 @@ class ManifestMetadata {
|
|||||||
title = '';
|
title = '';
|
||||||
edition = '';
|
edition = '';
|
||||||
technique = '';
|
technique = '';
|
||||||
|
techniqueAcronym = '';
|
||||||
pca = null;
|
pca = null;
|
||||||
date = '';
|
date = '';
|
||||||
imageAuthor = '';
|
imageAuthor = '';
|
||||||
@@ -14,18 +29,7 @@ class ManifestMetadata {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Maybe this doesn't make any sense??
|
* @todo Maybe this doesn't make any sense??
|
||||||
* @param {
|
* @param {MetadataTerms} metadata
|
||||||
* {papyrus,
|
|
||||||
* author,
|
|
||||||
* title,
|
|
||||||
* edition,
|
|
||||||
* technique,
|
|
||||||
* pca,
|
|
||||||
* date,
|
|
||||||
* imageAuthor,
|
|
||||||
* license,
|
|
||||||
* copyright}
|
|
||||||
* } metadata
|
|
||||||
*/
|
*/
|
||||||
constructor(metadata) {
|
constructor(metadata) {
|
||||||
this.papyrus = metadata.papyrus ?? this.papyrus;
|
this.papyrus = metadata.papyrus ?? this.papyrus;
|
||||||
@@ -35,6 +39,8 @@ class ManifestMetadata {
|
|||||||
// There should always be a technique value
|
// There should always be a technique value
|
||||||
// in the metadata param
|
// in the metadata param
|
||||||
this.technique = metadata.technique;
|
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.date = metadata.date ?? this.date;
|
||||||
this.imageAuthor = metadata.imageAuthor ?? this.imageAuthor
|
this.imageAuthor = metadata.imageAuthor ?? this.imageAuthor
|
||||||
this.license = metadata.license ?? this.license;
|
this.license = metadata.license ?? this.license;
|
||||||
@@ -52,6 +58,7 @@ class ManifestMetadata {
|
|||||||
{label:"Title", value: this.title},
|
{label:"Title", value: this.title},
|
||||||
{label:"Reference edition", value: this.edition},
|
{label:"Reference edition", value: this.edition},
|
||||||
{label:"Technique", value: this.technique},
|
{label:"Technique", value: this.technique},
|
||||||
|
{label:"Technique acronym", value: this.techniqueAcronym},
|
||||||
{label:"Date (Year)", value: this.date},
|
{label:"Date (Year)", value: this.date},
|
||||||
{label:"Image Author", value: this.imageAuthor},
|
{label:"Image Author", value: this.imageAuthor},
|
||||||
{label:"License", value: this.license},
|
{label:"License", value: this.license},
|
||||||
|
|||||||
@@ -171,6 +171,7 @@ async function getImageName(name, manifestId) {
|
|||||||
function createMetadata(manifest, imgFilename) {
|
function createMetadata(manifest, imgFilename) {
|
||||||
let metadata = parse(imgFilename, manifest.technique);
|
let metadata = parse(imgFilename, manifest.technique);
|
||||||
metadata.technique = TECH_NAMES[manifest.technique];
|
metadata.technique = TECH_NAMES[manifest.technique];
|
||||||
|
metadata.techniqueAcronym = manifest.technique;
|
||||||
|
|
||||||
return new ManifestMetadata(metadata);
|
return new ManifestMetadata(metadata);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user