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

Added ratings to xmp sidecar support

Added ratings to xmp sidecar support, also added rating to bunny.mp4.xmp and a different rating in IMG_5910.jpg.xmp vs what is in the photo file to test if sidecar is functioning as primary.
This commit is contained in:
Graham Alderson 2023-11-23 11:02:46 +12:00
parent d38830f8be
commit 6db3472ca6
6 changed files with 9 additions and 3 deletions

View File

@ -356,7 +356,7 @@
<xmp:CreatorTool>Adobe Photoshop Lightroom 6.1 (Windows)</xmp:CreatorTool> <xmp:CreatorTool>Adobe Photoshop Lightroom 6.1 (Windows)</xmp:CreatorTool>
<xmp:MetadataDate>2023-09-02T16:18:48+02:00</xmp:MetadataDate> <xmp:MetadataDate>2023-09-02T16:18:48+02:00</xmp:MetadataDate>
<xmp:ModifyDate>2015-07-24T22:45:50</xmp:ModifyDate> <xmp:ModifyDate>2015-07-24T22:45:50</xmp:ModifyDate>
<xmp:Rating>3</xmp:Rating> <xmp:Rating>4</xmp:Rating>
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about='' <rdf:Description rdf:about=''

View File

@ -36,6 +36,7 @@
<xmp:CreateDate>2018-11-17T20:27:31+01:00</xmp:CreateDate> <xmp:CreateDate>2018-11-17T20:27:31+01:00</xmp:CreateDate>
<xmp:MetadataDate>2018-11-17T20:27:31+01:00</xmp:MetadataDate> <xmp:MetadataDate>2018-11-17T20:27:31+01:00</xmp:MetadataDate>
<xmp:ModifyDate>2018-11-17T20:27:31+01:00</xmp:ModifyDate> <xmp:ModifyDate>2018-11-17T20:27:31+01:00</xmp:ModifyDate>
<xmp:Rating>4</xmp:Rating>
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about='' <rdf:Description rdf:about=''

View File

@ -51,6 +51,7 @@ export class MetadataLoader {
const sidecarData = exifr.sidecar(sidecarPath); const sidecarData = exifr.sidecar(sidecarPath);
sidecarData.then((response) => { sidecarData.then((response) => {
metadata.keywords = [(response as any).dc.subject].flat(); metadata.keywords = [(response as any).dc.subject].flat();
metadata.rating = (response as any).xmp.Rating;
}); });
} }
} }
@ -199,6 +200,7 @@ export class MetadataLoader {
const sidecarData = exifr.sidecar(sidecarPath); const sidecarData = exifr.sidecar(sidecarPath);
sidecarData.then((response) => { sidecarData.then((response) => {
metadata.keywords = [(response as any).dc.subject].flat(); metadata.keywords = [(response as any).dc.subject].flat();
metadata.rating = (response as any).xmp.Rating;
}); });
} }
} }

View File

@ -238,7 +238,6 @@ export class ContentWrapper {
} }
ContentWrapper.mapify(cw, m, isSearchResult); ContentWrapper.mapify(cw, m, isSearchResult);
} else if (MediaDTOUtils.isVideo(m)) { } else if (MediaDTOUtils.isVideo(m)) {
delete (m as PhotoDTO).metadata.rating;
delete (m as PhotoDTO).metadata.caption; delete (m as PhotoDTO).metadata.caption;
delete (m as PhotoDTO).metadata.cameraData; delete (m as PhotoDTO).metadata.cameraData;
delete (m as PhotoDTO).metadata.faces; delete (m as PhotoDTO).metadata.faces;

View File

@ -26,8 +26,10 @@ export interface FaceRegion {
box?: FaceRegionBox; // some faces don t have region ass they are coming from keywords box?: FaceRegionBox; // some faces don t have region ass they are coming from keywords
} }
export type RatingTypes = 0 | 1 | 2 | 3 | 4 | 5;
export interface PhotoMetadata extends MediaMetadata { export interface PhotoMetadata extends MediaMetadata {
rating?: 0 | 1 | 2 | 3 | 4 | 5; rating?: RatingTypes;
caption?: string; caption?: string;
keywords?: string[]; keywords?: string[];
cameraData?: CameraMetadata; cameraData?: CameraMetadata;

View File

@ -1,5 +1,6 @@
import {DirectoryPathDTO} from './DirectoryDTO'; import {DirectoryPathDTO} from './DirectoryDTO';
import {MediaDimension, MediaDTO, MediaMetadata} from './MediaDTO'; import {MediaDimension, MediaDTO, MediaMetadata} from './MediaDTO';
import {PositionMetaData, CameraMetadata, RatingTypes} from './PhotoDTO';
export interface VideoDTO extends MediaDTO { export interface VideoDTO extends MediaDTO {
id: number; id: number;
@ -16,4 +17,5 @@ export interface VideoMetadata extends MediaMetadata {
fileSize: number; fileSize: number;
fps: number; fps: number;
keywords?: string[]; keywords?: string[];
rating?: RatingTypes;
} }