Skip to content

Commit 57a861b

Browse files
author
Andrea Barbasso
committed
[CST-22298] change audio transcript and media type metadata keys
1 parent 658af49 commit 57a861b

6 files changed

Lines changed: 43 additions & 43 deletions

File tree

src/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,19 +192,19 @@ describe('EditBitstreamPageComponent', () => {
192192
value: 'Bitstream title',
193193
},
194194
],
195-
'dc.description.audiovideo': [
195+
'dc.type': [
196196
{
197197
value: 'audio',
198198
},
199199
],
200-
'dc.description.audiotranscript': [
200+
'dspace.bitstream.transcript': [
201201
{
202202
value: 'Audio transcript content',
203203
},
204204
],
205-
'dc.description.videodescription': [
205+
'dspace.bitstream.textalternative': [
206206
{
207-
value: 'Video description content',
207+
value: 'Text alternative content',
208208
},
209209
],
210210
},
@@ -283,8 +283,8 @@ describe('EditBitstreamPageComponent', () => {
283283
expect(rawForm.mediaInfoContainer.audioTranscript).toEqual('Audio transcript content');
284284
});
285285

286-
it('should fill in the video description', () => {
287-
expect(rawForm.mediaInfoContainer.videoDescription).toEqual('Video description content');
286+
it('should fill in the text alternative', () => {
287+
expect(rawForm.mediaInfoContainer.videoDescription).toEqual('Text alternative content');
288288
});
289289

290290
it('should select the correct format', () => {

src/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
333333
},
334334
{
335335
label: this.translate.instant('bitstream.edit.form.mediaType.option.audio-video'),
336-
value: 'audiovideo',
336+
value: 'audio+video',
337337
},
338338
],
339339
value: 'neither',
@@ -358,7 +358,7 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
358358
},
359359
{
360360
id: 'mediaType',
361-
value: 'audiovideo',
361+
value: 'audio+video',
362362
},
363363
],
364364
},
@@ -384,7 +384,7 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
384384
},
385385
{
386386
id: 'mediaType',
387-
value: 'audiovideo',
387+
value: 'audio+video',
388388
},
389389
],
390390
},
@@ -664,9 +664,9 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
664664
description: bitstream.firstMetadataValue('dc.description'),
665665
},
666666
mediaInfoContainer: {
667-
mediaType: bitstream.firstMetadataValue('dc.description.audiovideo') ?? 'neither',
668-
audioTranscript: bitstream.firstMetadataValue('dc.description.audiotranscript'),
669-
videoDescription: bitstream.firstMetadataValue('dc.description.videodescription'),
667+
mediaType: bitstream.firstMetadataValue('dc.type') ?? 'neither',
668+
audioTranscript: bitstream.firstMetadataValue('dspace.bitstream.transcript'),
669+
videoDescription: bitstream.firstMetadataValue('dspace.bitstream.textalternative'),
670670
},
671671
formatContainer: {
672672
selectedFormat: this.selectedFormat.shortDescription,
@@ -856,19 +856,19 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
856856
}
857857
const mediaType = rawForm.mediaInfoContainer?.mediaType;
858858
if (isEmpty(mediaType) || mediaType === 'neither') {
859-
delete newMetadata['dc.description.audiovideo'];
859+
delete newMetadata['dc.type'];
860860
} else {
861-
Metadata.setFirstValue(newMetadata, 'dc.description.audiovideo', mediaType);
861+
Metadata.setFirstValue(newMetadata, 'dc.type', mediaType);
862862
}
863863
if (isEmpty(rawForm.mediaInfoContainer?.audioTranscript)) {
864-
delete newMetadata['dc.description.audiotranscript'];
864+
delete newMetadata['dspace.bitstream.transcript'];
865865
} else {
866-
Metadata.setFirstValue(newMetadata, 'dc.description.audiotranscript', rawForm.mediaInfoContainer.audioTranscript);
866+
Metadata.setFirstValue(newMetadata, 'dspace.bitstream.transcript', rawForm.mediaInfoContainer.audioTranscript);
867867
}
868868
if (isEmpty(rawForm.mediaInfoContainer?.videoDescription)) {
869-
delete newMetadata['dc.description.videodescription'];
869+
delete newMetadata['dspace.bitstream.textalternative'];
870870
} else {
871-
Metadata.setFirstValue(newMetadata, 'dc.description.videodescription', rawForm.mediaInfoContainer.videoDescription);
871+
Metadata.setFirstValue(newMetadata, 'dspace.bitstream.textalternative', rawForm.mediaInfoContainer.videoDescription);
872872
}
873873
if (this.isIIIF) {
874874
// It's helpful to remove these metadata elements entirely when the form value is empty.

src/app/shared/file-download-link/file-download-link.component.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,14 @@ describe('FileDownloadLinkComponent', () => {
247247

248248
beforeEach(() => {
249249
bitstream.firstMetadataValue = jasmine.createSpy('firstMetadataValue').and.callFake((key: string) => {
250-
if (key === 'dc.description.audiotranscript') {
250+
if (key === 'dspace.bitstream.transcript') {
251251
return 'Audio transcript text';
252252
}
253-
if (key === 'dc.description.videodescription') {
253+
if (key === 'dspace.bitstream.textalternative') {
254254
return 'Video description text';
255255
}
256-
if (key === 'dc.description.audiovideo') {
257-
return 'audiovideo';
256+
if (key === 'dc.type') {
257+
return 'audio+video';
258258
}
259259
return undefined;
260260
});

src/app/shared/file-download-link/file-download-link.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,24 +188,24 @@ export class FileDownloadLinkComponent implements OnInit {
188188
}
189189

190190
/**
191-
* Audio transcript metadata value (`dc.description.audiotranscript`), if present.
191+
* Audio transcript metadata value (`dspace.bitstream.transcript`), if present.
192192
*/
193193
get audioTranscript(): string {
194-
return this.bitstream?.firstMetadataValue('dc.description.audiotranscript');
194+
return this.bitstream?.firstMetadataValue('dspace.bitstream.transcript');
195195
}
196196

197197
/**
198-
* Video description metadata value (`dc.description.videodescription`), if present.
198+
* Video description metadata value (`dspace.bitstream.textalternative`), if present.
199199
*/
200200
get videoDescription(): string {
201-
return this.bitstream?.firstMetadataValue('dc.description.videodescription');
201+
return this.bitstream?.firstMetadataValue('dspace.bitstream.textalternative');
202202
}
203203

204204
/**
205-
* Media type metadata value (`dc.description.audiovideo`), if present.
205+
* Media type metadata value (`dc.type`), if present.
206206
*/
207207
get mediaType(): string {
208-
return this.bitstream?.firstMetadataValue('dc.description.audiovideo');
208+
return this.bitstream?.firstMetadataValue('dc.type');
209209
}
210210

211211
/**

src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,14 +354,14 @@ describe('SubmissionSectionUploadFileEditComponent test suite', () => {
354354
true,
355355
);
356356

357-
path = 'metadata/dc.description.audiotranscript';
357+
path = 'metadata/dspace.bitstream.transcript';
358358
expect(operationsBuilder.add).toHaveBeenCalledWith(
359359
pathCombiner.getPath([...pathFragment, path]),
360360
[{ value: 'Audio transcript' }],
361361
true,
362362
);
363363

364-
path = 'metadata/dc.description.videodescription';
364+
path = 'metadata/dspace.bitstream.textalternative';
365365
expect(operationsBuilder.add).toHaveBeenCalledWith(
366366
pathCombiner.getPath([...pathFragment, path]),
367367
[{ value: 'Video description' }],
@@ -441,10 +441,10 @@ describe('SubmissionSectionUploadFileEditComponent test suite', () => {
441441
tick();
442442

443443
expect(operationsBuilder.remove).toHaveBeenCalledWith(
444-
pathCombiner.getPath(['files', fileIndex, 'metadata/dc.description.audiotranscript']),
444+
pathCombiner.getPath(['files', fileIndex, 'metadata/dspace.bitstream.transcript']),
445445
);
446446
expect(operationsBuilder.remove).toHaveBeenCalledWith(
447-
pathCombiner.getPath(['files', fileIndex, 'metadata/dc.description.videodescription']),
447+
pathCombiner.getPath(['files', fileIndex, 'metadata/dspace.bitstream.textalternative']),
448448
);
449449
}));
450450
});

src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ implements OnInit, OnDestroy {
255255
onChange(event: DynamicFormControlEvent) {
256256
if (event.model.id === 'name') {
257257
this.setOptions(event.model, event.control);
258-
} else if (event.model.id === 'dc_description_audiovideo') {
258+
} else if (event.model.id === 'dc_type') {
259259
this.hideOrShowAudioVideoMetadata(event.model, event.control);
260260
}
261261
}
@@ -302,15 +302,15 @@ implements OnInit, OnDestroy {
302302
* - `control.value.value` when triggered by a form control change event, or
303303
* - `model.value.value` when evaluated from an already initialized model (e.g. on component init).
304304
*
305-
* @param model - The dynamic form model for the `dc_description_audiovideo` field.
305+
* @param model - The dynamic form model for the `dc_type` field.
306306
* @param control - The reactive form control that emitted the change event (can be `null` during initialization).
307307
*/
308308
hideOrShowAudioVideoMetadata(model: DynamicFormControlModel, control: UntypedFormControl) {
309309
const selectedMediaType = control?.value?.value ?? ((model as DynamicScrollableDropdownModel)?.value as unknown as VocabularyEntry)?.value;
310310
const shouldShowAudioMetadata = selectedMediaType?.toLowerCase().includes('audio');
311311
const shouldShowVideoMetadata = selectedMediaType?.toLowerCase().includes('video');
312-
const audioTranscriptModel: any = this.formBuilderService.findById('dc_description_audiotranscript', this.formModel);
313-
const videoDescriptionModel: any = this.formBuilderService.findById('dc_description_videodescription', this.formModel);
312+
const audioTranscriptModel: any = this.formBuilderService.findById('dspace_bitstream_transcript', this.formModel);
313+
const videoDescriptionModel: any = this.formBuilderService.findById('dspace_bitstream_textalternative', this.formModel);
314314
if (audioTranscriptModel) {
315315
audioTranscriptModel.hidden = !shouldShowAudioMetadata;
316316
}
@@ -325,7 +325,7 @@ implements OnInit, OnDestroy {
325325
ngOnInit() {
326326
if (this.fileData && this.formId) {
327327
this.formModel = this.buildFileEditForm();
328-
const mediaTypeModel: any = this.formBuilderService.findById('dc_description_audiovideo', this.formModel);
328+
const mediaTypeModel: any = this.formBuilderService.findById('dc_type', this.formModel);
329329
if (mediaTypeModel) {
330330
this.hideOrShowAudioVideoMetadata(mediaTypeModel, null);
331331
}
@@ -474,23 +474,23 @@ implements OnInit, OnDestroy {
474474

475475
const mediaTypeValue = this.retrieveValueFromField(formData.mediaType) ?? formData.mediaType;
476476
if (isNotEmpty(mediaTypeValue) && mediaTypeValue !== 'neither') {
477-
this.operationsBuilder.add(this.pathCombiner.getPath([...pathFragment, 'metadata/dc.description.audiovideo']), [{ value: mediaTypeValue }], true);
477+
this.operationsBuilder.add(this.pathCombiner.getPath([...pathFragment, 'metadata/dc.type']), [{ value: mediaTypeValue }], true);
478478
} else {
479-
this.operationsBuilder.remove(this.pathCombiner.getPath([...pathFragment, 'metadata/dc.description.audiovideo']));
479+
this.operationsBuilder.remove(this.pathCombiner.getPath([...pathFragment, 'metadata/dc.type']));
480480
}
481481

482482
const audioTranscriptValue = this.retrieveValueFromField(formData.audioTranscript) ?? formData.audioTranscript;
483483
if (isNotEmpty(audioTranscriptValue)) {
484-
this.operationsBuilder.add(this.pathCombiner.getPath([...pathFragment, 'metadata/dc.description.audiotranscript']), [{ value: audioTranscriptValue }], true);
484+
this.operationsBuilder.add(this.pathCombiner.getPath([...pathFragment, 'metadata/dspace.bitstream.transcript']), [{ value: audioTranscriptValue }], true);
485485
} else {
486-
this.operationsBuilder.remove(this.pathCombiner.getPath([...pathFragment, 'metadata/dc.description.audiotranscript']));
486+
this.operationsBuilder.remove(this.pathCombiner.getPath([...pathFragment, 'metadata/dspace.bitstream.transcript']));
487487
}
488488

489489
const videoDescriptionValue = this.retrieveValueFromField(formData.videoDescription) ?? formData.videoDescription;
490490
if (isNotEmpty(videoDescriptionValue)) {
491-
this.operationsBuilder.add(this.pathCombiner.getPath([...pathFragment, 'metadata/dc.description.videodescription']), [{ value: videoDescriptionValue }], true);
491+
this.operationsBuilder.add(this.pathCombiner.getPath([...pathFragment, 'metadata/dspace.bitstream.textalternative']), [{ value: videoDescriptionValue }], true);
492492
} else {
493-
this.operationsBuilder.remove(this.pathCombiner.getPath([...pathFragment, 'metadata/dc.description.videodescription']));
493+
this.operationsBuilder.remove(this.pathCombiner.getPath([...pathFragment, 'metadata/dspace.bitstream.textalternative']));
494494
}
495495

496496
// collect bitstream metadata

0 commit comments

Comments
 (0)