Generate manifest label

This commit is contained in:
Nicolò P 2023-10-17 16:02:11 +02:00
parent 3250b4a0f6
commit e9e299d845
2 changed files with 11 additions and 2 deletions

View File

@ -13,6 +13,7 @@ export default async function generateManifest(manifestId) {
let manifest = new Manifest(IIIF_API_VERSION, BASE_URL);
manifest.generateID(manifestId);
manifest.generateLabel();
manifest = await Common.populateCanvases(
manifest,

View File

@ -5,7 +5,8 @@ import Sequence from "./Sequence.js";
*/
class Manifest {
id = '';
type = 'sc:Manifest';
_type = 'sc:Manifest';
_label = '';
resourceId = '';
/**
* @var {Sequence[]}
@ -29,6 +30,12 @@ class Manifest {
this.id = `${this.BASE_URL}/${resourceId}/manifest` ;
this.resourceId = resourceId;
}
/**
* Create IIIF label for this manifest
*/
generateLabel() {
this._label = `P.Herc. ${this.resourceId.split('-')[1]}`;
}
/**
* Object representation of this
* manifest
@ -40,7 +47,8 @@ class Manifest {
return {
"@context" : this.context,
"@id" : this.id,
"@type" : this.type,
"@type" : this._type,
label : this._label,
sequences: this.sequences,
}
}