From ce96095e37d44d91c99d5f7c76ea3be3e3f193ba Mon Sep 17 00:00:00 2001 From: Colin Clark Date: Wed, 5 Jun 2019 10:32:53 +0100 Subject: [PATCH] Camera import - warn of duplicate filenames Digital cameras can have files of the same name in several sub-folders. Detect this and warn the user that some files will not be downloaded. --- doc/docbook/GuideReferenceStandardPlugins.xml | 7 +++++++ plugins/camera-import/geeqie-camera-import | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/doc/docbook/GuideReferenceStandardPlugins.xml b/doc/docbook/GuideReferenceStandardPlugins.xml index 2d1e779d..bfbde9ae 100644 --- a/doc/docbook/GuideReferenceStandardPlugins.xml +++ b/doc/docbook/GuideReferenceStandardPlugins.xml @@ -58,6 +58,13 @@
Camera import Imports images from an attached camera to the current folder. If a file with the same name already exists it will not be overwritten, and the new image will not be downloaded. + File names on digital cameras are not necessarily unique. In some cases the same file name can exist in more than one sub-folder on the camera. As existing images will not be overwritten, subsequent files of the same name will not be downloaded. In this case a dialog will be shown to warn you of this. + + You may use the gphoto2 option + --filename + option to ensure that all filenames are unique when downloading. Refer to the + gphoto2 documentation. + This item is displayed in the Plugins diff --git a/plugins/camera-import/geeqie-camera-import b/plugins/camera-import/geeqie-camera-import index 40cca5f4..943617b9 100755 --- a/plugins/camera-import/geeqie-camera-import +++ b/plugins/camera-import/geeqie-camera-import @@ -113,6 +113,17 @@ fi ls -1 | sort > $dest_files_sorted existing_file_count=$(comm -12 $src_files_sorted $dest_files_sorted | wc -l) +repeated=$(uniq --repeated $src_files_sorted) +if [ ! -z "$repeated" ] +then + repeated="Warning: The following source filenames are not unique.\nSome files may not be downloaded.\nSee the Help file.\n\n$repeated" + zenity --question --text="$repeated" --title="Geeqie camera import" --cancel-label="OK" --ok-label="Cancel" --width=400 --window-icon=/usr/local/share/pixmaps/geeqie.png 2>/dev/null + if [[ $? == 0 ]] + then + exit 1 + fi +fi + total=$(cat $src_files_sorted | wc -l) files_to_load=$(( $total - $existing_file_count )) -- 2.20.1