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:
parent
e3a0f5967c
commit
8517430a1b
@ -175,7 +175,10 @@ export class MetadataLoader {
|
|||||||
delete (sidecarData as any)['xap'];
|
delete (sidecarData as any)['xap'];
|
||||||
}
|
}
|
||||||
if ((sidecarData as SideCar).xmp !== undefined) {
|
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;
|
metadata.rating = (sidecarData as SideCar).xmp.Rating;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
@ -651,7 +654,10 @@ export class MetadataLoader {
|
|||||||
delete (sidecarData as any)['xap'];
|
delete (sidecarData as any)['xap'];
|
||||||
}
|
}
|
||||||
if ((sidecarData as SideCar).xmp !== undefined) {
|
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;
|
metadata.rating = (sidecarData as SideCar).xmp.Rating;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
@ -10,6 +10,5 @@
|
|||||||
"book",
|
"book",
|
||||||
"first",
|
"first",
|
||||||
"second"
|
"second"
|
||||||
],
|
]
|
||||||
"rating": 0
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user