Bug 393382 - Add documentation section about the BQM custom shell scripts tool.
Summary: Add documentation section about the BQM custom shell scripts tool.
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Documentation (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-22 02:13 UTC by Dav
Modified: 2023-08-17 20:06 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 8.0.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dav 2018-04-22 02:13:55 UTC
Hi there,

I was wondering how to use a custom shell script in the batchQueueManager but can"t find anything in the official documentation.
Would you mind define this part in?

Regards
Comment 1 Maik Qualmann 2018-04-29 09:34:19 UTC
It is important for the BQM to know that always a $OUTPUT file has to be created. So, if your script does not create a new image, for example, just change metadata, you must always first copy $INPUT to $OUTPUT in the script. Then you can make the changes to $OUTPUT.

Maik
Comment 2 Dav 2018-05-15 04:37:08 UTC
Hello Malk,

Do you have a simple example to share?

Regards
Comment 3 Maik Qualmann 2018-05-15 06:10:45 UTC
Here is a simple example that removes all metadata with exiftool from a image (There is also a tool in the BQM for this). As I said, the cp command is only necessary if the shell command does not create a new target ($OUTPUT).

------------------------------------------
cp $INPUT $OUTPUT
exiftool -all= -overwrite_original $OUTPUT
------------------------------------------

Maik
Comment 4 caulier.gilles 2023-01-20 09:29:57 UTC
Git commit 0c2ff42f9ef06e22e93a510c345b1f543371e484 by Gilles Caulier.
Committed on 20/01/2023 at 09:27.
Pushed by cgilles into branch 'master'.

start to write BQM Custom Script section on online manual

M  +1    -1    TODO
M  +1    -0    batch_queue.rst
M  +1    -1    batch_queue/base_tools.rst
M  +1    -1    batch_queue/batchqueue_overview.rst
A  +22   -0    batch_queue/custom_script.rst
R  +-    --    batch_queue/images/bqm_base_tools_view.webp [from: batch_queue/images/base_tools_view.webp - 100% similarity]
A  +-    --    batch_queue/images/bqm_custom_script.webp
R  +-    --    batch_queue/images/bqm_main_view.webp [from: batch_queue/images/batch_queue.webp - 100% similarity]
R  +-    --    batch_queue/images/bqm_raw_converter.webp [from: batch_queue/images/raw_converter.webp - 100% similarity]
M  +1    -1    batch_queue/raw_converter.rst
M  +4    -0    index.rst

https://invent.kde.org/documentation/digikam-doc/commit/0c2ff42f9ef06e22e93a510c345b1f543371e484
Comment 5 caulier.gilles 2023-01-20 10:21:59 UTC
Git commit 97e850e09dec6d295a88f6fb5afdff64dd64b2f4 by Gilles Caulier.
Committed on 20/01/2023 at 10:21.
Pushed by cgilles into branch 'master'.

Custom Script BQM toom doc++

M  +33   -0    batch_queue/custom_script.rst

https://invent.kde.org/documentation/digikam-doc/commit/97e850e09dec6d295a88f6fb5afdff64dd64b2f4
Comment 6 caulier.gilles 2023-01-20 13:50:38 UTC
Git commit c0e5ccd8dba15ef312851237fb8fd479ae32041d by Gilles Caulier.
Committed on 20/01/2023 at 13:49.
Pushed by cgilles into branch 'master'.

add details about return code managed by Custom Script
add first example of script code

M  +34   -1    batch_queue/custom_script.rst

https://invent.kde.org/documentation/digikam-doc/commit/c0e5ccd8dba15ef312851237fb8fd479ae32041d
Comment 7 caulier.gilles 2023-01-20 14:47:44 UTC
Git commit 37d2d10f3c0d572f1cd2350cd24c6181ba04310f by Gilles Caulier.
Committed on 20/01/2023 at 14:46.
Pushed by cgilles into branch 'master'.

BQM Custom Script: add second example using ImageMagick to add a watermark over an image.
FIXED-IN: 8.0.0

M  +26   -2    batch_queue/custom_script.rst
A  +-    --    batch_queue/images/bqm_imagemagick_watermark.webp

https://invent.kde.org/documentation/digikam-doc/commit/37d2d10f3c0d572f1cd2350cd24c6181ba04310f
Comment 8 caulier.gilles 2023-01-20 14:53:46 UTC
Maik,

Please take a look to the User Script BQM tool online doc to see lā€™m wrong somewhere or if something can be improved :

https://docs.digikam.org/en/batch_queue/custom_script.html

Gilles
Comment 9 Maik Qualmann 2023-01-20 20:43:26 UTC
Two things, you already wrote it, but maybe a little more clearly, that a new file is always expected on $OUTPUT. So with script programs that do not create a new file (e.g. changing metadata) you must first copy $INPUT to $OUTPUT with a command appropriate to the operating system and then make the changes to $OUTPUT.

On Windows, it's not a Batch script that we're running. I don't know any way how to run a script with cmd.exe. If you know one, we can change it. Powershell can probably do it.

We split the digiKam script lines and join them with " && " and start the cmd.exe with the /C option.

Before:
command1
command2
command3

After:
cmd.exe /C command1 && command2 && command3

Therefore, under Windows, the script should not contain any blank lines or comment lines.

Maik
Comment 10 Maik Qualmann 2023-01-20 21:14:30 UTC
I think if we save the script temporarily on Windows beforehand, we can run it with the cmd.exe.

Maik
Comment 11 caulier.gilles 2023-01-21 04:34:48 UTC
Git commit f801eb48cf1a707450e30073fd5257fdf8aa5e22 by Gilles Caulier.
Committed on 21/01/2023 at 04:34.
Pushed by cgilles into branch 'master'.

Add comments from Maik

M  +17   -6    batch_queue/custom_script.rst

https://invent.kde.org/documentation/digikam-doc/commit/f801eb48cf1a707450e30073fd5257fdf8aa5e22
Comment 12 Maik Qualmann 2023-01-21 07:16:40 UTC
Git commit 833ebbb6ec5896e860a24a1189bd9b681c3bae84 by Maik Qualmann.
Committed on 21/01/2023 at 07:15.
Pushed by mqualmann into branch 'master'.

try to start a real batch script on Windows

M  +38   -14   core/dplugins/bqm/custom/userscript/userscript.cpp

https://invent.kde.org/graphics/digikam/commit/833ebbb6ec5896e860a24a1189bd9b681c3bae84
Comment 13 Maik Qualmann 2023-01-21 13:40:28 UTC
Batch script works now fine on Windows.

Maik
Comment 14 caulier.gilles 2023-01-21 15:57:26 UTC
Great. In the doc we write that empty lines and comments are prohibited. This is always the case ?

Gilles
Comment 15 Maik Qualmann 2023-01-21 16:04:38 UTC
No, this passage in the doc can now be removed again.

Maik
Comment 16 caulier.gilles 2023-01-21 16:07:00 UTC
Git commit 397c9e4d0a2c437e50c09ecc0e9023f000f8dfb0 by Gilles Caulier.
Committed on 21/01/2023 at 16:06.
Pushed by cgilles into branch 'master'.

remove obsolte notes for Windows

M  +1    -1    batch_queue/custom_script.rst

https://invent.kde.org/documentation/digikam-doc/commit/397c9e4d0a2c437e50c09ecc0e9023f000f8dfb0
Comment 17 Maik Qualmann 2023-01-21 16:09:58 UTC
Gilles, did you see that there is a merge request in the doc repository?

Maik
Comment 18 caulier.gilles 2023-01-21 16:22:06 UTC
No. I don't understand why we are not automatically in CC... I take a look.
Comment 19 Such A Shame 2023-06-27 15:18:21 UTC
*** Bug 471492 has been marked as a duplicate of this bug. ***
Comment 20 Such A Shame 2023-08-17 20:06:09 UTC
Can't make scripts work without constantly getting "Failed to process item..." & "Failed to create file..." however occasionally file is there after refreshing. Applies for both images and sound.

BQM seems to have base tool for cropping but why it's not possible to do cropping to center as it would possibly be the most likely use case?

There's plenty of very nice tools in this software but these could be made more intuitive and effective to use.