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

Deal with rating missing in XMP sidecars

Avoid getting Rating of 0 when rating metadata is not included in a
sidecar.
This commit is contained in:
Martin Kampas 2024-03-01 22:41:29 +01:00
parent e3a0f5967c
commit 8517430a1b
2 changed files with 9 additions and 4 deletions

View File

@ -175,7 +175,10 @@ export class MetadataLoader {
delete (sidecarData as any)['xap'];
}
if ((sidecarData as SideCar).xmp !== undefined) {
if ((sidecarData as SideCar).xmp.Rating !== undefined) {
if (
(sidecarData as SideCar).xmp.Rating !== undefined &&
(sidecarData as SideCar).xmp.Rating > 0
) {
metadata.rating = (sidecarData as SideCar).xmp.Rating;
}
if (
@ -651,7 +654,10 @@ export class MetadataLoader {
delete (sidecarData as any)['xap'];
}
if ((sidecarData as SideCar).xmp !== undefined) {
if ((sidecarData as SideCar).xmp.Rating !== undefined) {
if (
(sidecarData as SideCar).xmp.Rating !== undefined &&
(sidecarData as SideCar).xmp.Rating > 0
) {
metadata.rating = (sidecarData as SideCar).xmp.Rating;
}
if (

View File

@ -10,6 +10,5 @@
"book",
"first",
"second"
],
"rating": 0
]
}