CHDK PTP--downloading files from cam - Script Writing - CHDK Forum  

CHDK PTP--downloading files from cam

  • 2 Replies
  • 6433 Views
CHDK PTP--downloading files from cam
« on: 11 / December / 2012, 16:38:07 »
Advertisements
Hey all...I am hoping to be a contributor at some point here but i need a little help with our camera array project.

I am writing a batch file to download the images from camera and have some syntax issues I cannot resolve.

We have 60 A810's. Shooting happens...then we will manually turn off remote enabled in the menu so that we can connect to them via PTP. the script then gets a list of cameras and I want to loop through the list and download all files off all the cameras.

How do I connect to each camera via bus and dev # to DL all images?

Thanks all..

Here is what I have so far...
TITLE TRACY RULEZ
cls
@echo off
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION

REM Create List of cameras with BUS id
C:\Users\tracy\Desktop\scipts\ptpcam -l > C:\Users\tracy\Desktop\scipts\cameraList.dat

REM ~ Gathers the info from accesible information on the camera by polling certain PTP commands
echo Checking Camera Info...
   C:\Users\tracy\Desktop\scipts\ptpcam -i > C:\Users\tracy\Desktop\scipts\tmp.dat
   FOR /F "tokens=2 delims='" %%A IN (C:\Users\tracy\Desktop\scipts\tmp.dat)DO SET theDir=%%A
   FOR /F "tokens=2 delims='" %%A IN (C:\Users\tracy\Desktop\scipts\tmp.dat)DO mkdir %%A
   FOR /F "tokens=2 delims='" %%A IN (C:\Users\tracy\Desktop\scipts\tmp.dat)DO copy C:\Users\tracy\Desktop\scipts\tmp.dat %%A\camID.dat
   FOR /F "tokens=2 delims='" %%A IN (C:\Users\tracy\Desktop\scipts\tmp.dat)DO C:\Users\tracy\Desktop\scipts\ptpcam -L > %%A\Filelist.dat
      timeout 2

REM ~ Creat a list on camera side with proper download path ******REMEMBER THE ////////////***********
REM ~ This is a file on the cameras named lptgui in the CHDK LUA script Place on the CHDK folder dcimdl MUST BE FALSE
   echo CREATING fILELIST ON CAMERA
   C:\Users\tracy\Desktop\scipts\ptpcam --chdk="luar require('lptpgui').dcimdl(false)"
   timeout 2
   cls

REM ~ Downloads fileslist with /// seperators from camera to the parsefile.txt
   echo DOWNLOADING FILELIST
   C:\Users\tracy\Desktop\scipts\ptpcam --chdk="download A/ptpgui.txt C:\Users\tracy\Desktop\scipts\%theDir%\parsefile.txt"
   timeout 2
   cls

REM ~ Creates the IMAGES directory in %theDir% (AKA Camera ID Folder) Created
   echo Creating DL Dir @ %theDir%\IMAGES
   mkdir %theDir%\IMAGES_ON_Camera_X


REM ~ Creates the path variable and filename variable to do the ptp CHDK download using the same filename that the camera creates for tracking
REM ~ Thinking maybe a time stamp here too. can do that on the ptpgui file created on camera end.
for /f "tokens=* delims=/" %%b in (C:\Users\tracy\Desktop\scipts\%theDir%\parsefile.txt)DO (
   set camPath=%%b
   set camPath=!campath:~0,24!
   set localFilename=%%b
   set localFilename=!filename:~16,12!
   C:\Users\tracy\Desktop\scipts\ptpcam --chdk="download" %campath% C:\Users\tracy\Desktop\scipts\%theDir%\localFilename"

ENDLOCAL

echo DONE DIDDLEY DONE

Re: CHDK PTP--downloading files from cam
« Reply #1 on: 11 / December / 2012, 20:08:03 »
Have it DL from one camera...Now to figure out the syntax of going through the cameras to DL all of the images.

a ptpcam --chdk -l gives me:

Listing devices...
bus/dev   vendorID/prodID   device model
bus-0/\\.\libusb0-0001--0x04a9-0x323f   0x04A9/0x323F   Canon PowerShot A810
bus-0/\\.\libusb0-0002--0x04a9-0x323f   0x04A9/0x323F   Canon PowerShot A810

How would I list the files on each??

Tracy

Re: CHDK PTP--downloading files from cam
« Reply #2 on: 11 / December / 2012, 22:33:55 »
We have 60 A810's. Shooting happens...then we will manually turn off remote enabled in the menu so that we can connect to them via PTP. the script then gets a list of cameras and I want to loop through the list and download all files off all the cameras.
I hope you are using the User Menu feature setup to run "On Direct" to get quickly to the USB Remote enable / disable menu item on all those camera? 

Also, it seems like there should be a scripting approach to do this automatically for you on the press of one of the camera buttons.  I can't remember your exact application - do you need to use the USB Remote "sync" functionality to get accurate shooting or would triggering all the cameras via a script command be good enough ?

a ptpcam --chdk -l gives me:

Others might have more experience with using ptpcam for this but recent trends have been to use chdkptp and its built-in Lua scripting for complicated stuff like this.

Update : you might want to monitor this thread - looks like its going in the same direction that you are : http://chdk.setepontos.com/index.php?topic=6231.msg94386#msg94386
« Last Edit: 12 / December / 2012, 15:13:44 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal