mirror of
https://github.com/bpatrik/pigallery2.git
synced 2024-12-23 01:27:14 +02:00
Merge pull request #839 from kagahd/issue838
bug fixes of both issues of #838
This commit is contained in:
commit
3ec3b5a030
@ -127,7 +127,7 @@ export class MetadataLoader {
|
||||
|
||||
try {
|
||||
// search for sidecar and merge metadata
|
||||
const fullPathWithoutExt = path.parse(fullPath).name;
|
||||
const fullPathWithoutExt = path.join(path.parse(fullPath).dir, path.parse(fullPath).name);
|
||||
const sidecarPaths = [
|
||||
fullPath + '.xmp',
|
||||
fullPath + '.XMP',
|
||||
@ -143,7 +143,11 @@ export class MetadataLoader {
|
||||
if (metadata.keywords === undefined) {
|
||||
metadata.keywords = [];
|
||||
}
|
||||
for (const kw of (sidecarData as SideCar).dc.subject) {
|
||||
let keywords = (sidecarData as SideCar).dc.subject || [];
|
||||
if (typeof keywords === 'string') {
|
||||
keywords = [keywords];
|
||||
}
|
||||
for (const kw of keywords) {
|
||||
if (metadata.keywords.indexOf(kw) === -1) {
|
||||
metadata.keywords.push(kw);
|
||||
}
|
||||
@ -606,7 +610,7 @@ export class MetadataLoader {
|
||||
|
||||
try {
|
||||
// search for sidecar and merge metadata
|
||||
const fullPathWithoutExt = path.parse(fullPath).name;
|
||||
const fullPathWithoutExt = path.join(path.parse(fullPath).dir, path.parse(fullPath).name);
|
||||
const sidecarPaths = [
|
||||
fullPath + '.xmp',
|
||||
fullPath + '.XMP',
|
||||
@ -623,7 +627,11 @@ export class MetadataLoader {
|
||||
if (metadata.keywords === undefined) {
|
||||
metadata.keywords = [];
|
||||
}
|
||||
for (const kw of (sidecarData as SideCar).dc.subject) {
|
||||
let keywords = (sidecarData as SideCar).dc.subject || [];
|
||||
if (typeof keywords === 'string') {
|
||||
keywords = [keywords];
|
||||
}
|
||||
for (const kw of keywords) {
|
||||
if (metadata.keywords.indexOf(kw) === -1) {
|
||||
metadata.keywords.push(kw);
|
||||
}
|
||||
@ -632,6 +640,9 @@ export class MetadataLoader {
|
||||
if ((sidecarData as SideCar).xmp.Rating !== undefined) {
|
||||
metadata.rating = (sidecarData as SideCar).xmp.Rating;
|
||||
}
|
||||
if ((sidecarData as SideCar).xmp.CreateDate) {
|
||||
metadata.creationDate = timestampToMS((sidecarData as SideCar).xmp.CreateDate, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ export interface SideCarDc {
|
||||
|
||||
export interface SideCarXmp {
|
||||
Rating?: RatingTypes;
|
||||
CreateDate?: string;
|
||||
}
|
||||
|
||||
export const MediaDTOUtils = {
|
||||
|
BIN
test/backend/assets/sidecar/bunny_1sec.mp4
Normal file
BIN
test/backend/assets/sidecar/bunny_1sec.mp4
Normal file
Binary file not shown.
16
test/backend/assets/sidecar/bunny_1sec.mp4.json
Normal file
16
test/backend/assets/sidecar/bunny_1sec.mp4.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"size": {
|
||||
"width": 640,
|
||||
"height": 360
|
||||
},
|
||||
"bitRate": 1794127,
|
||||
"duration": 290,
|
||||
"creationDate": 1709052692000,
|
||||
"fileSize": 65073,
|
||||
"fps": 40000,
|
||||
"keywords": [
|
||||
"rabbit",
|
||||
"test"
|
||||
],
|
||||
"rating": 4
|
||||
}
|
119
test/backend/assets/sidecar/bunny_1sec.mp4.xmp
Normal file
119
test/backend/assets/sidecar/bunny_1sec.mp4.xmp
Normal file
@ -0,0 +1,119 @@
|
||||
<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
|
||||
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 12.69'>
|
||||
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:Iptc4xmpExt='http://iptc.org/std/Iptc4xmpExt/2008-02-29/'>
|
||||
<Iptc4xmpExt:audioBitsPerSample>16</Iptc4xmpExt:audioBitsPerSample>
|
||||
</rdf:Description>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:LImage='http://ns.leiainc.com/photos/1.0/image/'>
|
||||
<LImage:MinorVersion>0.0.0</LImage:MinorVersion>
|
||||
</rdf:Description>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:dc='http://purl.org/dc/elements/1.1/'>
|
||||
<dc:format>H.264</dc:format>
|
||||
<dc:subject>
|
||||
<rdf:Bag>
|
||||
<rdf:li>rabbit</rdf:li>
|
||||
<rdf:li>test</rdf:li>
|
||||
</rdf:Bag>
|
||||
</dc:subject>
|
||||
</rdf:Description>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:tiff='http://ns.adobe.com/tiff/1.0/'>
|
||||
<tiff:ImageLength>480</tiff:ImageLength>
|
||||
<tiff:ImageWidth>852</tiff:ImageWidth>
|
||||
<tiff:XResolution>72/1</tiff:XResolution>
|
||||
<tiff:YResolution>72/1</tiff:YResolution>
|
||||
</rdf:Description>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:xmp='http://ns.adobe.com/xap/1.0/'>
|
||||
<xmp:CreateDate>2018-11-17T20:27:31+01:00</xmp:CreateDate>
|
||||
<xmp:MetadataDate>2018-11-17T20:27:31+01:00</xmp:MetadataDate>
|
||||
<xmp:ModifyDate>2018-11-17T20:27:31+01:00</xmp:ModifyDate>
|
||||
<xmp:Rating>4</xmp:Rating>
|
||||
</rdf:Description>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:stDim='http://ns.adobe.com/xap/1.0/sType/Dimensions#'
|
||||
xmlns:xmpDM='http://ns.adobe.com/xmp/1.0/DynamicMedia/'>
|
||||
<xmpDM:altTimecode rdf:parseType='Resource'>
|
||||
<xmpDM:timeFormat>25Timecode</xmpDM:timeFormat>
|
||||
<xmpDM:timeValue>00:00:00:00</xmpDM:timeValue>
|
||||
</xmpDM:altTimecode>
|
||||
<xmpDM:audioChannelType>Stereo</xmpDM:audioChannelType>
|
||||
<xmpDM:audioSampleRate>48000</xmpDM:audioSampleRate>
|
||||
<xmpDM:audioSampleType>16Int</xmpDM:audioSampleType>
|
||||
<xmpDM:duration rdf:parseType='Resource'>
|
||||
<xmpDM:scale>1/90000</xmpDM:scale>
|
||||
<xmpDM:value>2928000</xmpDM:value>
|
||||
</xmpDM:duration>
|
||||
<xmpDM:startTimeSampleSize>1</xmpDM:startTimeSampleSize>
|
||||
<xmpDM:startTimeScale>25</xmpDM:startTimeScale>
|
||||
<xmpDM:startTimecode rdf:parseType='Resource'>
|
||||
<xmpDM:timeFormat>25Timecode</xmpDM:timeFormat>
|
||||
<xmpDM:timeValue>00:00:00:00</xmpDM:timeValue>
|
||||
</xmpDM:startTimecode>
|
||||
<xmpDM:videoFieldOrder>Progressive</xmpDM:videoFieldOrder>
|
||||
<xmpDM:videoFrameRate>25.000000</xmpDM:videoFrameRate>
|
||||
<xmpDM:videoFrameSize rdf:parseType='Resource'>
|
||||
<stDim:h>480</stDim:h>
|
||||
<stDim:unit>pixel</stDim:unit>
|
||||
<stDim:w>852</stDim:w>
|
||||
</xmpDM:videoFrameSize>
|
||||
<xmpDM:videoPixelAspectRatio>1/1</xmpDM:videoPixelAspectRatio>
|
||||
</rdf:Description>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:stEvt='http://ns.adobe.com/xap/1.0/sType/ResourceEvent#'
|
||||
xmlns:stRef='http://ns.adobe.com/xap/1.0/sType/ResourceRef#'
|
||||
xmlns:xmpMM='http://ns.adobe.com/xap/1.0/mm/'>
|
||||
<xmpMM:DerivedFrom rdf:parseType='Resource'>
|
||||
<stRef:documentID>d47681ee-e57e-2256-f455-43c40000004b</stRef:documentID>
|
||||
<stRef:instanceID>2a5a623f-09cc-ea32-5014-869400000078</stRef:instanceID>
|
||||
<stRef:originalDocumentID>xmp.did:5af8e6dd-2af0-e94e-8f3c-767794b3efa1</stRef:originalDocumentID>
|
||||
</xmpMM:DerivedFrom>
|
||||
<xmpMM:DocumentID>b2c5763f-bfb9-7ee1-6893-05220000004b</xmpMM:DocumentID>
|
||||
<xmpMM:History>
|
||||
<rdf:Seq>
|
||||
<rdf:li rdf:parseType='Resource'>
|
||||
<stEvt:action>saved</stEvt:action>
|
||||
<stEvt:changed>/</stEvt:changed>
|
||||
<stEvt:instanceID>63c4c09c-9648-ee43-720e-644600000078</stEvt:instanceID>
|
||||
<stEvt:softwareAgent>Adobe Adobe Media Encoder CC 2017.1 (Windows)</stEvt:softwareAgent>
|
||||
<stEvt:when>2018-11-17T20:27:31+01:00</stEvt:when>
|
||||
</rdf:li>
|
||||
<rdf:li rdf:parseType='Resource'>
|
||||
<stEvt:action>saved</stEvt:action>
|
||||
<stEvt:changed>/</stEvt:changed>
|
||||
<stEvt:instanceID>2a5a623f-09cc-ea32-5014-869400000078</stEvt:instanceID>
|
||||
<stEvt:softwareAgent>Adobe Adobe Media Encoder CC 2017.1 (Windows)</stEvt:softwareAgent>
|
||||
<stEvt:when>2018-11-17T20:26:54+01:00</stEvt:when>
|
||||
</rdf:li>
|
||||
<rdf:li rdf:parseType='Resource'>
|
||||
<stEvt:action>saved</stEvt:action>
|
||||
<stEvt:changed>/</stEvt:changed>
|
||||
<stEvt:instanceID>xmp.iid:6e43712c-17f5-cc4c-b90d-766dca2590dc</stEvt:instanceID>
|
||||
<stEvt:softwareAgent>Adobe Adobe Media Encoder CC 2017.1 (Windows)</stEvt:softwareAgent>
|
||||
<stEvt:when>2018-11-17T20:27:31+01:00</stEvt:when>
|
||||
</rdf:li>
|
||||
<rdf:li rdf:parseType='Resource'>
|
||||
<stEvt:action>saved</stEvt:action>
|
||||
<stEvt:changed>/metadata</stEvt:changed>
|
||||
<stEvt:instanceID>xmp.iid:4d4376d3-c650-354b-b4eb-0fc2d21bcaa4</stEvt:instanceID>
|
||||
<stEvt:softwareAgent>Adobe Adobe Media Encoder CC 2017.1 (Windows)</stEvt:softwareAgent>
|
||||
<stEvt:when>2018-11-17T20:27:31+01:00</stEvt:when>
|
||||
</rdf:li>
|
||||
</rdf:Seq>
|
||||
</xmpMM:History>
|
||||
<xmpMM:InstanceID>xmp.iid:4d4376d3-c650-354b-b4eb-0fc2d21bcaa4</xmpMM:InstanceID>
|
||||
<xmpMM:OriginalDocumentID>xmp.did:1aa2d671-bf82-2043-9053-ec864079866c</xmpMM:OriginalDocumentID>
|
||||
</rdf:Description>
|
||||
</rdf:RDF>
|
||||
</x:xmpmeta>
|
||||
<?xpacket end='w'?>
|
BIN
test/backend/assets/sidecar/bunny_1sec_v2.mp4
Normal file
BIN
test/backend/assets/sidecar/bunny_1sec_v2.mp4
Normal file
Binary file not shown.
119
test/backend/assets/sidecar/bunny_1sec_v2.xmp
Normal file
119
test/backend/assets/sidecar/bunny_1sec_v2.xmp
Normal file
@ -0,0 +1,119 @@
|
||||
<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
|
||||
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 12.69'>
|
||||
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:Iptc4xmpExt='http://iptc.org/std/Iptc4xmpExt/2008-02-29/'>
|
||||
<Iptc4xmpExt:audioBitsPerSample>16</Iptc4xmpExt:audioBitsPerSample>
|
||||
</rdf:Description>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:LImage='http://ns.leiainc.com/photos/1.0/image/'>
|
||||
<LImage:MinorVersion>0.0.0</LImage:MinorVersion>
|
||||
</rdf:Description>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:dc='http://purl.org/dc/elements/1.1/'>
|
||||
<dc:format>H.264</dc:format>
|
||||
<dc:subject>
|
||||
<rdf:Bag>
|
||||
<rdf:li>rabbit</rdf:li>
|
||||
<rdf:li>test</rdf:li>
|
||||
</rdf:Bag>
|
||||
</dc:subject>
|
||||
</rdf:Description>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:tiff='http://ns.adobe.com/tiff/1.0/'>
|
||||
<tiff:ImageLength>480</tiff:ImageLength>
|
||||
<tiff:ImageWidth>852</tiff:ImageWidth>
|
||||
<tiff:XResolution>72/1</tiff:XResolution>
|
||||
<tiff:YResolution>72/1</tiff:YResolution>
|
||||
</rdf:Description>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:xmp='http://ns.adobe.com/xap/1.0/'>
|
||||
<xmp:CreateDate>2018-11-17T20:27:31+01:00</xmp:CreateDate>
|
||||
<xmp:MetadataDate>2018-11-17T20:27:31+01:00</xmp:MetadataDate>
|
||||
<xmp:ModifyDate>2018-11-17T20:27:31+01:00</xmp:ModifyDate>
|
||||
<xmp:Rating>4</xmp:Rating>
|
||||
</rdf:Description>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:stDim='http://ns.adobe.com/xap/1.0/sType/Dimensions#'
|
||||
xmlns:xmpDM='http://ns.adobe.com/xmp/1.0/DynamicMedia/'>
|
||||
<xmpDM:altTimecode rdf:parseType='Resource'>
|
||||
<xmpDM:timeFormat>25Timecode</xmpDM:timeFormat>
|
||||
<xmpDM:timeValue>00:00:00:00</xmpDM:timeValue>
|
||||
</xmpDM:altTimecode>
|
||||
<xmpDM:audioChannelType>Stereo</xmpDM:audioChannelType>
|
||||
<xmpDM:audioSampleRate>48000</xmpDM:audioSampleRate>
|
||||
<xmpDM:audioSampleType>16Int</xmpDM:audioSampleType>
|
||||
<xmpDM:duration rdf:parseType='Resource'>
|
||||
<xmpDM:scale>1/90000</xmpDM:scale>
|
||||
<xmpDM:value>2928000</xmpDM:value>
|
||||
</xmpDM:duration>
|
||||
<xmpDM:startTimeSampleSize>1</xmpDM:startTimeSampleSize>
|
||||
<xmpDM:startTimeScale>25</xmpDM:startTimeScale>
|
||||
<xmpDM:startTimecode rdf:parseType='Resource'>
|
||||
<xmpDM:timeFormat>25Timecode</xmpDM:timeFormat>
|
||||
<xmpDM:timeValue>00:00:00:00</xmpDM:timeValue>
|
||||
</xmpDM:startTimecode>
|
||||
<xmpDM:videoFieldOrder>Progressive</xmpDM:videoFieldOrder>
|
||||
<xmpDM:videoFrameRate>25.000000</xmpDM:videoFrameRate>
|
||||
<xmpDM:videoFrameSize rdf:parseType='Resource'>
|
||||
<stDim:h>480</stDim:h>
|
||||
<stDim:unit>pixel</stDim:unit>
|
||||
<stDim:w>852</stDim:w>
|
||||
</xmpDM:videoFrameSize>
|
||||
<xmpDM:videoPixelAspectRatio>1/1</xmpDM:videoPixelAspectRatio>
|
||||
</rdf:Description>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:stEvt='http://ns.adobe.com/xap/1.0/sType/ResourceEvent#'
|
||||
xmlns:stRef='http://ns.adobe.com/xap/1.0/sType/ResourceRef#'
|
||||
xmlns:xmpMM='http://ns.adobe.com/xap/1.0/mm/'>
|
||||
<xmpMM:DerivedFrom rdf:parseType='Resource'>
|
||||
<stRef:documentID>d47681ee-e57e-2256-f455-43c40000004b</stRef:documentID>
|
||||
<stRef:instanceID>2a5a623f-09cc-ea32-5014-869400000078</stRef:instanceID>
|
||||
<stRef:originalDocumentID>xmp.did:5af8e6dd-2af0-e94e-8f3c-767794b3efa1</stRef:originalDocumentID>
|
||||
</xmpMM:DerivedFrom>
|
||||
<xmpMM:DocumentID>b2c5763f-bfb9-7ee1-6893-05220000004b</xmpMM:DocumentID>
|
||||
<xmpMM:History>
|
||||
<rdf:Seq>
|
||||
<rdf:li rdf:parseType='Resource'>
|
||||
<stEvt:action>saved</stEvt:action>
|
||||
<stEvt:changed>/</stEvt:changed>
|
||||
<stEvt:instanceID>63c4c09c-9648-ee43-720e-644600000078</stEvt:instanceID>
|
||||
<stEvt:softwareAgent>Adobe Adobe Media Encoder CC 2017.1 (Windows)</stEvt:softwareAgent>
|
||||
<stEvt:when>2018-11-17T20:27:31+01:00</stEvt:when>
|
||||
</rdf:li>
|
||||
<rdf:li rdf:parseType='Resource'>
|
||||
<stEvt:action>saved</stEvt:action>
|
||||
<stEvt:changed>/</stEvt:changed>
|
||||
<stEvt:instanceID>2a5a623f-09cc-ea32-5014-869400000078</stEvt:instanceID>
|
||||
<stEvt:softwareAgent>Adobe Adobe Media Encoder CC 2017.1 (Windows)</stEvt:softwareAgent>
|
||||
<stEvt:when>2018-11-17T20:26:54+01:00</stEvt:when>
|
||||
</rdf:li>
|
||||
<rdf:li rdf:parseType='Resource'>
|
||||
<stEvt:action>saved</stEvt:action>
|
||||
<stEvt:changed>/</stEvt:changed>
|
||||
<stEvt:instanceID>xmp.iid:6e43712c-17f5-cc4c-b90d-766dca2590dc</stEvt:instanceID>
|
||||
<stEvt:softwareAgent>Adobe Adobe Media Encoder CC 2017.1 (Windows)</stEvt:softwareAgent>
|
||||
<stEvt:when>2018-11-17T20:27:31+01:00</stEvt:when>
|
||||
</rdf:li>
|
||||
<rdf:li rdf:parseType='Resource'>
|
||||
<stEvt:action>saved</stEvt:action>
|
||||
<stEvt:changed>/metadata</stEvt:changed>
|
||||
<stEvt:instanceID>xmp.iid:4d4376d3-c650-354b-b4eb-0fc2d21bcaa4</stEvt:instanceID>
|
||||
<stEvt:softwareAgent>Adobe Adobe Media Encoder CC 2017.1 (Windows)</stEvt:softwareAgent>
|
||||
<stEvt:when>2018-11-17T20:27:31+01:00</stEvt:when>
|
||||
</rdf:li>
|
||||
</rdf:Seq>
|
||||
</xmpMM:History>
|
||||
<xmpMM:InstanceID>xmp.iid:4d4376d3-c650-354b-b4eb-0fc2d21bcaa4</xmpMM:InstanceID>
|
||||
<xmpMM:OriginalDocumentID>xmp.did:1aa2d671-bf82-2043-9053-ec864079866c</xmpMM:OriginalDocumentID>
|
||||
</rdf:Description>
|
||||
</rdf:RDF>
|
||||
</x:xmpmeta>
|
||||
<?xpacket end='w'?>
|
BIN
test/backend/assets/sidecar/bunny_1sec_v3.mp4
Normal file
BIN
test/backend/assets/sidecar/bunny_1sec_v3.mp4
Normal file
Binary file not shown.
15
test/backend/assets/sidecar/bunny_1sec_v3.mp4.json
Normal file
15
test/backend/assets/sidecar/bunny_1sec_v3.mp4.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"size": {
|
||||
"width": 640,
|
||||
"height": 360
|
||||
},
|
||||
"bitRate": 1794127,
|
||||
"duration": 290,
|
||||
"creationDate": 1709052692000,
|
||||
"fileSize": 65073,
|
||||
"fps": 40000,
|
||||
"keywords": [
|
||||
"rabbit"
|
||||
],
|
||||
"rating": 4
|
||||
}
|
118
test/backend/assets/sidecar/bunny_1sec_v3.xmp
Normal file
118
test/backend/assets/sidecar/bunny_1sec_v3.xmp
Normal file
@ -0,0 +1,118 @@
|
||||
<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
|
||||
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 12.69'>
|
||||
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:Iptc4xmpExt='http://iptc.org/std/Iptc4xmpExt/2008-02-29/'>
|
||||
<Iptc4xmpExt:audioBitsPerSample>16</Iptc4xmpExt:audioBitsPerSample>
|
||||
</rdf:Description>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:LImage='http://ns.leiainc.com/photos/1.0/image/'>
|
||||
<LImage:MinorVersion>0.0.0</LImage:MinorVersion>
|
||||
</rdf:Description>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:dc='http://purl.org/dc/elements/1.1/'>
|
||||
<dc:format>H.264</dc:format>
|
||||
<dc:subject>
|
||||
<rdf:Bag>
|
||||
<rdf:li>rabbit</rdf:li>
|
||||
</rdf:Bag>
|
||||
</dc:subject>
|
||||
</rdf:Description>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:tiff='http://ns.adobe.com/tiff/1.0/'>
|
||||
<tiff:ImageLength>480</tiff:ImageLength>
|
||||
<tiff:ImageWidth>852</tiff:ImageWidth>
|
||||
<tiff:XResolution>72/1</tiff:XResolution>
|
||||
<tiff:YResolution>72/1</tiff:YResolution>
|
||||
</rdf:Description>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:xmp='http://ns.adobe.com/xap/1.0/'>
|
||||
<xmp:CreateDate>2018-11-17T20:27:31+01:00</xmp:CreateDate>
|
||||
<xmp:MetadataDate>2018-11-17T20:27:31+01:00</xmp:MetadataDate>
|
||||
<xmp:ModifyDate>2018-11-17T20:27:31+01:00</xmp:ModifyDate>
|
||||
<xmp:Rating>4</xmp:Rating>
|
||||
</rdf:Description>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:stDim='http://ns.adobe.com/xap/1.0/sType/Dimensions#'
|
||||
xmlns:xmpDM='http://ns.adobe.com/xmp/1.0/DynamicMedia/'>
|
||||
<xmpDM:altTimecode rdf:parseType='Resource'>
|
||||
<xmpDM:timeFormat>25Timecode</xmpDM:timeFormat>
|
||||
<xmpDM:timeValue>00:00:00:00</xmpDM:timeValue>
|
||||
</xmpDM:altTimecode>
|
||||
<xmpDM:audioChannelType>Stereo</xmpDM:audioChannelType>
|
||||
<xmpDM:audioSampleRate>48000</xmpDM:audioSampleRate>
|
||||
<xmpDM:audioSampleType>16Int</xmpDM:audioSampleType>
|
||||
<xmpDM:duration rdf:parseType='Resource'>
|
||||
<xmpDM:scale>1/90000</xmpDM:scale>
|
||||
<xmpDM:value>2928000</xmpDM:value>
|
||||
</xmpDM:duration>
|
||||
<xmpDM:startTimeSampleSize>1</xmpDM:startTimeSampleSize>
|
||||
<xmpDM:startTimeScale>25</xmpDM:startTimeScale>
|
||||
<xmpDM:startTimecode rdf:parseType='Resource'>
|
||||
<xmpDM:timeFormat>25Timecode</xmpDM:timeFormat>
|
||||
<xmpDM:timeValue>00:00:00:00</xmpDM:timeValue>
|
||||
</xmpDM:startTimecode>
|
||||
<xmpDM:videoFieldOrder>Progressive</xmpDM:videoFieldOrder>
|
||||
<xmpDM:videoFrameRate>25.000000</xmpDM:videoFrameRate>
|
||||
<xmpDM:videoFrameSize rdf:parseType='Resource'>
|
||||
<stDim:h>480</stDim:h>
|
||||
<stDim:unit>pixel</stDim:unit>
|
||||
<stDim:w>852</stDim:w>
|
||||
</xmpDM:videoFrameSize>
|
||||
<xmpDM:videoPixelAspectRatio>1/1</xmpDM:videoPixelAspectRatio>
|
||||
</rdf:Description>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:stEvt='http://ns.adobe.com/xap/1.0/sType/ResourceEvent#'
|
||||
xmlns:stRef='http://ns.adobe.com/xap/1.0/sType/ResourceRef#'
|
||||
xmlns:xmpMM='http://ns.adobe.com/xap/1.0/mm/'>
|
||||
<xmpMM:DerivedFrom rdf:parseType='Resource'>
|
||||
<stRef:documentID>d47681ee-e57e-2256-f455-43c40000004b</stRef:documentID>
|
||||
<stRef:instanceID>2a5a623f-09cc-ea32-5014-869400000078</stRef:instanceID>
|
||||
<stRef:originalDocumentID>xmp.did:5af8e6dd-2af0-e94e-8f3c-767794b3efa1</stRef:originalDocumentID>
|
||||
</xmpMM:DerivedFrom>
|
||||
<xmpMM:DocumentID>b2c5763f-bfb9-7ee1-6893-05220000004b</xmpMM:DocumentID>
|
||||
<xmpMM:History>
|
||||
<rdf:Seq>
|
||||
<rdf:li rdf:parseType='Resource'>
|
||||
<stEvt:action>saved</stEvt:action>
|
||||
<stEvt:changed>/</stEvt:changed>
|
||||
<stEvt:instanceID>63c4c09c-9648-ee43-720e-644600000078</stEvt:instanceID>
|
||||
<stEvt:softwareAgent>Adobe Adobe Media Encoder CC 2017.1 (Windows)</stEvt:softwareAgent>
|
||||
<stEvt:when>2018-11-17T20:27:31+01:00</stEvt:when>
|
||||
</rdf:li>
|
||||
<rdf:li rdf:parseType='Resource'>
|
||||
<stEvt:action>saved</stEvt:action>
|
||||
<stEvt:changed>/</stEvt:changed>
|
||||
<stEvt:instanceID>2a5a623f-09cc-ea32-5014-869400000078</stEvt:instanceID>
|
||||
<stEvt:softwareAgent>Adobe Adobe Media Encoder CC 2017.1 (Windows)</stEvt:softwareAgent>
|
||||
<stEvt:when>2018-11-17T20:26:54+01:00</stEvt:when>
|
||||
</rdf:li>
|
||||
<rdf:li rdf:parseType='Resource'>
|
||||
<stEvt:action>saved</stEvt:action>
|
||||
<stEvt:changed>/</stEvt:changed>
|
||||
<stEvt:instanceID>xmp.iid:6e43712c-17f5-cc4c-b90d-766dca2590dc</stEvt:instanceID>
|
||||
<stEvt:softwareAgent>Adobe Adobe Media Encoder CC 2017.1 (Windows)</stEvt:softwareAgent>
|
||||
<stEvt:when>2018-11-17T20:27:31+01:00</stEvt:when>
|
||||
</rdf:li>
|
||||
<rdf:li rdf:parseType='Resource'>
|
||||
<stEvt:action>saved</stEvt:action>
|
||||
<stEvt:changed>/metadata</stEvt:changed>
|
||||
<stEvt:instanceID>xmp.iid:4d4376d3-c650-354b-b4eb-0fc2d21bcaa4</stEvt:instanceID>
|
||||
<stEvt:softwareAgent>Adobe Adobe Media Encoder CC 2017.1 (Windows)</stEvt:softwareAgent>
|
||||
<stEvt:when>2018-11-17T20:27:31+01:00</stEvt:when>
|
||||
</rdf:li>
|
||||
</rdf:Seq>
|
||||
</xmpMM:History>
|
||||
<xmpMM:InstanceID>xmp.iid:4d4376d3-c650-354b-b4eb-0fc2d21bcaa4</xmpMM:InstanceID>
|
||||
<xmpMM:OriginalDocumentID>xmp.did:1aa2d671-bf82-2043-9053-ec864079866c</xmpMM:OriginalDocumentID>
|
||||
</rdf:Description>
|
||||
</rdf:RDF>
|
||||
</x:xmpmeta>
|
||||
<?xpacket end='w'?>
|
BIN
test/backend/assets/sidecar/metadata.jpg
Normal file
BIN
test/backend/assets/sidecar/metadata.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.0 KiB |
12
test/backend/assets/sidecar/metadata.jpg.json
Normal file
12
test/backend/assets/sidecar/metadata.jpg.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"size": {
|
||||
"width": 10,
|
||||
"height": 5
|
||||
},
|
||||
"creationDate": 1710188754000,
|
||||
"fileSize": 5095,
|
||||
"keywords": [
|
||||
"floor",
|
||||
"book"
|
||||
]
|
||||
}
|
BIN
test/backend/assets/sidecar/metadata_v2.jpg
Normal file
BIN
test/backend/assets/sidecar/metadata_v2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.0 KiB |
15
test/backend/assets/sidecar/metadata_v2.jpg.json
Normal file
15
test/backend/assets/sidecar/metadata_v2.jpg.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"size": {
|
||||
"width": 10,
|
||||
"height": 5
|
||||
},
|
||||
"creationDate": 1710188754000,
|
||||
"fileSize": 5095,
|
||||
"keywords": [
|
||||
"floor",
|
||||
"book",
|
||||
"first",
|
||||
"second"
|
||||
],
|
||||
"rating": 0
|
||||
}
|
18
test/backend/assets/sidecar/metadata_v2.xmp
Normal file
18
test/backend/assets/sidecar/metadata_v2.xmp
Normal file
@ -0,0 +1,18 @@
|
||||
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 6.0.0">
|
||||
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
||||
<rdf:Description rdf:about=""
|
||||
xmlns:xmp="http://ns.adobe.com/xap/1.0/"
|
||||
xmlns:MicrosoftPhoto="http://ns.microsoft.com/photo/1.0/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:lr="http://ns.adobe.com/lightroom/1.0/">
|
||||
<xmp:Rating>0</xmp:Rating>
|
||||
<MicrosoftPhoto:Rating>0</MicrosoftPhoto:Rating>
|
||||
<dc:subject>
|
||||
<rdf:Bag>
|
||||
<rdf:li>first</rdf:li>
|
||||
<rdf:li>second</rdf:li>
|
||||
</rdf:Bag>
|
||||
</dc:subject>
|
||||
</rdf:Description>
|
||||
</rdf:RDF>
|
||||
</x:xmpmeta>
|
BIN
test/backend/assets/sidecar/no_metadata.jpg
Normal file
BIN
test/backend/assets/sidecar/no_metadata.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
12
test/backend/assets/sidecar/no_metadata.jpg.json
Normal file
12
test/backend/assets/sidecar/no_metadata.jpg.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"size": {
|
||||
"width": 10,
|
||||
"height": 5
|
||||
},
|
||||
"creationDate": 1542482851000,
|
||||
"fileSize": 1430,
|
||||
"keywords": [
|
||||
"first",
|
||||
"second"
|
||||
]
|
||||
}
|
24
test/backend/assets/sidecar/no_metadata.jpg.xmp
Normal file
24
test/backend/assets/sidecar/no_metadata.jpg.xmp
Normal file
@ -0,0 +1,24 @@
|
||||
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
|
||||
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.4.0-Exiv2">
|
||||
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
||||
<rdf:Description rdf:about=""
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:fstop="http://www.fstopapp.com/xmp/"
|
||||
fstop:favorite="0">
|
||||
<dc:subject>
|
||||
<rdf:Bag>
|
||||
<rdf:li>first</rdf:li>
|
||||
<rdf:li>second</rdf:li>
|
||||
</rdf:Bag>
|
||||
</dc:subject>
|
||||
</rdf:Description>
|
||||
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:xmp='http://ns.adobe.com/xap/1.0/'>
|
||||
<xmp:CreateDate>2018-11-17T20:27:31+01:00</xmp:CreateDate>
|
||||
<xmp:MetadataDate>2018-11-17T20:27:31+01:00</xmp:MetadataDate>
|
||||
<xmp:ModifyDate>2018-11-17T20:27:31+01:00</xmp:ModifyDate>
|
||||
</rdf:Description>
|
||||
</rdf:RDF>
|
||||
</x:xmpmeta>
|
||||
<?xpacket end="w"?>
|
BIN
test/backend/assets/sidecar/no_metadata_v2.jpg
Normal file
BIN
test/backend/assets/sidecar/no_metadata_v2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
12
test/backend/assets/sidecar/no_metadata_v2.jpg.json
Normal file
12
test/backend/assets/sidecar/no_metadata_v2.jpg.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"size": {
|
||||
"width": 10,
|
||||
"height": 5
|
||||
},
|
||||
"creationDate": 1542482851000,
|
||||
"fileSize": 1430,
|
||||
"keywords": [
|
||||
"first",
|
||||
"second"
|
||||
]
|
||||
}
|
23
test/backend/assets/sidecar/no_metadata_v2.xmp
Normal file
23
test/backend/assets/sidecar/no_metadata_v2.xmp
Normal file
@ -0,0 +1,23 @@
|
||||
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
|
||||
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.4.0-Exiv2">
|
||||
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
||||
<rdf:Description rdf:about=""
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:fstop="http://www.fstopapp.com/xmp/"
|
||||
fstop:favorite="0">
|
||||
<dc:subject>
|
||||
<rdf:Bag>
|
||||
<rdf:li>first</rdf:li>
|
||||
<rdf:li>second</rdf:li>
|
||||
</rdf:Bag>
|
||||
</dc:subject>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:xmp='http://ns.adobe.com/xap/1.0/'>
|
||||
<xmp:CreateDate>2018-11-17T20:27:31+01:00</xmp:CreateDate>
|
||||
<xmp:MetadataDate>2018-11-17T20:27:31+01:00</xmp:MetadataDate>
|
||||
<xmp:ModifyDate>2018-11-17T20:27:31+01:00</xmp:ModifyDate>
|
||||
</rdf:Description>
|
||||
</rdf:RDF>
|
||||
</x:xmpmeta>
|
||||
<?xpacket end="w"?>
|
BIN
test/backend/assets/sidecar/no_metadata_v3.jpg
Normal file
BIN
test/backend/assets/sidecar/no_metadata_v3.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
11
test/backend/assets/sidecar/no_metadata_v3.jpg.json
Normal file
11
test/backend/assets/sidecar/no_metadata_v3.jpg.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"size": {
|
||||
"width": 10,
|
||||
"height": 5
|
||||
},
|
||||
"creationDate": 1542482851000,
|
||||
"fileSize": 1430,
|
||||
"keywords": [
|
||||
"first"
|
||||
]
|
||||
}
|
22
test/backend/assets/sidecar/no_metadata_v3.xmp
Normal file
22
test/backend/assets/sidecar/no_metadata_v3.xmp
Normal file
@ -0,0 +1,22 @@
|
||||
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
|
||||
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.4.0-Exiv2">
|
||||
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
||||
<rdf:Description rdf:about=""
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:fstop="http://www.fstopapp.com/xmp/"
|
||||
fstop:favorite="0">
|
||||
<dc:subject>
|
||||
<rdf:Bag>
|
||||
<rdf:li>first</rdf:li>
|
||||
</rdf:Bag>
|
||||
</dc:subject>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about=''
|
||||
xmlns:xmp='http://ns.adobe.com/xap/1.0/'>
|
||||
<xmp:CreateDate>2018-11-17T20:27:31+01:00</xmp:CreateDate>
|
||||
<xmp:MetadataDate>2018-11-17T20:27:31+01:00</xmp:MetadataDate>
|
||||
<xmp:ModifyDate>2018-11-17T20:27:31+01:00</xmp:ModifyDate>
|
||||
</rdf:Description>
|
||||
</rdf:RDF>
|
||||
</x:xmpmeta>
|
||||
<?xpacket end="w"?>
|
@ -99,6 +99,67 @@ describe('MetadataLoader', () => {
|
||||
const expected = require(path.join(__dirname, '/../../../assets/timestamps/big_ben_only_time.json'));
|
||||
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
||||
});
|
||||
it('should load sidecar file with file extension for video', async () => {
|
||||
const data = await MetadataLoader.loadVideoMetadata(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec.mp4'));
|
||||
const expected = require(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec.mp4.json'));
|
||||
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
||||
});
|
||||
|
||||
it('should load sidecar file without file extension for video', async () => {
|
||||
const data = await MetadataLoader.loadVideoMetadata(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec_v2.mp4'));
|
||||
const expected = require(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec.mp4.json'));//sidecar "bunny_1sec_v2.xmp" is identical to "bunny_1sec.mp4.xmp" so we expect the same result
|
||||
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
||||
});
|
||||
|
||||
it('should retrieve both keywords from sidecar file for video', async () => {
|
||||
const data = await MetadataLoader.loadVideoMetadata(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec.mp4'));
|
||||
const expected = require(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec.mp4.json'));
|
||||
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
||||
});
|
||||
|
||||
it('should retrieve one keyword from sidecar file for video', async () => {
|
||||
const data = await MetadataLoader.loadVideoMetadata(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec_v3.mp4'));
|
||||
const expected = require(path.join(__dirname, '/../../../assets/sidecar/bunny_1sec_v3.mp4.json'));
|
||||
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
||||
});
|
||||
|
||||
it('should load sidecar file with file extension for photo', async () => {
|
||||
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/sidecar/no_metadata.jpg'));
|
||||
const expected = require(path.join(__dirname, '/../../../assets/sidecar/no_metadata.jpg.json'));
|
||||
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
||||
});
|
||||
|
||||
it('should load sidecar file without file extension for photo', async () => {
|
||||
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/sidecar/no_metadata_v2.jpg'));
|
||||
const expected = require(path.join(__dirname, '/../../../assets/sidecar/no_metadata_v2.jpg.json'));
|
||||
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
||||
});
|
||||
|
||||
it('should retrieve both keywords from sidecar file for photo', async () => {
|
||||
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/sidecar/no_metadata.jpg'));
|
||||
const expected = require(path.join(__dirname, '/../../../assets/sidecar/no_metadata.jpg.json'));
|
||||
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
||||
});
|
||||
|
||||
it('should retrieve one keyword from sidecar file for photo', async () => {
|
||||
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/sidecar/no_metadata_v3.jpg'));
|
||||
const expected = require(path.join(__dirname, '/../../../assets/sidecar/no_metadata_v3.jpg.json'));
|
||||
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
||||
});
|
||||
|
||||
it('should read keywords from photo without sidecar file', async () => {
|
||||
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/sidecar/metadata.jpg'));
|
||||
const expected = require(path.join(__dirname, '/../../../assets/sidecar/metadata.jpg.json'));
|
||||
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
||||
});
|
||||
|
||||
it('should merge keywords from photo with keywords from sidecar', async () => {
|
||||
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/sidecar/metadata_v2.jpg'));
|
||||
const expected = require(path.join(__dirname, '/../../../assets/sidecar/metadata_v2.jpg.json')); //"metadata_v2.jpg" is identical to "metadata.jpg" and "metadata_v2.xmp" contains 2 different keywords
|
||||
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
||||
});
|
||||
|
||||
|
||||
describe('should load jpg with proper height and orientation', () => {
|
||||
it('jpg 1', async () => {
|
||||
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/orientation/broken_orientation_exif.jpg'));
|
||||
|
Loading…
Reference in New Issue
Block a user