Monday, September 29, 2008

Lazy Guide to gphoto2

As I told you in
http://cacianqalbukunderemp.blogspot.com/2008/09/pengalaman-mengambil-file-dari-canon.html


gphoto2 had successfully get pictures from PTP cameras to my Kuliax Linux. And as I told you before, I used manual from page http://gphoto.sourceforge.net/doc/manual/using-gphoto2.html.

Other neat gphoto2 are

1. -p RANGE or --get-file RANGE
What is RANGE?
Well, when you execute command "-L" or "--list-files" you'll see all files in your camera are enumerated started from one regardless the directory they were located. For example, the files in my wife's Canon Powershot SD750 are shown as the following

There is no file in folder '/'.
There is no file in folder '/store_00010001'.
There is no file in folder '/store_00010001/DCIM'.
There is no file in folder '/store_00010001/DCIM/100CANON'.
There are 6 files in folder '/store_00010001/DCIM/101CANON'.
#1 IMG_0002.JPG 963 KB 1600x1200 image/jpeg
#2 IMG_0003.JPG 828 KB 1600x1200 image/jpeg
#3 IMG_0004.JPG 1113 KB 1600x1200 image/jpeg
#4 IMG_0005.JPG 778 KB 1600x1200 image/jpeg
#5 IMG_0006.JPG 752 KB 1600x1200 image/jpeg
#6 MVI_0001.AVI 2677 KB video/x-msvideo
There are 9 files in folder '/store_00010001/DCIM/102CANON'.
#7 IMG_0001.JPG 814 KB 1600x1200 image/jpeg
#8 IMG_0002.JPG 1074 KB 1600x1200 image/jpeg
#9 IMG_0003.JPG 1047 KB 1600x1200 image/jpeg
#10 IMG_0004.JPG 1056 KB 1600x1200 image/jpeg
#11 IMG_0005.JPG 1065 KB 1600x1200 image/jpeg
#12 IMG_0006.JPG 1140 KB 1600x1200 image/jpeg
#13 IMG_0007.JPG 1155 KB 1600x1200 image/jpeg
#14 IMG_0008.JPG 1126 KB 1600x1200 image/jpeg
#15 IMG_0009.JPG 1179 KB 1600x1200 image/jpeg
There are 26 files in folder '/store_00010001/DCIM/103CANON'.
#16 IMG_0001.JPG 622 KB 1600x1200 image/jpeg
#17 IMG_0002.JPG 605 KB 1600x1200 image/jpeg
#18 IMG_0003.JPG 573 KB 1600x1200 image/jpeg
#19 IMG_0004.JPG 611 KB 1600x1200 image/jpeg
#20 IMG_0005.JPG 621 KB 1600x1200 image/jpeg
#21 IMG_0006.JPG 593 KB 1600x1200 image/jpeg
#22 IMG_0007.JPG 771 KB 1600x1200 image/jpeg
#23 IMG_0008.JPG 939 KB 1600x1200 image/jpeg
#24 IMG_0009.JPG 953 KB 1600x1200 image/jpeg
#25 IMG_0010.JPG 814 KB 1600x1200 image/jpeg
#26 IMG_0011.JPG 1094 KB 1600x1200 image/jpeg
#27 IMG_0012.JPG 865 KB 1600x1200 image/jpeg
#28 IMG_0013.JPG 745 KB 1600x1200 image/jpeg
#29 IMG_0014.JPG 906 KB 1600x1200 image/jpeg
#30 IMG_0015.JPG 942 KB 1600x1200 image/jpeg
#31 IMG_0016.JPG 649 KB 1600x1200 image/jpeg
#32 IMG_0017.JPG 856 KB 1600x1200 image/jpeg
#33 IMG_0018.JPG 847 KB 1600x1200 image/jpeg
#34 IMG_0019.JPG 855 KB 1600x1200 image/jpeg
#35 IMG_0020.JPG 870 KB 1600x1200 image/jpeg
#36 IMG_0021.JPG 1029 KB 1600x1200 image/jpeg
#37 IMG_0022.JPG 1002 KB 1600x1200 image/jpeg
#38 IMG_0023.JPG 832 KB 1600x1200 image/jpeg
#39 IMG_0024.JPG 832 KB 1600x1200 image/jpeg
#40 IMG_0025.JPG 1042 KB 1600x1200 image/jpeg
#41 IMG_0026.JPG 1253 KB 1600x1200 image/jpeg
There are 20 files in folder '/store_00010001/DCIM/104CANON'.
#42 IMG_0001.JPG 1116 KB 1600x1200 image/jpeg
#43 IMG_0002.JPG 989 KB 1600x1200 image/jpeg
#44 IMG_0003.JPG 955 KB 1600x1200 image/jpeg
#45 IMG_0004.JPG 1012 KB 1600x1200 image/jpeg
#46 IMG_0005.JPG 927 KB 1600x1200 image/jpeg
#47 IMG_0006.JPG 796 KB 1600x1200 image/jpeg
#48 IMG_0007.JPG 841 KB 1600x1200 image/jpeg
#49 IMG_0008.JPG 1041 KB 1600x1200 image/jpeg
#50 IMG_0009.JPG 963 KB 1600x1200 image/jpeg
#51 IMG_0010.JPG 723 KB 1600x1200 image/jpeg
#52 IMG_0011.JPG 772 KB 1600x1200 image/jpeg
#53 IMG_0012.JPG 798 KB 1600x1200 image/jpeg
#54 IMG_0013.JPG 1337 KB 1600x1200 image/jpeg
#55 IMG_0014.JPG 771 KB 1600x1200 image/jpeg
#56 IMG_0015.JPG 686 KB 1600x1200 image/jpeg
#57 IMG_0016.JPG 764 KB 1600x1200 image/jpeg
#58 IMG_0017.JPG 861 KB 1600x1200 image/jpeg
#59 IMG_0018.JPG 514 KB 1600x1200 image/jpeg
#60 IMG_0019.JPG 710 KB 1600x1200 image/jpeg
#61 IMG_0020.JPG 587 KB 1600x1200 image/jpeg
There is no file in folder '/store_00010001/MISC'.


Hence, the RANGE is the number between 1 to 61. RANGE can be represented as comma-separated. For example "1-5, 7" means the files you were selected were "1,2,3,4,5,7". RANGE was also XOR (exclusive OR), hence "1-5,3" means "1,2,4,5" (and '3' is excluded).



2. --shell
I encountered problem while deleting a file. I wasn't sure what happened but the command "--delete-file RANGE" didn't work. It said:
*** Error ***
There are no files in folder '/'.
*** Error (-2: 'Bad parameters') ***
As I said above, the RANGE should actually disregards the folders. Sigh..

Fortunately, it had "--shell". I can traverse directory using command "cd" like usual and "delete" the file using filename.




Of course,
the best documentation is man page.
Just type "man gphoto2" for the best usage documentation.

0 comments: