gphoto2 icon indicating copy to clipboard operation
gphoto2 copied to clipboard

Is it possible to increment filename starting from specific number

Open bkapadia01 opened this issue 3 years ago • 9 comments

Describe the bug

I'd like to increment the filename starting at 0 instead of 1 for one of the threads I have running, is this possible?

Currently I'm doing to increment each image taken

gphoto2 \
--port $port0 \
--filename %03n-TOP_%Y-%m-%d_%H-%M-%S.%C \
--capture-image-and-download --interval -1 

The out is:

001-TOP_2021-04-03_20-55-12.jpg
002-TOP_2021-04-03_20-55-17.jpg
003-TOP_2021-04-03_20-55-21.jpg
004-TOP_2021-04-03_20-55-26.jpg

Is there a way to initiate the count from 000 instead of 001 or any other 3 digit specified starting point? so I would expect:

000-TOP_2021-04-03_20-55-12.jpg
001-TOP_2021-04-03_20-55-17.jpg
002-TOP_2021-04-03_20-55-21.jpg
003-TOP_2021-04-03_20-55-26.jpg

Is there another way of accomplishing this using the filename conversion specifier?

Name the camera Canon EOS 5DS R

libgphoto2 and gphoto2 version output of: gphoto2 --version 2.5.27

bkapadia01 avatar Apr 04 '21 01:04 bkapadia01

Note. This question/issue regarding the leading zeros combined with other digits to have more control over the starting point applies for libphoto2 as well.

vepicurean avatar Apr 04 '21 07:04 vepicurean

it is currently not possible , but a new option could be added to gphoto2 commandline tool to set this number if wanted.

msmeissn avatar Apr 04 '21 08:04 msmeissn

Thanks for the reply. Adding an option for this functionality to help control the file naming structure via gphoto2 -- command would be great. We'd implement via our scripts. If you have time to implement the functionality via the command line tool for libgphoto2/gphoto2, we'll test it out and give you feedback right away.

What about the ability to implement this feature with any digit(s) at the start?

e.g. start at 000-TOP_2021_XYY_etc or 003-TOP_2021_XYZ_etc or 00004-TOP_2021_XYZ_etc or 0031-TOP_2021_XYZ_etc and then increment by 1 with each capture as needed?

vepicurean avatar Apr 04 '21 14:04 vepicurean

I implemented this in current git, using --filenumber NUMBER e.g.

gphoto2
--port $port0
--filenumber 42 --filename %03n-TOP_%Y-%m-%d_%H-%M-%S.%C
--capture-image-and-download --interval -1

untested so far

msmeissn avatar Apr 08 '21 16:04 msmeissn

Thanks for this. Greatly appreciated.

I'll set up a development environment to this this new file naming functionality. I'll let you know how it goes. Will take me/us a few weeks to test thoroughly and get back to you.

Thanks, again.

vepicurean avatar Apr 11 '21 14:04 vepicurean

i tested it in the meantime, and it seems to work for me at least.

msmeissn avatar Apr 14 '21 16:04 msmeissn

Update:

We still have not tested new --filenumber=NUMBER functionality in production which is running libgphoto2 2.5.27 from the Homebrew package manager repository. When I tried it, it was clear this new functionality is not yet available on the Homebrew version of 2.5.27

But on the GitHub libghoto2 main branch of 2.5.27.1 --filenumber=NUMBER is working OK for us on our test systems.

I'm assuming --filenumber=NUMBER will be implemented in the next public stable version of libgphoto2, so that it should be available in the version of libgphoto2 on the Homebrew package manager in the fall?

Also, how would we be able to use --filenumber=NUMBER with the --eosremoterelease="Full Release" and --wait-event-and-download="CAPTURECOMPLETE" method of remotely triggering the shutter and downloading the image, since this method kills the process each time and does not increment the value of NUMBER each time a capture is triggered the same way --capture-image-and-download does?

vepicurean avatar Sep 04 '21 19:09 vepicurean

The functionality is in the gphoto2 commandline tool, currently unreleased 2.5.27.1 development.

I need to create a new release, not sure when the next weekend will be available, but I hope soonish.

For the new report ... I could perhaps add support where it looks for the next free file in that scheme to save to..?

msmeissn avatar Sep 05 '21 11:09 msmeissn

The functionality is in the gphoto2 commandline tool, currently unreleased 2.5.27.1 development.

I need to create a new release, not sure when the next weekend will be available, but I hope soonish.

For the new report ... I could perhaps add support where it looks for the next free file in that scheme to save to..?

Thanks for the info on the next release. Appreciated.

I'm not sure I'm understanding you when you saying regarding "..... it looks for the next free file in that scheme to save to..?"

Do you mean it would search from the previous image file saved using --filename=NUMBER and then increment the "number" value by 1? I'm not sure if that is what you mean. Would that not take a long time to lookup? Speed in the capture and download process I need to keep as fast as possible. Well under 4 seconds is possible using --filenumber=NUMBER --eosremoterelease="Immediate" --eosremoterelease="Full Release" --wait-event-and-download="FILEADDED"

vepicurean avatar Sep 07 '21 02:09 vepicurean