From ec0012d43888dd17d605d167d4e708322e0a1924 Mon Sep 17 00:00:00 2001 From: Colin Clark Date: Tue, 23 Oct 2018 19:44:36 +0100 Subject: [PATCH] Plugin for tethered photography Basic tethered photography using gphoto2 --- configure.in | 1 + plugins/Makefile.am | 2 +- plugins/tethered-photography/Makefile.am | 9 ++++ .../geeqie-tethered-photography | 48 +++++++++++++++++++ .../geeqie-tethered-photography-hook-script | 11 +++++ .../tethered-photography.desktop.in | 15 ++++++ po/POTFILES.in | 1 + web/geeqie-install-debian.sh | 4 +- 8 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 plugins/tethered-photography/Makefile.am create mode 100755 plugins/tethered-photography/geeqie-tethered-photography create mode 100755 plugins/tethered-photography/geeqie-tethered-photography-hook-script create mode 100644 plugins/tethered-photography/tethered-photography.desktop.in diff --git a/configure.in b/configure.in index 178f657e..0998fd90 100644 --- a/configure.in +++ b/configure.in @@ -620,6 +620,7 @@ AC_CONFIG_FILES([ plugins/import/Makefile plugins/geocode-parameters/Makefile plugins/export-jpeg/Makefile + plugins/tethered-photography/Makefile geeqie.spec ]) diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 9176d2b3..0c8219f5 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -1,6 +1,6 @@ #FIXME enable or disable individual plugins from configure -SUBDIRS = rotate symlink ufraw import geocode-parameters export-jpeg +SUBDIRS = rotate symlink ufraw import geocode-parameters export-jpeg tethered-photography qq_desktoptemplatedir = $(appdir) qq_desktoptemplate_DATA = template.desktop diff --git a/plugins/tethered-photography/Makefile.am b/plugins/tethered-photography/Makefile.am new file mode 100644 index 00000000..841b4679 --- /dev/null +++ b/plugins/tethered-photography/Makefile.am @@ -0,0 +1,9 @@ +dist_gq_bin_SCRIPTS = geeqie-tethered-photography geeqie-tethered-photography-hook-script + +gq_desktopdir = $(appdir)/applications +gq_desktop_in_files = tethered-photography.desktop.in +gq_desktop_DATA = $(gq_desktop_in_files:.desktop.in=.desktop) +@INTLTOOL_DESKTOP_RULE@ + +EXTRA_DIST = $(gq_desktop_in_files) +CLEANFILES = $(gq_desktop_DATA) diff --git a/plugins/tethered-photography/geeqie-tethered-photography b/plugins/tethered-photography/geeqie-tethered-photography new file mode 100755 index 00000000..b762aed9 --- /dev/null +++ b/plugins/tethered-photography/geeqie-tethered-photography @@ -0,0 +1,48 @@ +#!/bin/bash + +# Tethered photography +# Requires gphoto2 +# +# If a file already exists with the same name, it is not overwritten, but the +# download will not take place. +# Auto-rename can be achieved with the --filename option of gphoto2. +# In file $HOME/.config/gphoto2/settings, set the option: +# gphoto2=filename= + +n=$(ps -e | grep "geeqie-tethered" | wc -l) +if [ "$n" -ge 3 ] +then + exit 0 +fi + +if ! [ -x "$(command -v gphoto2)" ] +then + zenity --title="Geeqie tethered photography" --info --width=200 --text="gphoto2 is not installed" 2>/dev/null + exit 0 +fi + +if [ $(gphoto2 --auto-detect | wc -l) -le 2 ] +then + zenity --error --title="Geeqie tethered photography" --text="No camera detected" --window-icon=/usr/local/share/pixmaps/geeqie.png --width=250 2>/dev/null + exit 0 +fi + +notify-send --expire-time=2000 "$(gphoto2 --auto-detect | sed -n '3p')" --icon=geeqie + +script_dir=$(dirname "$0") + +tmpfile=$(mktemp --tmpdir geeqie_tethered_photography_XXXXXX) + +yes n | gphoto2 --hook-script "$script_dir/"geeqie-tethered-photography-hook-script --capture-tethered >$tmpfile & + +gphoto2_pid=$! + +zenity --question --title="Geeqie tethered photography" --ok-label="Stop" --cancel-label="Show log data" --text="Tethered photography is running.\n\n\nDownloading to folder:\n""$PWD\n\n\nExisting files will not be overwritten,\nbut the download will not take place.\n\n(Use gphoto2 --filename default option\nfor auto-rename on download)" --width=300 --window-icon=/usr/local/share/pixmaps/geeqie.png 2>/dev/null + +if [ $? == 1 ] +then + zenity --text-info --title="Geeqie tethered photography" --window-icon=/usr/local/share/pixmaps/geeqie.png --ok-label="Stop" --cancel-label="Abort" <$tmpfile 2>/dev/null +fi + +kill $gphoto2_pid +rm $tmpfile diff --git a/plugins/tethered-photography/geeqie-tethered-photography-hook-script b/plugins/tethered-photography/geeqie-tethered-photography-hook-script new file mode 100755 index 00000000..8df15b9e --- /dev/null +++ b/plugins/tethered-photography/geeqie-tethered-photography-hook-script @@ -0,0 +1,11 @@ +#!/bin/bash + +# Tethered photography + +if [ "$ACTION" == "download" ] +then + notify-send --expire-time=4000 "$ARGUMENT" --icon=geeqie + geeqie --remote File:"$PWD/$ARGUMENT" +fi + +exit 0 diff --git a/plugins/tethered-photography/tethered-photography.desktop.in b/plugins/tethered-photography/tethered-photography.desktop.in new file mode 100644 index 00000000..5ffdb35a --- /dev/null +++ b/plugins/tethered-photography/tethered-photography.desktop.in @@ -0,0 +1,15 @@ +[Desktop Entry] +Version=1.0 +Type=Application +_Name=Tethered photography + +Exec=geeqie-tethered-photography + +# Desktop files that are usable only in Geeqie should be marked like this: +Categories=X-Geeqie; +OnlyShowIn=X-Geeqie; + +# It can be made verbose +#X-Geeqie-Verbose=true + +Icon=geeqie diff --git a/po/POTFILES.in b/po/POTFILES.in index 7229417c..a09c6d15 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -2,6 +2,7 @@ geeqie.desktop.in plugins/import/geeqie-import-geeqie.desktop.in plugins/import/geeqie-import-gqview.desktop.in plugins/export-jpeg/export-jpeg.desktop.in +plugins/tethered-photography/tethered-photography.desktop.in plugins/rotate/rotate.desktop.in plugins/symlink/symlink.desktop.in plugins/ufraw/geeqie-ufraw.desktop.in diff --git a/web/geeqie-install-debian.sh b/web/geeqie-install-debian.sh index 1c61d985..87471108 100755 --- a/web/geeqie-install-debian.sh +++ b/web/geeqie-install-debian.sh @@ -1,5 +1,5 @@ #!/bin/bash -version="2018-10-14" +version="2018-10-23" description=$' Geeqie is an image viewer. This script will download, compile, and install Geeqie on Debian-based systems. @@ -57,6 +57,8 @@ optional_array=( "liblcms2-utils" "markdown (for generating README help file)" "markdown" +"gphoto2 (for tethered photography)" +"gphoto2" ) # Optional for GTK3 only -- 2.20.1