1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2025-01-08 04:03:48 +02:00

Add tests for reading sidecar files

Thanks grasdk for providing the .json files!

Co-authored-by: grasdk <chrisc.gigamail@gmail.com>
This commit is contained in:
Martin Kampas 2024-03-07 10:14:50 +01:00
parent da0b7d8e21
commit 6a52d84881
16 changed files with 629 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,73 @@
<?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:xap="http://ns.adobe.com/xap/1.0/"
xmlns:exif="http://ns.adobe.com/exif/1.0/"
xmlns:digiKam="http://www.digikam.org/ns/1.0/"
xmlns:tiff="http://ns.adobe.com/tiff/1.0/"
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xap:Rating="3"
xap:CreatorTool="digiKam-8.2.0"
xap:ModifyDate="2024-01-07T11:02:59.177"
xap:CreateDate="2024-01-07T11:02:59.177"
exif:GPSVersionID="2.0.0.0"
exif:GPSLatitude="50,5.3752490N"
exif:GPSLongitude="14,23.8445710E"
exif:GPSMapDatum="WGS-84"
exif:ExifVersion="0220"
exif:PixelXDimension="10"
exif:PixelYDimension="13"
exif:ExposureTime="1/105"
exif:FNumber="220/100"
exif:ExposureProgram="2"
exif:ShutterSpeedValue="1/105"
exif:ApertureValue="227/100"
exif:BrightnessValue="0/100"
exif:ExposureBiasValue="0/100"
exif:MaxApertureValue="227/100"
exif:MeteringMode="2"
exif:FocalLength="375/100"
exif:ExposureMode="0"
exif:WhiteBalance="0"
exif:DigitalZoomRatio="100/100"
exif:FocalLengthIn35mmFilm="25"
exif:SceneCaptureType="0"
exif:ImageUniqueID="A64QLMD00YM"
tiff:ImageWidth="10"
tiff:ImageLength="13"
tiff:Orientation="1"
tiff:YCbCrPositioning="1"
tiff:XResolution="72/1"
tiff:YResolution="72/1"
tiff:ResolutionUnit="2"
tiff:Make="samsung"
tiff:Model="SM-A715F"
tiff:Software="digiKam-8.2.0"
photoshop:DateCreated="2024-01-07T11:02:59.177">
<exif:Flash
exif:Fired="False"
exif:Return="0"
exif:Mode="0"
exif:Function="False"
exif:RedEyeMode="False"/>
<exif:ISOSpeedRatings>
<rdf:Seq>
<rdf:li>40</rdf:li>
</rdf:Seq>
</exif:ISOSpeedRatings>
<digiKam:TagsList>
<rdf:Seq>
<rdf:li>Travel</rdf:li>
</rdf:Seq>
</digiKam:TagsList>
<dc:subject>
<rdf:Bag>
<rdf:li>Travel</rdf:li>
</rdf:Bag>
</dc:subject>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>

View File

@ -0,0 +1,22 @@
{
"cameraData": {
"ISO": 40,
"exposure": 0.009524,
"fStop": 2.2,
"focalLength": 3.75,
"make": "samsung",
"model": "SM-A715F"
},
"creationDate": 1704621779177,
"creationDateOffset": "+01:00",
"fileSize": 15126,
"size": {
"height": 13,
"width": 10
},
"keywords": [
"Výlet",
"Travel"
],
"rating": 3
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -0,0 +1,91 @@
<?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:xmp="http://ns.adobe.com/xap/1.0/"
xmlns:exif="http://ns.adobe.com/exif/1.0/"
xmlns:digiKam="http://www.digikam.org/ns/1.0/"
xmlns:tiff="http://ns.adobe.com/tiff/1.0/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/"
xmp:CreatorTool="NIKON Z 30 Ver.01.00 "
xmp:Rating="3"
xmp:ModifyDate="2024-03-04T12:03:45.65"
xmp:CreateDate="2024-03-04T12:03:45.65"
exif:GPSLatitude="50,5.3752490N"
exif:GPSLongitude="14,23.8445710E"
exif:GPSMapDatum="WGS-84"
exif:ExifVersion="0231"
exif:FlashpixVersion="0100"
exif:CompressedBitsPerPixel="4/1"
exif:PixelXDimension="15"
exif:PixelYDimension="10"
exif:ExposureTime="10/3200"
exif:FNumber="630/100"
exif:ExposureProgram="0"
exif:ExposureBiasValue="4/6"
exif:MeteringMode="5"
exif:LightSource="11"
exif:FocalLength="160/10"
exif:SensingMethod="2"
exif:FileSource="3"
exif:SceneType="1"
exif:CFAPattern="2 0 2 0 0 1 1 2"
exif:CustomRendered="1"
exif:ExposureMode="0"
exif:WhiteBalance="1"
exif:FocalLengthIn35mmFilm="24"
exif:SceneCaptureType="0"
exif:GainControl="0"
exif:Contrast="0"
exif:Saturation="0"
exif:Sharpness="0"
exif:SubjectDistanceRange="0"
exif:GPSVersionID="2.3.0.0"
tiff:ImageWidth="15"
tiff:ImageLength="10"
tiff:Orientation="1"
tiff:YCbCrPositioning="2"
tiff:XResolution="300/1"
tiff:YResolution="300/1"
tiff:ResolutionUnit="2"
tiff:Make="NIKON CORPORATION"
tiff:Model="NIKON Z 30"
tiff:Software="digiKam-8.2.0"
photoshop:DateCreated="2024-01-21T10:24:00.93">
<exif:Flash
exif:Fired="False"
exif:Return="0"
exif:Mode="0"
exif:Function="False"
exif:RedEyeMode="False"/>
<exif:ComponentsConfiguration>
<rdf:Seq>
<rdf:li>1</rdf:li>
<rdf:li>2</rdf:li>
<rdf:li>3</rdf:li>
<rdf:li>0</rdf:li>
</rdf:Seq>
</exif:ComponentsConfiguration>
<exif:ISOSpeedRatings>
<rdf:Seq>
<rdf:li>100</rdf:li>
</rdf:Seq>
</exif:ISOSpeedRatings>
<digiKam:TagsList>
<rdf:Seq>
<rdf:li>Travel</rdf:li>
</rdf:Seq>
</digiKam:TagsList>
<dc:creator>
<rdf:Seq/>
</dc:creator>
<dc:subject>
<rdf:Bag>
<rdf:li>Travel</rdf:li>
</rdf:Bag>
</dc:subject>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>

View File

@ -0,0 +1,23 @@
{
"cameraData": {
"ISO": 100,
"exposure": 0.003125,
"fStop": 6.3,
"focalLength": 16,
"lens": "NIKKOR Z DX 16-50mm f/3.5-6.3 VR",
"make": "NIKON CORPORATION",
"model": "NIKON Z 30"
},
"creationDate": 1705829040930,
"creationDateOffset": "+01:00",
"fileSize": 25556,
"size": {
"height": 10,
"width": 15
},
"keywords": [
"Výlet",
"Travel"
],
"rating": 3
}

View File

@ -0,0 +1,15 @@
{
"bitRate": 184871,
"creationDate": 1706432060000,
"duration": 1000,
"fileSize": 23132,
"size": {
"height": 46,
"width": 80
},
"fps": 60000,
"keywords": [
"Travel"
],
"rating": 3
}

Binary file not shown.

View File

@ -0,0 +1,115 @@
<?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:video="http://www.video/"
xmlns:xmpDM="http://ns.adobe.com/xmp/1.0/DynamicMedia/"
xmlns:audio="http://www.audio/"
xmlns:exif="http://ns.adobe.com/exif/1.0/"
xmlns:tiff="http://ns.adobe.com/tiff/1.0/"
xmlns:xap="http://ns.adobe.com/xap/1.0/"
xmlns:Iptc4xmpExt="http://iptc.org/std/Iptc4xmpExt/2008-02-29/"
xmlns:LImage="http://ns.leiainc.com/photos/1.0/image/"
xmlns:digiKam="http://www.digikam.org/ns/1.0/"
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
video:duration="1001"
video:MaxBitRate="184871"
video:StreamCount="3"
video:Codec="h264"
video:CodecDescription="H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"
video:Format="yuv420p"
video:ColorMode="bt709"
video:ColorSpace="CCIR-709"
video:Width="80"
video:FrameWidth="80"
video:SourceImageWidth="80"
video:Height="46"
video:FrameHeight="46"
video:SourceImageHeight="46"
video:FrameSize="w:80, h:46, unit:pixels"
video:AspectRatio="80/46"
video:FrameRate="59.9401"
video:BitDepth="24"
video:Language="eng"
video:TrackCreateDate="3789284060"
video:HandlerDescription="VideoHandler"
video:MajorBrand="qt "
video:CompatibleBrands="qt niko"
video:MinorVersion="538315008"
video:Encoder="Lavf60.16.100"
video:DateTimeOriginal="2024-01-28T09:54:20"
video:DateUTC="2024-01-28T09:54:20"
video:ModificationDate="2024-01-28T09:54:20"
video:DateTimeDigitized="2024-01-28T09:54:20"
video:FileName="DSC_1928_20240128_105420_80p.mp4"
video:FileSize="0"
video:FileType="mp4"
video:MimeType="video/mp4"
xmpDM:duration="1001"
xmpDM:videoColorSpace="CCIR-709"
xmpDM:FieldOrder="Progressive"
xmpDM:videoFrameSize="w:80, h:46, unit:pixels"
xmpDM:videoPixelAspectRatio="80/46"
xmpDM:videoFrameRate="59.94"
xmpDM:videoPixelDepth="8Int"
xmpDM:shotDate="ne led 28 10:54:20 2024"
xmpDM:audioSampleRate="48000"
xmpDM:audioChannelType="Stereo"
xmpDM:audioSampleType="32Float"
audio:Codec="aac"
audio:CodecDescription="AAC (Advanced Audio Coding)"
audio:SampleRate="48000"
audio:ChannelType="Stereo"
audio:Format="fltp"
audio:SampleType="32Float"
audio:TrackLang="eng"
audio:TrackCreateDate="3789284060"
audio:HandlerDescription="SoundHandler"
exif:DateTimeOriginal="2024-01-28T09:54:20"
exif:DateTimeDigitized="2024-01-28T09:54:20"
exif:ExifVersion="0232"
exif:FlashpixVersion="0100"
exif:ColorSpace="65535"
exif:PixelXDimension="80"
exif:PixelYDimension="46"
exif:GPSVersionID="2.0.0.0"
exif:GPSLatitude="50,5.3752490N"
exif:GPSLongitude="14,23.8445710E"
exif:GPSMapDatum="WGS-84"
tiff:DateTime="2024-01-28T09:54:20"
tiff:ImageWidth="80"
tiff:ImageLength="46"
tiff:YCbCrPositioning="1"
tiff:XResolution="72/1"
tiff:YResolution="72/1"
tiff:ResolutionUnit="2"
xap:MetadataDate="2024-01-28T09:54:20"
xap:Rating="3"
xap:ModifyDate="2024-01-28T09:54:20"
xap:CreateDate="2024-01-28T09:54:20"
Iptc4xmpExt:audioBitsPerSample="16"
LImage:MinorVersion="538315008"
photoshop:DateCreated="2024-01-28T09:54:20">
<exif:ComponentsConfiguration>
<rdf:Seq>
<rdf:li>1</rdf:li>
<rdf:li>2</rdf:li>
<rdf:li>3</rdf:li>
<rdf:li>0</rdf:li>
</rdf:Seq>
</exif:ComponentsConfiguration>
<digiKam:TagsList>
<rdf:Seq>
<rdf:li>Travel</rdf:li>
</rdf:Seq>
</digiKam:TagsList>
<dc:subject>
<rdf:Bag>
<rdf:li>Travel</rdf:li>
</rdf:Bag>
</dc:subject>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>

View File

@ -0,0 +1,15 @@
{
"bitRate": 183168,
"creationDate": 1706436545000,
"duration": 1000,
"fileSize": 22896,
"size": {
"height": 80,
"width": 46
},
"fps": 30,
"keywords": [
"Travel"
],
"rating": 3
}

Binary file not shown.

View File

@ -0,0 +1,117 @@
<?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:video="http://www.video/"
xmlns:xmpDM="http://ns.adobe.com/xmp/1.0/DynamicMedia/"
xmlns:audio="http://www.audio/"
xmlns:exif="http://ns.adobe.com/exif/1.0/"
xmlns:tiff="http://ns.adobe.com/tiff/1.0/"
xmlns:xap="http://ns.adobe.com/xap/1.0/"
xmlns:Iptc4xmpExt="http://iptc.org/std/Iptc4xmpExt/2008-02-29/"
xmlns:LImage="http://ns.leiainc.com/photos/1.0/image/"
xmlns:digiKam="http://www.digikam.org/ns/1.0/"
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
video:duration="1000"
video:MaxBitRate="183168"
video:StreamCount="2"
video:Codec="h264"
video:CodecDescription="H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"
video:Format="yuv420p"
video:ColorMode="bt709"
video:ColorSpace="CCIR-709"
video:Width="80"
video:FrameWidth="80"
video:SourceImageWidth="80"
video:Height="46"
video:FrameHeight="46"
video:SourceImageHeight="46"
video:FrameSize="w:80, h:46, unit:pixels"
video:AspectRatio="16/9"
video:FrameRate="30"
video:BitDepth="24"
video:Orientation="6"
video:Language="und"
video:TrackCreateDate="3789288545"
video:HandlerDescription="VideoHandler"
video:MajorBrand="mp42"
video:CompatibleBrands="mp42mp41isomiso2"
video:MinorVersion="0"
video:Encoder="Lavf60.16.100"
video:DateTimeOriginal="2024-01-28T11:09:05"
video:DateUTC="2024-01-28T11:09:05"
video:ModificationDate="2024-01-28T11:09:05"
video:DateTimeDigitized="2024-01-28T11:09:05"
video:FileName="20240128_120909_80p.mp4"
video:FileSize="0"
video:FileType="mp4"
video:MimeType="video/mp4"
xmpDM:duration="1000"
xmpDM:videoColorSpace="CCIR-709"
xmpDM:FieldOrder="Progressive"
xmpDM:videoFrameSize="w:80, h:46, unit:pixels"
xmpDM:videoPixelAspectRatio="16/9"
xmpDM:videoFrameRate="30"
xmpDM:videoPixelDepth="8Int"
xmpDM:shotDate="ne led 28 12:09:05 2024"
xmpDM:audioSampleRate="48000"
xmpDM:audioChannelType="Stereo"
xmpDM:audioSampleType="32Float"
audio:Codec="aac"
audio:CodecDescription="AAC (Advanced Audio Coding)"
audio:SampleRate="48000"
audio:ChannelType="Stereo"
audio:Format="fltp"
audio:SampleType="32Float"
audio:TrackLang="und"
audio:TrackCreateDate="3789288545"
audio:HandlerDescription="SoundHandler"
exif:DateTimeOriginal="2024-01-28T11:09:05"
exif:DateTimeDigitized="2024-01-28T11:09:05"
exif:ExifVersion="0232"
exif:FlashpixVersion="0100"
exif:ColorSpace="65535"
exif:PixelXDimension="80"
exif:PixelYDimension="46"
exif:GPSVersionID="2.0.0.0"
exif:GPSLatitude="50,5.3752490N"
exif:GPSLongitude="14,23.8445710E"
exif:GPSMapDatum="WGS-84"
tiff:DateTime="2024-01-28T11:09:05"
tiff:ImageWidth="81"
tiff:ImageLength="46"
tiff:Orientation="6"
tiff:YCbCrPositioning="1"
tiff:XResolution="72/1"
tiff:YResolution="72/1"
tiff:ResolutionUnit="2"
xap:MetadataDate="2024-01-28T11:09:05"
xap:Rating="3"
xap:ModifyDate="2024-01-28T11:09:05"
xap:CreateDate="2024-01-28T11:09:05"
Iptc4xmpExt:audioBitsPerSample="16"
LImage:MinorVersion="0"
photoshop:DateCreated="2024-01-28T11:09:05">
<exif:ComponentsConfiguration>
<rdf:Seq>
<rdf:li>1</rdf:li>
<rdf:li>2</rdf:li>
<rdf:li>3</rdf:li>
<rdf:li>0</rdf:li>
</rdf:Seq>
</exif:ComponentsConfiguration>
<digiKam:TagsList>
<rdf:Seq>
<rdf:li>Travel</rdf:li>
</rdf:Seq>
</digiKam:TagsList>
<dc:subject>
<rdf:Bag>
<rdf:li>Travel</rdf:li>
</rdf:Bag>
</dc:subject>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -0,0 +1,114 @@
<?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:xmp="http://ns.adobe.com/xap/1.0/"
xmlns:exif="http://ns.adobe.com/exif/1.0/"
xmlns:acdsee="http://ns.acdsee.com/iptc/1.0/"
xmlns:MicrosoftPhoto="http://ns.microsoft.com/photo/1.0/"
xmlns:digiKam="http://www.digikam.org/ns/1.0/"
xmlns:lr="http://ns.adobe.com/lightroom/1.0/"
xmlns:mediapro="http://ns.iview-multimedia.com/mediapro/1.0/"
xmlns:tiff="http://ns.adobe.com/tiff/1.0/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/"
xmp:CreatorTool="NIKON Z 30 Ver.01.00 "
xmp:Rating="3"
xmp:ModifyDate="2024-01-28T18:58:08.66"
xmp:CreateDate="2024-01-28T18:58:08.66"
exif:GPSLatitude="50,5.3752490N"
exif:GPSLongitude="14,23.8445710E"
exif:GPSMapDatum="WGS-84"
exif:ExifVersion="0231"
exif:FlashpixVersion="0100"
exif:CompressedBitsPerPixel="4/1"
exif:PixelXDimension="15"
exif:PixelYDimension="10"
exif:ExposureTime="10/250"
exif:FNumber="420/100"
exif:ExposureProgram="2"
exif:ExposureBiasValue="0/6"
exif:MeteringMode="5"
exif:LightSource="0"
exif:FocalLength="250/10"
exif:SensingMethod="2"
exif:FileSource="3"
exif:SceneType="1"
exif:CFAPattern="2 0 2 0 0 1 1 2"
exif:CustomRendered="1"
exif:ExposureMode="0"
exif:WhiteBalance="0"
exif:FocalLengthIn35mmFilm="37"
exif:SceneCaptureType="0"
exif:GainControl="2"
exif:Contrast="0"
exif:Saturation="0"
exif:Sharpness="0"
exif:SubjectDistanceRange="0"
exif:GPSVersionID="2.3.0.0"
acdsee:categories="&lt;Categories&gt;&lt;Category Assigned=&quot;1&quot;&gt;Travel&lt;/Category&gt;&lt;/Categories&gt;"
acdsee:rating="3"
MicrosoftPhoto:Rating="50"
tiff:ImageWidth="15"
tiff:ImageLength="10"
tiff:Orientation="1"
tiff:YCbCrPositioning="2"
tiff:XResolution="300/1"
tiff:YResolution="300/1"
tiff:ResolutionUnit="2"
tiff:Make="NIKON CORPORATION"
tiff:Model="NIKON Z 30"
tiff:Software="digiKam-8.2.0"
photoshop:DateCreated="2024-01-28T18:58:08.66"
photoshop:Urgency="4">
<exif:Flash
exif:Fired="False"
exif:Return="0"
exif:Mode="0"
exif:Function="False"
exif:RedEyeMode="False"/>
<exif:ComponentsConfiguration>
<rdf:Seq>
<rdf:li>1</rdf:li>
<rdf:li>2</rdf:li>
<rdf:li>3</rdf:li>
<rdf:li>0</rdf:li>
</rdf:Seq>
</exif:ComponentsConfiguration>
<exif:ISOSpeedRatings>
<rdf:Seq>
<rdf:li>25600</rdf:li>
</rdf:Seq>
</exif:ISOSpeedRatings>
<MicrosoftPhoto:LastKeywordXMP>
<rdf:Bag>
<rdf:li>Travel</rdf:li>
</rdf:Bag>
</MicrosoftPhoto:LastKeywordXMP>
<digiKam:TagsList>
<rdf:Seq>
<rdf:li>Travel</rdf:li>
</rdf:Seq>
</digiKam:TagsList>
<lr:hierarchicalSubject>
<rdf:Bag>
<rdf:li>Travel</rdf:li>
</rdf:Bag>
</lr:hierarchicalSubject>
<mediapro:CatalogSets>
<rdf:Bag>
<rdf:li>Travel</rdf:li>
</rdf:Bag>
</mediapro:CatalogSets>
<dc:creator>
<rdf:Seq/>
</dc:creator>
<dc:subject>
<rdf:Bag>
<rdf:li>Travel</rdf:li>
</rdf:Bag>
</dc:subject>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>

View File

@ -0,0 +1,23 @@
{
"cameraData": {
"ISO": 25600,
"exposure": 0.04,
"fStop": 4.2,
"focalLength": 25,
"lens": "NIKKOR Z DX 16-50mm f/3.5-6.3 VR",
"make": "NIKON CORPORATION",
"model": "NIKON Z 30"
},
"creationDate": 1706464688660,
"creationDateOffset": "+01:00",
"fileSize": 47059,
"size": {
"height": 10,
"width": 15
},
"keywords": [
"Výlet",
"Travel"
],
"rating": 3
}

View File

@ -5,6 +5,7 @@ import {Utils} from '../../../../../src/common/Utils';
import * as path from 'path';
import * as fs from 'fs';
import {PhotoProcessing} from '../../../../../src/backend/model/fileaccess/fileprocessing/PhotoProcessing';
import {VideoProcessing} from '../../../../../src/backend/model/fileaccess/fileprocessing/VideoProcessing';
import {Config} from '../../../../../src/common/config/private/Config';
import {DatabaseType} from '../../../../../src/common/config/private/PrivateConfig';
@ -257,4 +258,24 @@ describe('MetadataLoader', () => {
expect(Utils.clone(data)).to.be.deep.equal(expected);
});
describe('should load metadata from sidecar files', () => {
const root = path.join(__dirname, '/../../../assets/sidecar');
const files = fs.readdirSync(root);
for (const item of files) {
const fullFilePath = path.join(root, item);
if (PhotoProcessing.isPhoto(fullFilePath)) {
it(item, async () => {
const data = await MetadataLoader.loadPhotoMetadata(fullFilePath);
const expected = require(fullFilePath.split('.').slice(0, -1).join('.') + '.json');
expect(Utils.clone(data)).to.be.deep.equal(expected);
});
} else if (VideoProcessing.isVideo(fullFilePath)) {
it(item, async () => {
const data = await MetadataLoader.loadVideoMetadata(fullFilePath);
const expected = require(fullFilePath.split('.').slice(0, -1).join('.') + '.json');
expect(Utils.clone(data)).to.be.deep.equal(expected);
});
}
}
});
});