From 391226f56bb70d9e280beae3e70fcfc41d46cf03 Mon Sep 17 00:00:00 2001 From: Ming Ming Date: Thu, 6 May 2021 14:29:46 +0800 Subject: [PATCH] Only scan metadata for images --- lib/entity/file_util.dart | 3 +++ lib/use_case/scan_missing_metadata.dart | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/entity/file_util.dart b/lib/entity/file_util.dart index f4829555..6b68d866 100644 --- a/lib/entity/file_util.dart +++ b/lib/entity/file_util.dart @@ -3,6 +3,9 @@ import 'package:nc_photos/entity/file.dart'; bool isSupportedFormat(File file) => _supportedFormatMimes.contains(file.contentType); +bool isSupportedImageFormat(File file) => + isSupportedFormat(file) && file.contentType?.startsWith("image/") == true; + const _supportedFormatMimes = [ "image/jpeg", "image/png", diff --git a/lib/use_case/scan_missing_metadata.dart b/lib/use_case/scan_missing_metadata.dart index 03510bf9..08ea6826 100644 --- a/lib/use_case/scan_missing_metadata.dart +++ b/lib/use_case/scan_missing_metadata.dart @@ -19,7 +19,7 @@ class ScanMissingMetadata { continue; } final missingMetadata = (d as List).where((element) => - file_util.isSupportedFormat(element) && element.metadata == null); + file_util.isSupportedImageFormat(element) && element.metadata == null); for (final f in missingMetadata) { yield f; }