Last Pictures ID, how to retrieve it?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Last Pictures ID, how to retrieve it?

fredaine
Hi all,

I would like to know how can I easily catch the identifier (the picture number) of the last picture present on the memory card of the camera.
I do it actually using the "gphoto2 --list-files" command and capture the last ID communicated. But it is really long or completely unresponsive when more than 15000 pictures are stored on memory card.
I didn't see how can I do it easily.

Cameras used : Canon 100D and an old 400D.

The final goal of this is to download only the last picture and do a sort of supervision using the ID to count the number of pictures taken for example each day. I am doing really long timelapse...

Thank you in advance for your help.
Br,
Fred

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gphoto-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-user
Reply | Threaded
Open this post in threaded view
|

Re: Last Pictures ID, how to retrieve it?

fredaine
Note I'm not a developer and not a Linux specialist. This is the reason why I am asking your help.

Here are the two commands I use for the task explained in previous email:
  # get the picture number
 lastId=`gphoto2 --list-files | tail -2 | awk '{print substr($1, 2)}' | head -n 1`
  # ... A few code lines to check and log the value of lastId
  # download the file
  gphoto2 --get-file $lastId --force-overwrite

Do you know a more efficient alternative skipping the long, very long, file list creation...?

Thank you.
Best regards,
Fred

Le 16 mars 2017 9:00 PM, Frédéric Leunen <[hidden email]> a écrit :
Hi all,

I would like to know how can I easily catch the identifier (the picture number) of the last picture present on the memory card of the camera.
I do it actually using the "gphoto2 --list-files" command and capture the last ID communicated. But it is really long or completely unresponsive when more than 15000 pictures are stored on memory card.
I didn't see how can I do it easily.

Cameras used : Canon 100D and an old 400D.

The final goal of this is to download only the last picture and do a sort of supervision using the ID to count the number of pictures taken for example each day. I am doing really long timelapse...

Thank you in advance for your help.
Br,
Fred


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gphoto-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-user
Reply | Threaded
Open this post in threaded view
|

Re: Last Pictures ID, how to retrieve it?

Marcus Meissner-4
Hi,

This problem is kind of hard to solve, as PTP directory/file listing handling is kind of backwards,
you need to get all file information to get a directory tree.

This is especially bad if you have all the thousands photos in just one DCIM/xxx/ folder.

It _could_ help if you use multiple DCIM folders and let the camera do
new ones every 100 pictures, so you could find out the folders and only
look at the last one for determining the last image.

Or...

If your camera is attached to USB while capturing you can watch the files being
added with --wait-event=10000s  (long timeout)

Ciao, Marcus

On Sat, Mar 18, 2017 at 10:19:35AM +0100, Frédéric Leunen wrote:
> Note I'm not a developer and not a Linux specialist. This is the reason why I am asking your help.

> Here are the two commands I use for the task explained in previous email:

# get the picture number
lastId=`gphoto2 --list-files | tail -2 | awk '{print substr(<span class="money">$1,</span> 2)}' | head -n 1`
# ... A few code lines to check and log the value of lastId
# download the file
gphoto2 --get-file $lastId --force-overwrite

Do you know a more efficient alternative skipping the long, very long, file list creation...?


Thank you.

Best regards,

Fred

Le&nbsp;16 mars 2017 9:00 PM, Frédéric Leunen &lt;[hidden email]&gt; a écrit&nbsp;:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi all,

I would like to know how can I easily catch the identifier (the picture number) of the last picture present on the memory card of the camera.

I do it actually using the "gphoto2 --list-files" command and capture the last ID communicated. But it is really long or completely unresponsive when more than 15000 pictures are stored on memory card.

I didn't see how can I do it easily.

Cameras used : Canon 100D and an old 400D.

The final goal of this is to download only the last picture and do a sort of supervision using the ID to count the number of pictures taken for example each day. I am doing really long timelapse...

Thank you in advance for your help.

Br,

Fred

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gphoto-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-user