From 8b2df7c2a54fecd1dd717ee2e2ea59728d35c75c Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Sun, 22 Oct 2023 12:40:25 -0700 Subject: [PATCH] refactor: move ExifFields to class Signed-off-by: Varun Patil --- lib/Db/ExifFields.php | 86 ++++++++++++++++++++++++++++++++++++++++ lib/Db/TimelineWrite.php | 4 +- lib/ExifFields.php | 81 ------------------------------------- 3 files changed, 87 insertions(+), 84 deletions(-) create mode 100644 lib/Db/ExifFields.php delete mode 100644 lib/ExifFields.php diff --git a/lib/Db/ExifFields.php b/lib/Db/ExifFields.php new file mode 100644 index 00000000..e5629f5d --- /dev/null +++ b/lib/Db/ExifFields.php @@ -0,0 +1,86 @@ + true, + 'CreateDate' => true, + 'OffsetTimeOriginal' => true, + 'OffsetTime' => true, + + // Generated date fields + 'DateTimeEpoch' => true, + 'LocationTZID' => true, + + // Camera Info + 'Make' => true, + 'Model' => true, + 'LensModel' => true, + 'CameraType' => true, + 'AutoRotate' => true, + 'SerialNumber' => true, + + // Photo Info + 'FNumber' => true, + 'ApertureValue' => true, + 'FocalLength' => true, + 'ISO' => true, + 'ShutterSpeedValue' => true, + 'ShutterSpeed' => true, + 'ExposureTime' => true, + 'WhiteBalance' => true, + 'Sharpness' => true, + 'ColorTemperature' => true, + 'HDR' => true, + 'HDREffect' => true, + 'ColorSpace' => true, + 'Aperture' => true, + 'ImageUniqueID' => true, + + // GPS info + 'GPSLatitude' => true, + 'GPSLongitude' => true, + 'GPSAltitude' => true, + 'GPSTimeStamp' => true, + 'GPSStatus' => true, + + // Size / rotation info + 'Megapixels' => true, + 'Rotation' => true, + 'Orientation' => true, + + // Editable Metadata + 'Title' => true, + 'Description' => true, + 'Label' => true, + 'Artist' => true, + 'Copyright' => true, + + // Other image info + 'Rating' => true, + 'NumberOfImages' => true, + 'FlashType' => true, + 'RedEyeReduction' => true, + 'CircleOfConfusion' => true, + 'DOF' => true, + 'FOV' => true, + + // Currently unused fields + 'ExifVersion' => true, + + // Video info + 'Duration' => true, + 'FrameRate' => true, + 'TrackDuration' => true, + 'VideoCodec' => true, + ]; +} diff --git a/lib/Db/TimelineWrite.php b/lib/Db/TimelineWrite.php index 82927c9d..b57be324 100644 --- a/lib/Db/TimelineWrite.php +++ b/lib/Db/TimelineWrite.php @@ -11,8 +11,6 @@ use OCP\Files\File; use OCP\IDBConnection; use OCP\Lock\ILockingProvider; -require_once __DIR__.'/../ExifFields.php'; - const DELETE_TABLES = ['memories', 'memories_livephoto', 'memories_places']; const TRUNCATE_TABLES = ['memories_mapclusters']; @@ -290,7 +288,7 @@ class TimelineWrite } // Only keep fields in the whitelist - if (\array_key_exists($key, EXIF_FIELDS_LIST)) { + if (\array_key_exists($key, ExifFields::EXIF_FIELDS_LIST)) { $filteredExif[$key] = $value; } } diff --git a/lib/ExifFields.php b/lib/ExifFields.php deleted file mode 100644 index a9f43423..00000000 --- a/lib/ExifFields.php +++ /dev/null @@ -1,81 +0,0 @@ - true, - 'CreateDate' => true, - 'OffsetTimeOriginal' => true, - 'OffsetTime' => true, - - // Generated date fields - 'DateTimeEpoch' => true, - 'LocationTZID' => true, - - // Camera Info - 'Make' => true, - 'Model' => true, - 'LensModel' => true, - 'CameraType' => true, - 'AutoRotate' => true, - 'SerialNumber' => true, - - // Photo Info - 'FNumber' => true, - 'ApertureValue' => true, - 'FocalLength' => true, - 'ISO' => true, - 'ShutterSpeedValue' => true, - 'ShutterSpeed' => true, - 'ExposureTime' => true, - 'WhiteBalance' => true, - 'Sharpness' => true, - 'ColorTemperature' => true, - 'HDR' => true, - 'HDREffect' => true, - 'ColorSpace' => true, - 'Aperture' => true, - 'ImageUniqueID' => true, - - // GPS info - 'GPSLatitude' => true, - 'GPSLongitude' => true, - 'GPSAltitude' => true, - 'GPSTimeStamp' => true, - 'GPSStatus' => true, - - // Size / rotation info - 'Megapixels' => true, - 'Rotation' => true, - 'Orientation' => true, - - // Editable Metadata - 'Title' => true, - 'Description' => true, - 'Label' => true, - 'Artist' => true, - 'Copyright' => true, - - // Other image info - 'Rating' => true, - 'NumberOfImages' => true, - 'FlashType' => true, - 'RedEyeReduction' => true, - 'CircleOfConfusion' => true, - 'DOF' => true, - 'FOV' => true, - - // Currently unused fields - 'ExifVersion' => true, - - // Video info - 'Duration' => true, - 'FrameRate' => true, - 'TrackDuration' => true, - 'VideoCodec' => true, -];