CHDKPTP File Downloading

  • 13 Replies
  • 503 Views
*

Offline reyalp

  • ******
  • 10944
Re: CHDKPTP File Downloading
« Reply #10 on: 27 / November / 2017, 21:48:28 »
Advertisements
So I just started working on implementing the power sync and I'm having some trouble. When I plug my camera into the switch and the switch into my computer it won't connect to chdk_ptp. Does this mean my switch isn't wired properly or do I have to run a command first?
Does it work with a normal cable? If so, the issue is probably in the switch.

Do you know how the switch is wired? To use chdkptp with hardware remote triggering, the +5 volt line should normally be connected, and only disconnected to trigger a shot.
Quote
Edit 2: Nevermind I just had to put the command directly into the action function, but it no longer prints what it's supposed to in the console. Before I would type !return mc:stage(1) and it would print "__ Cameras Detected" by returning that string at the end of the function. Any advice?
Try
printf(mc:stage(1)), or just change mc:stage to do the printf itself.


Also, FWIW, the version of chdkptp I released yesterday supports some things you asked about earlier:
Quote
I can now change the download folder and delete the images off the cameras afterwards, but is there some way I can delete the DCIM sub directory as well?
To delete DCIM and everything it contains, you could use something like
Code: [Select]
local myfiles=t=mc:find_files('A/DCIM',{dmatch='.*',fmatch='.*',dirsfirst=false,ff_func='find_files_all_fn'})
mc:delete_files_list(myfiles)
If you want to see what would be deleted, you can use pretend, like
Code: [Select]
mc:delete_files_list(myfles,{pretend=true})
If you just want to delete the image directories without deleted DCIM or the CANONMSC directory, you could use something like
Code: [Select]
local myfiles=mc:find_files('A/DCIM',{dmatch='%d%d%d___%d%d',fmatch='%d%d%d___%d%d/.*',dirsfirst=false,ff_func='find_files_all_fn'})

For downloading images, you can use ${shotseq} substitution I mentioned was in SVN, so if you take several shots and want the images numbered by shot (rather than whatever the each camera counter is set at), you can use something like
Code: [Select]
mc:download_images({dst='${id}_${shotseq}${ext}'})
Don't forget what the H stands for.

Re: CHDKPTP File Downloading
« Reply #11 on: 30 / November / 2017, 14:42:38 »
I've got everything working well but when I execute
Code: [Select]
mc:cmdwait('rec')how to I stop it from printing "rec" to the console? I'll attach a pic of what I'm seeing.

How do I get rid of the highlighted bits?

edit: Oh also if there a variable I can grab that tells me how many images I downloaded with download_images, and how do I tell printf to start a new line in the console?

edit2: Sorry to keep asking questions, but is there a boolean that says whether or not there's a script currently running on the cameras, or a start function that only starts a script if there isn't one already running?
« Last Edit: 30 / November / 2017, 15:30:21 by jdstech »

*

Offline reyalp

  • ******
  • 10944
Re: CHDKPTP File Downloading
« Reply #12 on: 30 / November / 2017, 16:15:14 »
I've got everything working well but when I execute
Code: [Select]
mc:cmdwait('rec')How do I get rid of the highlighted bits?
This is controlled by an option to mc:cmd/mc:cmdwait, described in the source:

https://app.assembla.com/spaces/chdkptp/subversion/source/781/trunk/lua/multicam.lua#ln682

so you could use mc:cmdwait('rec',{printcmd=false})

There currently isn't a way to set the default without modifying the code, but I'll add one in a bit.

Quote
edit: Oh also if there a variable I can grab that tells me how many images I downloaded with download_images,
You would have to modify the download_images function. I'll probably change to allow returning the list of images.

Quote
and how do I tell printf to start a new line in the console?
\n
is the newline character.

Quote
edit2: Sorry to keep asking questions, but is there a boolean that says whether or not there's a script currently running on the cameras, or a start function that only starts a script if there isn't one already running?
There isn't currently a way to do this in multicam. You can check if an individual camera is running a script by using script_status on the connection object, see https://app.assembla.com/spaces/chdkptp/subversion/source/781/trunk/lua/multicam.lua#ln333

It should be fairly easy to add an option to only start on cameras without a script running. Note however that this doesn't tell you if they are running the correct script.
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 10944
Re: CHDKPTP File Downloading
« Reply #13 on: 02 / December / 2017, 17:30:20 »
There currently isn't a way to set the default without modifying the code, but I'll add one in a bit.
The current svn version (790) now allows setting the default. So you can use
!mc.cmd_defaults.printcmd=false
to disable command printing by default.

Quote
edit: Oh also if there a variable I can grab that tells me how many images I downloaded with download_images,
mc:download_images now returns the table of images downloaded, so you could use that to display a count. Note the returned table includes the file list for each camera (indexed by camera mc_id), and these could vary between cameras. So to get a count of total images downloaded, you'd need to do something like
Code: [Select]
local total=0
for id,imgs in pairs(list) do
 total=total+#imgs
end
printf("total %d\n",total)
If you want the total from a single camera, you'd have to pick one.
Quote
edit2: Sorry to keep asking questions, but is there a boolean that says whether or not there's a script currently running on the cameras, or a start function that only starts a script if there isn't one already running?
I thought about adding this, but if the camera is already running the multicam script, start() just prints a harmless warning, stops it, and restarts it. If it's running some other script (that doesn't respond to 'exit' as a message), it may fail, but I don't see the use case for ignoring that.
Don't forget what the H stands for.


 

Related Topics