As per the subject, I want to run a script on a collection of images,
can one do this with Digikam? I've found the Batch Queue Manager and one can use a "user shell script" with that. So is the interface documented anywhere - i.e. how are the file names presented to the script and how should they be returned? -- Chris Green · |
Hello Chris,
if you are on KDE, you can create a (python) script and register this in your desktop environment for the mime type JPG. In digikam select some images and click "open with" > "your script" from the context menu. This will start your script and pass the paths of all your selected images to your script as parameters. I use this very often in my digikam workflow. Regards, Peter On 14.09.2018 11:58, Chris Green wrote: > As per the subject, I want to run a script on a collection of images, > can one do this with Digikam? > > I've found the Batch Queue Manager and one can use a "user shell > script" with that. So is the interface documented anywhere - i.e. > how are the file names presented to the script and how should they be > returned? > |
Peter Albrecht <[hidden email]> wrote:
> Hello Chris, > > if you are on KDE, you can create a (python) script and register this in your > desktop environment for the mime type JPG. In digikam select some images and > click "open with" > "your script" from the context menu. > This will start your script and pass the paths of all your selected images to > your script as parameters. I use this very often in my digikam workflow. > I'm not KDE (one of the disadvantages of Digikam for me, it pulls in quite a lot of KDE stuff still) but I would think I could do something like the above on xubuntu by setting the mime type as you say for JPG. I'll try it, thanks. -- Chris Green · |
Try right click on a file or a group of files - open with - others - type in "terminal - e /path/to/your/script.sh %U" you might want to replace "terminal" with the name of the terminal emulator you use but I think it is called "terminal" in xubuntu. I also add '--no-close' option to review the output printed in the terminal before closing it. I am not sure if such option exists in xubuntu terminal but you can try. Sent from my Samsung Galaxy smartphone. -------- Original message -------- From: Chris Green <[hidden email]> Date: 2018-09-14 1:33 PM (GMT-07:00) To: [hidden email] Subject: Re: [digiKam-users] Is there a way to run an external program/script on selected images? > Hello Chris, > > if you are on KDE, you can create a (python) script and register this in your > desktop environment for the mime type JPG. In digikam select some images and > click "open with" > "your script" from the context menu. > This will start your script and pass the paths of all your selected images to > your script as parameters. I use this very often in my digikam workflow. > I'm not KDE (one of the disadvantages of Digikam for me, it pulls in quite a lot of KDE stuff still) but I would think I could do something like the above on xubuntu by setting the mime type as you say for JPG. I'll try it, thanks. -- Chris Green · |
I use xterm as a terminal for digikam scripts in Ubuntu, so it should work as
Xubuntu as well. /xterm -e /path/to/script.sh %U/ where %U is a list of the filenames of selected pictures that are passed as arguments to the script. -- Sent from: http://digikam.1695700.n4.nabble.com/digikam-users-f1735189.html |
woenx <[hidden email]> wrote:
> I use xterm as a terminal for digikam scripts in Ubuntu, so it should work as > Xubuntu as well. > > /xterm -e /path/to/script.sh %U/ > > where %U is a list of the filenames of selected pictures that are passed as > arguments to the script. > Excellent, thank you, that's a solid place to start from and I can customise etc. as I need. -- Chris Green · |
In reply to this post by woenx
woenx <[hidden email]> wrote:
> I use xterm as a terminal for digikam scripts in Ubuntu, so it should work as > Xubuntu as well. > > /xterm -e /path/to/script.sh %U/ > > where %U is a list of the filenames of selected pictures that are passed as > arguments to the script. > This doesn't work as expected. What happens (on my xubuntu 18.04 system running Digikam 5.9) is that the script is called once for each selected image with the parameter being the file name. I.e. I don't get the script called with "a list of the filenames of selected pictures". Is this a bug or as designed? -- Chris Green · |
Chris Green <[hidden email]> wrote:
> woenx <[hidden email]> wrote: > > I use xterm as a terminal for digikam scripts in Ubuntu, so it should work as > > Xubuntu as well. > > > > /xterm -e /path/to/script.sh %U/ > > > > where %U is a list of the filenames of selected pictures that are passed as > > arguments to the script. > > > This doesn't work as expected. What happens (on my xubuntu 18.04 > system running Digikam 5.9) is that the script is called once for each > selected image with the parameter being the file name. I.e. I don't > get the script called with "a list of the filenames of selected > pictures". > > Is this a bug or as designed? > I add some images to the queue in the Batch Queue Manager and then run a User Shell Script the script gets run separately for each image. This is not a lot of use if one wants to open a program with a list of images. Is there no way to select a number of images and output the list of their filenames so it can be fed into some other program? -- Chris Green · |
In reply to this post by Chris Green
On mercredi 19 septembre 2018 12:48:37 CEST Chris Green wrote:
> woenx <[hidden email]> wrote: > > I use xterm as a terminal for digikam scripts in Ubuntu, so it should work > > as Xubuntu as well. > > > > /xterm -e /path/to/script.sh %U/ > > > > where %U is a list of the filenames of selected pictures that are passed > > as > > arguments to the script. > > This doesn't work as expected. What happens (on my xubuntu 18.04 > system running Digikam 5.9) is that the script is called once for each > selected image with the parameter being the file name. I.e. I don't > get the script called with "a list of the filenames of selected > pictures". > > Is this a bug or as designed? https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html As you can see there, there's a difference between "%U" and "%u". Are you sure you used the uppercase version? Remco |
That's weird.
Yes, I am sure i'm using the capital %U, I just checked again just in case. This is the command I use: xterm -e /home/user/Desktop/whatsdate.sh %U And here's the script I use: https://pastebin.com/8qCG3csG It sets the EXIF date based on the selected pictures filename (e.g. IMG_20180403_2315.jpg would set the EXIF date to 2018-04-03 23:15). You can modify whatever it is inside the for i in "${arguments[@]}" do and it should apply that code file by file from the list of selected pictures. -- Sent from: http://digikam.1695700.n4.nabble.com/digikam-users-f1735189.html |
On mercredi 19 septembre 2018 13:51:33 CEST woenx wrote:
> That's weird. > > Yes, I am sure i'm using the capital %U, I just checked again just in case. > This is the command I use: > > xterm -e /home/user/Desktop/whatsdate.sh %U I thought I was replying to Chris Green, who did *not* get the whole file list as parameter for the script. The behaviour you described is what's expected with "%U". From the link I posted earlier: | %u A single URL. Local files may either be passed as file: URLs or as file path. | %U A list of URLs. Each URL is passed as a separate argument to the executable program. Local files may either be passed as file: URLs or as file path. Remco |
Yes, I thought I was replying to Chris Green as well, but I saw my mistake
right after I sent the message. Sorry. Anyway, I just wanted to provide an example that works under ubuntu 18.04. The script can be easiky tweaked for whatever purpose is necessary. -- Sent from: http://digikam.1695700.n4.nabble.com/digikam-users-f1735189.html |
Did you try %f or %F ? Sent from my Samsung Galaxy smartphone. -------- Original message -------- From: woenx <[hidden email]> Date: 2018-09-19 8:30 AM (GMT-07:00) To: [hidden email] Subject: Re: [digiKam-users] Is there a way to run an external program/script on selected images? right after I sent the message. Sorry. Anyway, I just wanted to provide an example that works under ubuntu 18.04. The script can be easiky tweaked for whatever purpose is necessary. -- Sent from: http://digikam.1695700.n4.nabble.com/digikam-users-f1735189.html |
In reply to this post by woenx
Did you try a different terminal emulator ? xterm should be good though. Sent from my Samsung Galaxy smartphone. -------- Original message -------- From: woenx <[hidden email]> Date: 2018-09-19 5:51 AM (GMT-07:00) To: [hidden email] Subject: Re: [digiKam-users] Is there a way to run an external program/script on selected images? Yes, I am sure i'm using the capital %U, I just checked again just in case. This is the command I use: xterm -e /home/user/Desktop/whatsdate.sh %U And here's the script I use: https://pastebin.com/8qCG3csG It sets the EXIF date based on the selected pictures filename (e.g. IMG_20180403_2315.jpg would set the EXIF date to 2018-04-03 23:15). You can modify whatever it is inside the for i in "${arguments[@]}" do and it should apply that code file by file from the list of selected pictures. -- Sent from: http://digikam.1695700.n4.nabble.com/digikam-users-f1735189.html |
In reply to this post by Remco Viëtor
Remco Viëtor <[hidden email]> wrote:
> On mercredi 19 septembre 2018 12:48:37 CEST Chris Green wrote: > > woenx <[hidden email]> wrote: > > > I use xterm as a terminal for digikam scripts in Ubuntu, so it should work > > > as Xubuntu as well. > > > > > > /xterm -e /path/to/script.sh %U/ > > > > > > where %U is a list of the filenames of selected pictures that are passed > > > as > > > arguments to the script. > > > > This doesn't work as expected. What happens (on my xubuntu 18.04 > > system running Digikam 5.9) is that the script is called once for each > > selected image with the parameter being the file name. I.e. I don't > > get the script called with "a list of the filenames of selected > > pictures". > > > > Is this a bug or as designed? > A bit of googling lead to this: > https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html > > As you can see there, there's a difference between "%U" and "%u". Are you sure > you used the uppercase version? > JPEG set up to run a script. If I select a number of files in my file manager and open them (with the default application for JPEG) then one instance of the script gets run with all the names as an argument. If I "Open with Default Application" in Digikam I get my script started up once for each image with one name as an argument. The desktop file for my script has:- Exec=/home/chris/.cfg/bin/setmeta %U -- Chris Green · |
In reply to this post by Remco Viëtor
Remco Viëtor <[hidden email]> wrote:
> On mercredi 19 septembre 2018 13:51:33 CEST woenx wrote: > > That's weird. > > > > Yes, I am sure i'm using the capital %U, I just checked again just in case. > > This is the command I use: > > > > xterm -e /home/user/Desktop/whatsdate.sh %U > I thought I was replying to Chris Green, who did *not* get the whole file list > as parameter for the script. The behaviour you described is what's expected > with "%U". From the link I posted earlier: > | %u A single URL. Local files may either be passed as file: URLs or as file > path. > | %U A list of URLs. Each URL is passed as a separate argument to the > executable program. Local files may either be passed as file: URLs or as file > path. > was called several times with one file name as the parameter or once with several file names as the parameters it would still work. -- Chris Green · |
Free forum by Nabble | Edit this page |