1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Fixing typings after packages update #507

This commit is contained in:
Patrik J. Braun 2023-03-11 14:11:57 +01:00
parent 6a0e06d6f1
commit ab0ac7cf53

View File

@ -204,7 +204,7 @@ export class MetadataLoader {
width: exif.tags.RelatedImageWidth, width: exif.tags.RelatedImageWidth,
height: exif.tags.RelatedImageHeight, height: exif.tags.RelatedImageHeight,
}; };
}else if ( } else if (
exif.tags.ImageWidth && exif.tags.ImageWidth &&
exif.tags.ImageHeight exif.tags.ImageHeight
) { ) {
@ -269,9 +269,9 @@ export class MetadataLoader {
try { try {
// TODO: clean up the three different exif readers, // TODO: clean up the three different exif readers,
// and keep the minimum amount only // and keep the minimum amount only
const exif = ExifReader.load(data); const exif: ExifReader.Tags &ExifReader.XmpTags & ExifReader.IccTags = ExifReader.load(data);
if (exif.Rating) { if (exif.Rating) {
metadata.rating = parseInt(exif.Rating.value, 10) as 0 | 1 | 2 | 3 | 4 | 5; metadata.rating = parseInt(exif.Rating.value as string, 10) as 0 | 1 | 2 | 3 | 4 | 5;
if (metadata.rating < 0) { if (metadata.rating < 0) {
metadata.rating = 0; metadata.rating = 0;
} }
@ -284,7 +284,7 @@ export class MetadataLoader {
if (metadata.keywords === undefined) { if (metadata.keywords === undefined) {
metadata.keywords = []; metadata.keywords = [];
} }
for (const kw of exif.subject.value) { for (const kw of exif.subject.value as ExifReader.XmpTag[]) {
if (metadata.keywords.indexOf(kw.description) === -1) { if (metadata.keywords.indexOf(kw.description) === -1) {
metadata.keywords.push(kw.description); metadata.keywords.push(kw.description);
} }
@ -308,11 +308,9 @@ export class MetadataLoader {
if (Config.Faces.enabled) { if (Config.Faces.enabled) {
const faces: FaceRegion[] = []; const faces: FaceRegion[] = [];
if ( if (
exif.Regions && ((exif.Regions as any)?.value?.RegionList)?.value
exif.Regions.value.RegionList &&
exif.Regions.value.RegionList.value
) { ) {
for (const regionRoot of exif.Regions.value.RegionList for (const regionRoot of (exif.Regions as any).value.RegionList
.value as any[]) { .value as any[]) {
let type; let type;
let name; let name;