CHDK Forum

CHDK Development => Feature Requests => Topic started by: wontolla on 15 / February / 2008, 13:27:32

Title: Erase CRW/CR2/DNG files without corresponding JPG
Post by: wontolla on 15 / February / 2008, 13:27:32
Last edit: 11 / May / 2009

I rewrote the code because the Purge RAW function was not working with some cameras.
This new version will:

Erase DNGs too.
Show before hand, the amount of memory to be claimed.
Warn you when there are no RAW/DNGs to be erased.

Due to my poor debugging skills, I deleted the function's capability of searching through several folders, which was the faulty bit. It was complex and un-useful in my opinion (I hope no-one misses this).

From now on, you will need to run the function from inside a Canon folder. Remember that you still can keep important RAW files from being wiped out by selecting them before purge.

Any comments/suggestions are welcomed.

The diff file is here. (http://www.won-tolla.net/public/patchPurgeRaw.txt)

I hope I can build and upload for people to test. The number of supported cameras has increased and it seems compilation time will be huge!  :o

Have fun!







Last edit: 24 / April / 2008

It works as follows:

The first step is to delete the JPG outtakes in playback mode (using Canon's interface).

Now you have 3 options to use Purge RAW function and erase the corresponding RAW files:

1.- Delete all RAW files in DCIM folder including subfolders.
Useful when:
   You keep a separate folder for RAW files.
   You set up the camera to create a new folder everyday (several days trek, holydays etc).
   You want to erase the occasional mischievous RAW file stored in a different folder.


Go to CHDK File Browser, select DCIM folder, push left button to display the popup menu and select "Purge RAW" (See photo 1). A warning will ask you to confirm (See photo 2) and voila! You have regained some SD space.

This feature will search through all the folders in DCIM looking for a RAW file (CRW/CR2 prefix or file extension) and if it finds one then will look for its JPG partner anywhere inside DCIM (comparing the 4 digit number assigned by the camera). If it is not found, the RAW file is erased.


2.- Delete all RAW files in a selected folder.
Useful when:
   You keep RAW files in the same folder as JPG files
   You only want get rid of some RAW files. (Very important shots in some other folder).
   You know which folder has a lot of outtakes.


Go to CHDK File Browser and inside DCIM folder select the folder you want (E.g. "102CANON") and push the left button to display the popup menu. Select "Purge RAW". A warning will ask you to confirm and all the RAW files in ONLY that folder will be erased.

This option works like the previous one but only on the selected Canon folder, the rest are untouched.


3.- Delete some or all RAW files in a list.
Useful when:
   You want to protect specific RAW files (to use them later for HDR)

Go to CHDK File Browser, enter DCIM folder, enter a sub folder (E.g. "102CANON") push the left button to display the popup menu. Select "Purge RAW" (See photo 3). A warning will ask you to confirm and all the RAW files (See photo 4) will be gone.

Now the useful thing of this option is that you can mark the RAW files you DON'T want to erase (protect files). The Purge RAW function will erase the rest of the RAW files ignoring the marked ones.

Some screenshots in replay #31

You can try it here but this is NOT an official build. The purpose should be testing the "Purge RAW" feature only. Do not use it with important shots. Remember, the only way for the community to get stable releases is to try/test these aditions BEFORE commiting. Erasing files in camera is an irreversible operation.

Links updated 24th April. Please report if it works in your camera or not. Any other link in this thread is outdated.

http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a450-100d-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a450-100d-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a460-100d-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a460-100d-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a530-100a-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a530-100a-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a540-100b-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a540-100b-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a550-100c-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a550-100c-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a560-100a-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a560-100a-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a570-100e-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a570-100e-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a570-101a-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a570-101a-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a610-100e-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a610-100e-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a610-100f-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a610-100f-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a620-100f-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a620-100f-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a630-100c-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a630-100c-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a640-100b-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a640-100b-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a650-100d-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a650-100d-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a700-100b-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a700-100b-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a710-100a-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a710-100a-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a720-100c-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-a720-100c-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-g7-100e-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-g7-100e-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-g7-100g-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-g7-100g-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-g7-100i-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-g7-100i-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-g7-100i-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-g7-100i-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus55_sd450-100b-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus55_sd450-100b-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus55_sd450-100c-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus55_sd450-100c-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus55_sd450-100d-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus55_sd450-100d-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus65_sd630-100a-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus65_sd630-100a-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus700_sd500-101a-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus700_sd500-101a-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus700_sd500-101b-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus700_sd500-101b-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus70_sd1000-100c-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus70_sd1000-100c-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus70_sd1000-101b-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus70_sd1000-101b-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus70_sd1000-102a-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus70_sd1000-102a-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus800_sd700-100b-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus800_sd700-100b-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus800_sd700-101b-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus800_sd700-101b-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus850_sd800-100e-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus850_sd800-100e-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus860_sd870-100c-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus860_sd870-100c-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus950_sd850-100c-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-ixus950_sd850-100c-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-s2is-100e-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-s2is-100e-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-s2is-100f-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-s2is-100f-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-s2is-100g-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-s2is-100g-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-s3is-100a-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-s3is-100a-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-s5is-101a-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-s5is-101a-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-s5is-101b-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-s5is-101b-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-tx1-100g-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-tx1-100g-50.zip)
http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-tx1-101b-50.zip (http://wontolla.freeweb7.com/CHDK/PurgeRAW/allbest-tx1-101b-50.zip)

Any comments/suggestions will be appreciated.

I'm not writing the C code in this post, it is too long. If you want to see it here is the diff file. It is getting complicated so I started adding comments.

purgeraw.diff - 0.01MB (http://www.zshare.net/download/85169247c196bb/)

Cheers!











Since I started using CHDK for RAW pictures, my 2Gb SD cards feel like 512Mb ones. I use to erase outtake pictures in the field to reclaim some space and also to save time when choosing keepers back home. But for it to be worth, the CRW must be erased too.

I've been studying the CHDK code and I manage to erase the CRW automatically when erasing the JPG in the file browser (small addition to the fselect_delete_file_cb() function). But it would be much easier for the user to be looking at the picture instead the file name.

I think it would be nice when in playback mode, when pressing the "erase" button the CRW goes bye bye too, but I don't know how to sense keys when in playback mode. Any suggestions?

Other way is to first erase all the JPGs you want and then in the file browser, hit the left-key menu and select some kind of "erase crw of missing jpgs", but for that I need a SEARCH function or two nested "while" loops to search for every CRW file if it exist the corresponding JPG (with the file number).


I hope the experienced guys with the CHDK C code can give some hints or suggestions on this.

In few words:
How to react to the "erase" button when in playback mode?
If this is not possible, how to search for a file name in the directory?

For the first approach, it is only to add this lines in the appropriate place:
Code: [Select]
       
selected_file[16]='C';
selected_file[17]='R';
selected_file[18]='W';
selected_file[25]='C';
selected_file[26]='R';
selected_file[27]='W';
remove(selected_file);

For the second approach, I want to create a new function similar to fselect_delete_folder_cb(), for example
Code: [Select]
while (de) {
   if (de->name[0] != 0xE5 /* deleted entry */ && (de->name[0]!='.' || (de->name[1]!='.' && de->name[1]!=0) || (de->name[1]=='.' && de->name[2]!=0))) {
      started();
      sprintf(selected_file, "%s/%s", current_dir, de->name);
      remove(selected_file);
      finished();
   }
   de = readdir(d);
}
closedir(d);

I want to modify this part to detect if the file is a CRW
Code: [Select]
if (de->name[0]=='C'...
Then to start a search in the directory looking for the JPG file with the same number assigned by the camera
Code: [Select]
if (canon_number[0]==de->name[4] && canon_number[1]==de->name[5] && canon_number[2]==de->name[6] && canon_number[3]==de->name[7])
If not found, erase the CRW file and do the same with the next CRW file until all of them are searched.

Thank you in advance guys and have fun!
Title: Re: Erase JPG along with corresponding CRW in playback mode
Post by: whim on 20 / February / 2008, 09:18:47
Hi !
Must have somehow missed this thread - very interesting !
Haven't looked into the code yet, but it made me think
that we should at least also have an indicator pop up when
you display a JPG, like +RAW or sth, that shows you a RAW
is associated with it.
Not very helpful to you atm, but at least gets the thread a bump  :D

wim
Title: Re: Erase JPG along with corresponding CRW in playback mode
Post by: wontolla on 20 / February / 2008, 10:02:21
Thanks whim for the response, I was about to ask again to bump it.

That's a good suggestion; I didn't think about it before but of course whould be useful to know if there is a CRW associated. The drawback is you have to perform a search each time, I don't know if it's really a drawback in terms of performance. If I can get this to work I will implement it and see.

At the time I managed to detect the ERASE key and to cancel the erase if you hit CANCEL in the display or if you push another key.

Next step is to understand how the readdir() function works. I am studying the gui_fselect.c file but it seems that the only way to search a directory is deleting a file each time because it always reads the first file, am I wrong?

Someone with experience with the readdir() function or knows who wrote the File Select feature in the file browser?

Thanks for your help
Title: Re: Erase JPG along with corresponding CRW in playback mode
Post by: jetzt on 20 / February / 2008, 10:21:11
I don't think it is necessary to serach, you know the filename, so you can check wether there is some file or not.

Topic idea: Yes, I think it would be useful.
Title: Re: Erase JPG along with corresponding CRW in playback mode
Post by: PhyrePhoX on 20 / February / 2008, 11:49:36
I don't think it is necessary to serach, you know the filename, so you can check wether there is some file or not.

Topic idea: Yes, I think it would be useful.
well you'd have to look for that file in all directories though. not always are RAW files written in the same dir.
you also can do it the other way around: i'd like a function that deletes all RAWs to which there is no corresponding jpeg. but with your new function, i dont need that anymore (because there will be no "single" raw files anymore"
Title: Re: Erase JPG along with corresponding CRW in playback mode
Post by: GrAnd on 20 / February / 2008, 14:07:57
Someone with experience with the readdir() function or knows who wrote the File Select feature in the file browser?
readdir() (http://www.readdir.org/) :)
Title: Re: Erase JPG along with corresponding CRW in playback mode
Post by: GrAnd on 20 / February / 2008, 14:13:09
BTW. There is an icon in review mode which indicates the existence of some paired with Jpeg file. But that icon appears only if RAW file is saved in the same directory as a Jpeg, and RAW file was taken in a previous shooting session (camera was switched off/on). If that icon is shown the RAW file will be deleted with a Jpeg file at once by standard erase procedure.
Title: Re: Erase JPG along with corresponding CRW in playback mode
Post by: wontolla on 21 / February / 2008, 10:03:31
Thanks guys for the support!

Quote
not always are RAW files written in the same dir.
Yes, that's another problem. For now I am ignoring it. Once it works with files in the same directory I will address this.

Quote
a function that deletes all RAWs to which there is no corresponding jpeg
Good idea, in fact that would eliminate the previous problem. I was thinking to mark in red the JPG files in playback, marking the CRWs automatically and then you just have to erase them all in the file browser. But the current marking function is implemented exclusively in the file browser with pointers and stuff and I would have to copy all that structure to my function witch sounds redundant. But is a very good plan B.

Quote
readdir()
Sorry for the googleable question. The thing is I don't have internet at home where y play with the camera, so I thought "I'll ask this in the forum tomorrow" instead of "I'll google this tomorrow". Thanks for the link, it even contains an example and I already compiled it here at work.

I'll continue with this function back home and let you know the progress.

Have fun!

Note: adjetive "googleable" and verb "google" do NOT exist!"
Title: Re: Erase JPG along with corresponding CRW in playback mode
Post by: wontolla on 25 / February / 2008, 09:59:45
After 10 cups of coffee it is working.

If you are in the middle of the Amazon jungle running out of memory, you can go to playback mode and erase some outtake pictures. Then, in the file browser enter a folder, left-click and select "Purge RAW" (see Figure 1). All the RAW files without a JPG couple will be erased giving you 3 times more free space than erasing JPGs only!

Done with the marketing! Now the stuff behind the scenes:

I thought the easiest thing was to just create a new function that takes a RAW file (either CRW/CR2 prefix or extension), then looks for a correspondent non RAW file by comparing the number assigned by the camera. If not found, erase that file and go with the next. Here is the code:

Code: (c) [Select]
static void fselect_purge_cb(unsigned int btn) {
    struct fitem  *ptr, *ptr2;
    int found=0;

    if (btn != MBOX_BTN_YES) return;

    for (ptr=head; ptr; ptr=ptr->next) {
        if ((ptr->name[0] == 'C' || ptr->name[9] == 'C') && ptr->attr != 0xFF && !(ptr->attr & DOS_ATTR_DIRECTORY)) {
            for (ptr2=head; ptr2; ptr2=ptr2->next) {
                if ((ptr->name[4] == ptr2->name[4] && ptr->name[5] == ptr2->name[5] &&
                     ptr->name[6] == ptr2->name[6] && ptr->name[7] == ptr2->name[7]) && !(ptr2->name[0] == 'C' || ptr2->name[9] == 'C')) {
                    started();
                    found=1;
                }
            }           
            if (found == 0) {
                sprintf(selected_file, "%s/%s", current_dir, ptr->name);
                remove(selected_file);
                finished();
            }
            else {
                found=0;
                finished();
            }
        }
    }
    selected_file[0]=0;
    gui_fselect_read_dir(current_dir);
    gui_fselect_redraw = 2;
}

I didn't go with the original idea of erasing each time in playback mode because I was making a mess in the gui.c. An additional function in the gui_fselect file would be a "cleaner" approach. Also there could be problems like different folders as PhyrePhox said or when the camera does erase the RAW file as GrAnd mentioned.

I was concerned about the two nested "for" loops but it looks like there is not noticeable difference with the normal erasing function. I was underestimating the processor.

I used the word purge to differentiate with delete but I don't know if it applies. For me, this word means "get rid of" but a native English speaker can correct me.

I made several tests and it always worked as expected, the RAW files must have the prefix CRW or CR2 or file extension. Remember you are ERASING ORIGINAL DATA. Test the function first and use it if you feel confident.

I include the diff file and the S3 build in case some S3 eager-hand user (yes you Barney (if you have time of course)) wants to try it.

Thank you guys for your ideas. Have fun!
Title: Re: Erase JPG along with corresponding CRW - done
Post by: Barney Fife on 25 / February / 2008, 10:41:26
Deleted
Title: Re: Erase JPG along with corresponding CRW - done
Post by: wontolla on 25 / February / 2008, 13:06:31
Very interesting concerns Barney.

I had not thought about RAW Sum and RAW Avg features! If I recall correctly, they create a NEW file with a NEW Canon number, so it would be erased (if the prefix is CRW/CR2). From the top of my head, one way to solve this is that the function never deletes WAV files. Adding this to the second if in the code would do the trick.

Code: (c) [Select]
ptr->name[9] != 'W' &&
The only drawback is you won't be able to automatically get rid of unwanted sound recordings.

edit: I was wrong. When using Sum/Avg feature, the generated WAV file gets the Canon number from the last RAW file. As there is a already a JPG assosiated, it won't be purged.




Quote
I'd feel safe using your method if a write-protect-file feature was available
In this case, the write-protect-file feature is the fact that it only erases RAW files without corresponding JPG. I guess if you want to keep certain RAW file you won't erase its JPG in the first place.

But I thing it is a good idea to let the user to somehow protect (lock) manually some files. I will change the code so if you "mark" files in the file browser they won't be erased. That would give the option to, whatever reason, keep the files you want.

Regarding the "lock" command; that would be a very nice addition to CHDK. But I have no clue how CHDK can "know" when a JPG file has been locked in Canon's menus. And also we have to find the way to permanently mark the RAW files as locked. CHDK would have to write that information to a text file or something in the SD card so it remains even if you turn off the camera. May be someone else have an idea on how to do this.
Title: Re: Erase JPG along with corresponding CRW - done
Post by: PhyrePhoX on 27 / February / 2008, 14:27:51
havent analyzed your code yet, but does your function browse all folders looking for corresponding jpg or only the one you start the function in? i think you know why i'm asking, but to people who don't know: sometimes (or everytime if you havent enabled the option) raws arent saved in the same dir as the jpgs. this would mean that raw files might be deleted even though there is a corresponding jpg.
Title: Re: Erase JPG along with corresponding CRW - done
Post by: wontolla on 27 / February / 2008, 14:57:36
You are right, I was assuming both JPG and RAW files are in the same folder. In my case, I always keep them together but other users may not.

I guess something like this could prevent it: if (conf.raw_in_dir) "start search" else "cancel erase"

I also have to add the option of searching on several folders, not just one.
Title: Re: Erase JPG along with corresponding CRW - done
Post by: PhyrePhoX on 27 / February / 2008, 15:01:59
by the way grAnd wrote some useful info on the "different folders for raw & jpgs" problem in this thread: Build 31, SD500 - RAW file directory (http://chdk.setepontos.com/index.php/topic,539.0.html)
Title: Re: Erase JPG along with corresponding CRW - done
Post by: wontolla on 27 / February / 2008, 15:24:22
Yes, you cannot be 100% sure where the RAW file is going to be located.

It is a known issue in quantum CHDK physics called: "The GrAndsenberg uncertainty principle"

Scientists presume it only happens with the first shot in a fresh SD card. Or when you create manually a new folder and shot again.

Anyways, if we get the function to search all the folders in /DCIM, this is no problem.
Title: Re: Erase JPG along with corresponding CRW - done
Post by: Barney Fife on 27 / February / 2008, 21:29:11
Deleted
Title: Re: Erase JPG along with corresponding CRW - done
Post by: wontolla on 28 / February / 2008, 11:16:56
I found this attribute in stlib.h file:
Code: (c) [Select]
DOS_ATTR_RDONLY /* read-only file */Is not beeing used anywhere else in the code. I guess it was intened to be used the way Barney suggested.
Give me some time, I've never dealed with read/write files and stuff
Title: Re: Erase JPG along with corresponding CRW - done
Post by: wontolla on 29 / February / 2008, 12:17:47
Ok, now I can searh in every folder inside DCIM with this code:

Code: (c) [Select]
int main() {
   
    DIR             *d, *d2;
    struct dirent   *de, *de2;
    int             found=0;
    char            sub_dir[256];
    char            current_dir[20]="DCIM";

        printf("Opening main folder %s", current_dir);
        d=opendir(current_dir);
        de=readdir(d);
        while (de) {//For all folders in DCIM
            if (de->d_name[3] == 'C' && de->d_name[4] == 'A') {//Is the item a folder?
                printf("\nFound a Canon sub folder");
                sprintf(sub_dir, "%s/%s", current_dir, de->d_name);
                printf("\nOpening Canon sub folder %s", de->d_name);
                d2=opendir(sub_dir);
                de2=readdir(d2);
                while (de2) {
                    if (de2->d_name[0] == 'C' || de2->d_name[9] == 'C' && !(de->d_name[0] == '.' || de->d_name[1] == '.' || de->d_name[2] == '0')) {//Is the item a RAW file?
                        printf("\nFound RAW file %s", de2->d_name);

                    }
                de2 = readdir(d2);
                }
                printf("\nExit sub folder %s", sub_dir);
            }
            de = readdir(d);
        }
        printf("\nExit main folder %s", current_dir);
       
        getch();
}

Note that this code does not run in the camera but in the PC. I got tired of loading the SD card from the PC to the camera every time. Once this works it is only a matter of copy it to the trunk an change 2 or 3 lines. (Of course you have to use the same arm gcc compiler for execute in the PC).

Well, the problem of RAW files in different location than the JPG can be solved by duplicating this code. One time to search ALL of the RAW files and the second to search ALL the corresponding JPGs. But my concern is as follows: AFAIK the bug GrAnd mentioned involves ONLY ONE RAW file in a different folder so I wonder if a complete DCIM tree search is worth for ONLY ONE file. I think not.

Because of this I was thinking to write the code to detect when the user has specified a special folder for RAWs in the CHDK RAW menu and use that folder in the search. On the other hand, if the user is writing the RAWs in the same folder than JPGs the problem is already solved with the first piece of code in this thread. This way we avoid a double search in the DCIM tree. I hope I am clear with my limited English.

I'd appreciate your input.
Title: Re: Erase JPG along with corresponding CRW - done
Post by: Barney Fife on 29 / February / 2008, 13:56:15
Deleted
Title: Re: Erase JPG along with corresponding CRW - done
Post by: wontolla on 29 / February / 2008, 14:30:24
Thanks Barney for the support.

I fully agree with you about save RAW and JPG fies in the same folder.

I just posted my previous comment to see if there was any user who does otherwise. So the effort of doing an "erase in all folders" function was worth.

I will try to do both: An "erase RAW in current folder" and an "erase RAW in all folders". So the user can chose.

Sorry for my english, I am going home and have no time to correct it in Word.

Cheers!
Title: Re: Erase JPG along with corresponding CRW - done
Post by: Barney Fife on 29 / February / 2008, 14:39:13
Deleted
Title: Re: Erase JPG along with corresponding RAW - done
Post by: wontolla on 03 / March / 2008, 12:22:31
It is working now regardless which folder you stored your RAW or JPG files. It will find them in any folder inside DCIM.

I struggled with it for days until I discovered you ALWAYS have to close the folders with closedir(). The compiler doesn't warn you and you think your code is simply wrong. I will never forget to include this bloody command.

It works as follows:

First, you delete the outtakes in playback mode (using Canon's interface).
Then, to delete the corresponding RAW files, you go to CHDK File Browser, select DCIM folder, push left button to display the popup menu and select "Purge RAW". A warning will ask you to confirm and voila! You have regained some SD space.

This feature will search through all the folders in DCIM looking for a RAW file (CRW/CR2 prefix or file extension) and if it finds one then will look for its JPG partner anywhere inside DCIM (comparing the 4 digit number assigned by the camera). If it is not found, the RAW file is erased.

I forgot to take some shots of the screen, I will post some tomorrow. Don't tell Nikon I'm using their camera with the only puropose of showing CHDK in action.

See reply #31
You can try it here. Remember this is NOT an official build. The purpose should be testing the "Purge RAW" feature only. Do not use it with important shots. I think it should be tested in all cameras first. because deleting files is always a sensitive operation.

allbest-w-a460-100d-78.zip - 0.21MB (http://www.zshare.net/download/8409022ccfe3b6/)
allbest-w-a5xx-all.zip - 0.62MB (http://www.zshare.net/download/8408910c6a4dfa/)
allbest-w-a6xx-all.zip - 1.32MB (http://www.zshare.net/download/8408967db9d711/)
allbest-w-a7xx-all.zip - 0.49MB (http://www.zshare.net/download/84090072e9d5be/)
allbest-w-g7-all.zip - 0.84MB (http://www.zshare.net/download/8409075ff7a879/)
allbest-w-ixus-all.zip - 1.24MB (http://www.zshare.net/download/8409106c2654b0/)
allbest-w-s2is-all.zip - 0.63MB (http://www.zshare.net/download/840913536fd28b/)
allbest-w-s3is-100a-78.zip - 0.21MB (http://www.zshare.net/download/84091477071381/)


Any comments/suggestions will be appreciated.

This is the function:

Code: (c) [Select]
static void fselect_purge_cb(unsigned int btn) {

    DIR             *d,  *d2,  *d3,  *d4;
    struct dirent   *de, *de2, *de3, *de4;
    char            sub_dir[20], sub_dir_search[20];
    char            selected_item[256];
    int             i, found=0;

    if (btn==MBOX_BTN_YES) {
        sprintf(current_dir+strlen(current_dir), "/%s", selected->name);
        d=opendir(current_dir);
        while ((de=readdir(d)) != NULL) {
            if (de->name[0] != '.' && de->name[1] != '.') {//If item is a file
                sprintf(sub_dir, "%s/%s", current_dir, de->name);
                d2=opendir(sub_dir);
                while ((de2=readdir(d2)) != NULL) {
                    if (de2->name[0] == 'C' || de2->name[9] == 'C') {//If file is RAW (Either CRW/CR2 prefix or file extension)
                        d3=opendir(current_dir);
                        while ((de3=readdir(d3)) != NULL) {
                            if (de3->name[0] != '.' && de3->name[1] != '.') {//If item is a file
                                sprintf(sub_dir_search, "%s/%s", current_dir, de3->name);
                                d4=opendir(sub_dir_search);
                                while ((de4=readdir(d4)) != NULL) {
                                    if (de2->name[4] == de4->name[4] && de2->name[5] == de4->name[5] &&//If the four digits of the Canon number are the same
                                        de2->name[6] == de4->name[6] && de2->name[7] == de4->name[7] &&
                                        de4->name[9] == 'J' && !(de4->name[0] == 'C' || de4->name[9] == 'C' || de4->name[0] == 0xE5)) {//I file is JPG and is not CRW/CR2
                                        started();
                                        found=1;//A JPG file with the same Canon number was found
                                    }                                 
                                }
                                closedir(d4);                 
                            } 
                        }
                        closedir(d3);
                        if (found == 0) {
                            sprintf(selected_item, "%s/%s", sub_dir, de2->name);
                            remove(selected_item);
                            finished();
                        }
                        else {
                            found=0;
                            finished();
                        }                             
                    }
                }
                closedir(d2);
            }
        }
        closedir(d);
        i=strlen(current_dir);
        while (current_dir[--i] != '/');
        current_dir[i]=0;
        gui_fselect_read_dir(current_dir);
    }
    gui_fselect_redraw = 2;
}

Yes, I know, 4 nested while loops, ugly.

Cheers!




Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: Barney Fife on 03 / March / 2008, 17:44:14
Deleted
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: PhyrePhoX on 03 / March / 2008, 18:08:12
hm, i tested your build for a620, to no effect. dont know what i'm doing wrong. at least nothing at all gets deleted - not the other way around. will make some more tests during next days.
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: wontolla on 04 / March / 2008, 06:12:16
Quote
I'm askeered. Smiley (colloquialism for "scared", "afraid", for the non-english crowd) There's no safety "lock file" or "Purge RAW this folder only!" option?
I've done a lot of thinking and my conclusion is that the best "lock file" solution is having the JPG. If the JPG exists somewhere, the RAW will never be deleted.
On the other hand, as you mentioned, we have the Canon lock. It sets the JPG file as "read only" the same way Windows does. The problem is I have no clue how to know if a file is "read only" in C language, let me keep researching or see if somebody has a hint.
But as I said, there is little point to know if the JPG is "read only" because the moment THERE IS a JPG, the function won't erase the RAW file, no matter if it is "read only" or not.
I also tried protecting the RAW directly using the CHDK File Browser marking feature: If the RAW is marked, it won't be erased even if there is no correspondent JPG. But when you go back to DCIM folder the files are no longer marked.
Conclusion: I am also askeered from the user point of view, but I still have no idea how to program the "lock file" option.

Quote
I'm going to have to make a "Wontolla's Builds" folder now. I'm losing track of whose stuff I'm testing lately.
Jeje me too!, I have a mess. I tried Jucifer's configurable menu yesterday. There is something knew in this forum almost every day! Remember to put the Wontolla folder under Tests folder since it is not a usable build.


Quote
hm, i tested your build for a620, to no effect.
Thanks PhyrePhox, I knew there would be problems. Can you elaborate in what you are doing?
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: Barney Fife on 04 / March / 2008, 07:07:39
Deleted
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: wontolla on 04 / March / 2008, 08:31:22
Now I am pissed off!  >:(            <- note this is the first time I use one of this yellow faces so I'm really pissed off!

I must have done something wrong when generating builds for every camera, it's the first time I do it.

This is much worse than GrAndsenberg uncertainty principle, this is Murphy's Law. But well, when they opened Disneyland nothing worked too right?

Let me try again tonight, I will need another bag of coffee. Keep those folders of yours for latter Barney...I'll be back 8)
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: Barney Fife on 04 / March / 2008, 09:02:30
Deleted
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: Jucifer on 04 / March / 2008, 10:10:13
Jeje me too!, I have a mess. I tried Jucifer's configurable menu yesterday. There is something knew in this forum almost every day!

The custom user menu is fingalo's, not mine... speaking of which; new day, new stuff. trunk-r314-mod: get_file_counter + faster_menu_navigation (http://chdk.setepontos.com/index.php/topic,688.0.html)
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: wontolla on 05 / March / 2008, 12:27:42
@PhyrePhox and Barney
I tried on my camera they very same files I uploaded and they work!
My guess is you didn't execute the Purge RAW in DCIM folder, I mean, while the cursor is highlighting the folder.
I noticed the Purge RAW option always displays in the popup menu regardless it's a file or folder highlighted. So last night I worked in the code and now it considers all possibilities and situations when the user executes the Purge RAW feature (partly to solve Barney's concerns).  Now if you execute the command in a non allowed item it will cancel the purging and display a window saying so. I will post detailed explanations of this new version of Purge RAW.

Thanks for helping me debug this thing.

Errata:
Quote
The custom user menu is fingalo's, not mine...
That is right, I meant/shoud've said: "Jucifer's modifications to Fingalo's custom menu."
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: Barney Fife on 05 / March / 2008, 12:38:03
Deleted
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: wontolla on 05 / March / 2008, 12:41:48
It works as follows:

The first step is to delete the JPG outtakes in playback mode (using Canon's interface).

Now you have 3 options to use Purge RAW function and erase the corresponding RAW files:

1.- Delete all RAW files in DCIM folder including subfolders.
Useful when:
   You keep a separate folder for RAW files.
   You set up the camera to create a new folder everyday (several days trek, holydays etc).
   You want to erase the occasional mischievous RAW file stored in a different folder.


Go to CHDK File Browser, select DCIM folder, push left button to display the popup menu and select "Purge RAW" (See photo 1). A warning will ask you to confirm (See photo 2) and voila! You have regained some SD space.

This feature will search through all the folders in DCIM looking for a RAW file (CRW/CR2 prefix or file extension) and if it finds one then will look for its JPG partner anywhere inside DCIM (comparing the 4 digit number assigned by the camera). If it is not found, the RAW file is erased.


2.- Delete all RAW files in a selected folder.
Useful when:
   You keep RAW files in the same folder as JPG files
   You only want get rid of some RAW files. (Very important shots in some other folder).
   You know which folder has a lot of outtakes.


Go to CHDK File Browser and inside DCIM folder select the folder you want (E.g. "102CANON") and push the left button to display the popup menu. Select "Purge RAW". A warning will ask you to confirm and all the RAW files in ONLY that folder will be erased.

This option works like the previous one but only on the selected Canon folder, the rest are untouched.


3.- Delete some or all RAW files in a list.
Useful when:
   You want to protect specific RAW files (to use them later for HDR)

Go to CHDK File Browser, enter DCIM folder, enter a sub folder (E.g. "102CANON") push the left button to display the popup menu. Select "Purge RAW" (See photo 3). A warning will ask you to confirm and all the RAW files (See photo 4) will be gone.

Now the useful thing of this option is that you can mark the RAW files you DON'T want to erase (protect files). The Purge RAW function will erase the rest of the RAW files ignoring the marked ones.



You can try it here but this is NOT an official build. The purpose should be testing the "Purge RAW" feature only. Do not use it with important shots. Remember, the only way for the community to get stable releases is to try/test these aditions BEFORE commiting. Erasing files in camera is an irreversible operation.

Links updated 7th March. Please report if it works in your camera or not.

allbest-w-a460-100d-43.zip - 0.21MB (http://www.zshare.net/download/8600126df00381/)
allbest-w-a5xx-all.zip - 0.63MB (http://www.zshare.net/download/86001602978fcb/)
allbest-w-a6xx-all.zip - 1.12MB (http://www.zshare.net/download/860020143db422/)
allbest-w-a7xx-all.zip - 0.49MB (http://www.zshare.net/download/860022663784dc/)
allbest-w-g7-all.zip - 0.84MB (http://www.zshare.net/download/860024907aa478/)
allbest-w-ixus-all.zip - 2.07MB (http://www.zshare.net/download/86002999433ba9/)
allbest-w-s2is-all.zip - 0.63MB (http://www.zshare.net/download/8600313fd1cde1/)
allbest-w-s3is-100a-43.zip - 0.21MB (http://www.zshare.net/download/86003438768469/)

ixus950_sd850-100c.zip - 0.21MB (http://www.zshare.net/download/91274415fb7d07/)

Any comments/suggestions will be appreciated.

I'm not writing the C code in this post, it is too long. If you want to see it here is the diff file. It is getting complicated so I started adding comments.

purgeraw.diff - 0.01MB (http://www.zshare.net/download/85169247c196bb/)

Cheers!
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: wontolla on 05 / March / 2008, 12:58:12
Thanks Barney. Yes, I always say: "Some of these days I will tune my CHDK configuration, let's wait until developers stop making all this new changes" AHAAA!!

"This is like painting the Forth Bridge."
This expression reffers to a big red bridge we have here similar to the Golden Gate. They are always painting it to protect it from salted water. The legend claims that whenever they finish painting, it is time to start again from the beginning. It's and endless job.

I have several SD cards, some for photography and some for testing.
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: Barney Fife on 05 / March / 2008, 13:11:53
Deleted
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: PhyrePhoX on 05 / March / 2008, 13:25:40
hm, sorry to say that, but my a620 dies when i boot your firmware. blue led lights up briefly, then cam shuts down. i guess this is having to do with ram (same happened to s3is builds last time). you can find out more about it here: Remaining RAW+JPG shots + filespace icon/text- done :D (http://chdk.setepontos.com/index.php/topic,468.msg4783.html#msg4783) (and following post).
my guess, at least :)

edit: btw, the diff is so small in size, you can attach it directly in your post next time, please :)
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: wontolla on 05 / March / 2008, 14:04:08
Thanks PhyrePhox. I made the changes suggested by GrAnd and uploaded a new build to the link above.

I hope more users can test this in different models to see if this is a problem with the A620 or is a problem with all non-S3_IS cameras.

I uploaded the diff file to zshare because you can only show four files in this forum. In fact, originally I had 6 photos.

For the record:
The changes where made in \platform\a620\sub\100f\Makefile.inc
MEMISOSTART=0x9F990           >             MEMISOSTART=0xAF990
MEMISOSIZE=0x30000              >             MEMISOSIZE=0x40000

Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: PhyrePhoX on 05 / March / 2008, 14:17:15
hm, same behaviour.
i will append your diff to my local version to see if memory is the issue here.
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: PhyrePhoX on 05 / March / 2008, 15:18:07
argh, just lost an hour figuring out why i cant compile your changes in a freshly exported svn trunk. turns out official trunk is broken since #316.
see error compiling chdk since #316 (http://chdk.setepontos.com/index.php/topic,718.msg5872.html#msg5872)
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: PhyrePhoX on 05 / March / 2008, 16:12:22
i applied your diff to a fresh export of #314 (by the way #319 fixed the issue i reported) and it compiled fine, and also boots fine on my a620. i didnt touch the memory stuff. so there must be something wrong in your environment, wontolla. as i see it, MEMISOSIZE doesnt have to be resized, at least not for a few more builds.

on the other hand: your feature works,nice! maybe enable it so you can use it in the root folder as well, not only when you mark the dcim folder (that was my mistake at first).
another suggestion: when finished, generate a popup stating the number of raw files purged, will make debugging and using easier.
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: wontolla on 06 / March / 2008, 10:34:45
Thanks PhyrePhox.
Now we know my code is not the problem but my builds. I'm clueless about the process of building for all cameras, I will open a new thread to ask for advice.

Come on people! All the links have been downloaded at least one time. At least comment if you could load it in your camera or not. If the function is working or not. You can do it in just one sentence!

Quote
on the other hand: your feature works,nice! maybe enable it so you can use it in the root folder as well, not only when you mark the dcim folder
Originally it was like that, but I wanted to limit the execution of "Purge RAW" to avoid possible problems. It is not supposed to be called in the CHDK folder is it? It wouldn't cause any harm (there are no RAW files in there duh!) but I am trying to make sure people KNOW what they are doing before executing it.

Quote
another suggestion: when finished, generate a popup stating the number of raw files purged, will make debugging and using easier.
That is a very good idea, a simple counter will do the trick. May be also displaying the amount of memory claimed just for fun!
I was thinking on display the RAW files to be purged BEFORE the actual deleting. But that requires a two-pass process: One to count the RAW files found and the other to do the erasing.
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: whim on 06 / March / 2008, 11:15:20
@wontolla

building for all cams is a lot easier than for single cams: 'gmake batch-zip'
however, in my experience you should always do a 'gmake batch-clean' first,
even before single cam builds.

wim
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: GrAnd on 06 / March / 2008, 11:20:06
building for all cams is a lot easier than for single cams: 'gmake batch-zip'
however, in my experience you should always do a 'gmake batch-clean' first,
'gmake batch-zip' always does the 'gmake batch-clean' automatically, because it does 'gmake clean fir' for each camera.
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: whim on 06 / March / 2008, 11:41:56
@GrAnd
@wontolla

I have batch files start my gmake commands, I seem to have forgotten what's in them  :haha
What I should have said was that I always do a batch-clean after

sorry,
wim
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: GrAnd on 06 / March / 2008, 11:55:52
What I should have said was that I always do a batch-clean after

Yes, that's true, if your default camera is not the latest one from the batch list. But it is enough to do 'gmake PALTFORM... clean' for your camera model only, in the same time 'gmake batch-clean' is simpler to type. :)
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: wontolla on 06 / March / 2008, 12:27:32
Tanks whim and GrAnd. I did use the gmake batch-zip command in my sample builds.

It produces all the zip files for each camera and also a bunch of .FIR files.
I'm uploading the zip files as I found them (just grouped by camera model).

Should I include the other .FIR files as well? Why am I getting 2 .FIR files? One inside the zip called PS.FIR and the other in bin folder called a560-100a.FIR.
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: PhyrePhoX on 06 / March / 2008, 12:30:38
the ones in the zip are sufficient, normally.
does compilation throw any errors?
try "gmake batch-zip 2>errors.txt", so you dont have to scroll through all the lines of output.
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: GrAnd on 06 / March / 2008, 12:47:23
does compilation throw any errors?
try "gmake batch-zip 2>errors.txt", so you dont have to scroll through all the lines of output.
If there is any error during compilation of any camera model the whole process will be interrupted and there will not be the final string "All firmwares compiled successfully".
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: PhyrePhoX on 06 / March / 2008, 12:52:19
uh ok.
did you try one of wontollas builds? maybe you can try his a610 build and verify that it is not working. at least his a620 build isnt.
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: wontolla on 06 / March / 2008, 12:57:10
I'm compiling for all cameras with the latest version without any changes by myself and getting this in the error.txt file:
The command line finishes with ">>Entering to platform/ixus65_sd630/sub/100a"

stubs_entry_2.S:35:37: warning: no newline at end of file
movie_rec.c:340:2: warning: no newline at end of file
boot.c: In function `ttyRead':
boot.c:167: warning: implicit declaration of function `mytty_putc'
boot.c: At top level:
boot.c:201: error: conflicting types for 'mytty_putc'
boot.c:167: error: previous implicit declaration of 'mytty_putc' was here
boot.c: In function `replaceConsoleDriver':
boot.c:247: warning: passing arg 1 of `_iosDrvInstall' makes pointer from integer without a cast
boot.c:247: warning: passing arg 2 of `_iosDrvInstall' makes pointer from integer without a cast
boot.c:247: warning: passing arg 3 of `_iosDrvInstall' makes pointer from integer without a cast
boot.c:247: warning: passing arg 4 of `_iosDrvInstall' makes pointer from integer without a cast
boot.c:247: warning: passing arg 5 of `_iosDrvInstall' makes pointer from integer without a cast
boot.c:247: warning: passing arg 6 of `_iosDrvInstall' makes pointer from integer without a cast
boot.c:247: warning: passing arg 7 of `_iosDrvInstall' makes pointer from integer without a cast
boot.c: In function `h_ios_tty_Init':
boot.c:266: warning: implicit declaration of function `_iosInit'
C:\Projects\CHDK\gcc_env_for_hdk-3.4.6\bin\gmake[5]: *** [boot.o] Error 1
C:\Projects\CHDK\gcc_env_for_hdk-3.4.6\bin\gmake[4]: *** [all-recursive] Error 1
C:\Projects\CHDK\gcc_env_for_hdk-3.4.6\bin\gmake[3]: *** [all-recursive] Error 1
C:\Projects\CHDK\gcc_env_for_hdk-3.4.6\bin\gmake[2]: *** [all-recursive] Error 1
gmake[1]: *** [all-recursive] Error 1
gmake: *** [batch-zip] Error 2

I think there is something wrong again, like yesterday
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: wontolla on 07 / March / 2008, 08:25:25
****Al firmwares created successfully

It looks like the problem compiling for all cameras is solved with revision 320. I updated the links in #31.

I'll add a popup window with the number of RAW files purged.

Cheers.
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: PhyrePhoX on 07 / March / 2008, 09:20:53
now it boots on my a620. well done. a quick way to check if raw purging was successful is to compare free diskspace before and after (directly in filebrowser). this way i just won 100 MB. overall, nice feature.
maybe this can be spiced up by adding menu entries like "purge all avis" or "purge all avis bigger than 10 MB" or something. /me drools :D
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: wontolla on 07 / March / 2008, 11:42:55
Ah!, good it works in other cameras. It was a compilation problem. The Purge RAW should be "platform independent".

I will see what else can I add to it this weekend.
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: wontolla on 14 / March / 2008, 11:57:22
So, it looks like there are no more bugs with this function.

Jucifer has added it to his code.

I hope you find it useful. I learned a lot while writing it. And thank you all for your help!
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: rocstar on 16 / March / 2008, 00:15:25
Can someone convert this for the SD850? I'd like to test it, but don't know how to create the file myself.
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: whim on 16 / March / 2008, 04:35:21
- deleted -

sorry
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: wontolla on 18 / March / 2008, 09:17:47
Hi rocstar

I added a new link for SD850 build (Reply #31)

Thanks for testing. Please let me know if it works or not.
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: PhyrePhoX on 18 / March / 2008, 09:25:31
by the way did you add a "xyz raw files deleted" popup yet? otherwise i dont see a reason why this shouldnt end up in official trunk. :)

i included your diff in my binaries @ a few enhancements, bugfixes (http://chdk.setepontos.com/index.php/topic,703.msg6652.html#msg6652)

one thing i noticed: while it is purging, the camera isnt responding to anything, right? at first i thought the binary was broken, but then operation resumed. so yes, a progress bar would rule :)
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: PhyrePhoX on 20 / March / 2008, 14:36:10
may i request another feature? can you add the "raw develop" to the filemenu in the filebrowser? it's quiete confusing to only find it in the raw menu, while raw average and raw sum are in filebrowser. i tried to do it myself, but great is the valley of stones for me to cross to understand how the filebrowser & menu works. and since you already are editing the menu... :)
by the way, how did you come up with that 0x0080? i couldnt figure it out myself, and so i am not able to add a menu entry. what are these values for?
Quote
#define MPOPUP_PURGE            0x0080
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: wontolla on 20 / March / 2008, 15:51:56
Ok, I'll do it. But sorry, I'm affraid not very soon. Big real-job deadline next week.
But I noticed that the filemenu is almost full. With Purge RAW it has 8 elements, and I think the limit is 9. If someone in the future wants to add something else, he/she will have to come up with some kind of sidebar.
May be, may be not. I don't know what happens if the limit is exceeded but whoever wrote the file menu did it well because for example, I noticed the popup windows resize themselves if you write a string longer than the screen in them.

Regarding that address, jejejeje, I had problems too. I just came with the next power of two and it worked I don't know why.
There was a gap between RAW_AVERAGE 0x0040 and CANCEL 0x0100 and I filled it with PURGE 0x0080.
I bet the next working address is 0x0200

But we should ask ewavr (I think he wrote this). There should be an explanation.

Have fun!

Code: (c) [Select]
#define MPOPUP_MASK             0x00FF
#define MPOPUP_CUT              0x0001
#define MPOPUP_COPY             0x0002
#define MPOPUP_PASTE            0x0004
#define MPOPUP_DELETE           0x0008
#define MPOPUP_SELINV           0x0010
#define MPOPUP_RAW_ADD 0x0020
#define MPOPUP_RAW_AVERAGE 0x0040
#define MPOPUP_CANCEL           0x0100
#define MPOPUP_PURGE            0x0080

Edit: Darn, I'm starting to sound like those low-level  hexadecimal guys. You try to read their posts but they don't speak english anymore, it is just 0x this and 0x that.
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: PhyrePhoX on 20 / March / 2008, 16:40:21
take your time, "real life" is always the most important thing to take care of.
ur right, menu already has a lot of entries. the entries show up dynamically though, for example the raw develop entry shouldnt popup when you mark multiple files, and vice versa the raw average entry shouldnt pop up when you only mark one file.
anyways, good luck with that job thingy :)

oopsydaisy: found a bug. purge raw executed on the DCIM top folder crashes the camera. i had some deletable raw files (no corresponding jpg) in there, scattered around the IMG folders. the blue led was lit up a few times, then the camera died (tried this in rec and playback mode, cam just dies even with lens extruded). later i ran the raw purge on each img folder, that worked (though no raws got deleted, as the DCIM purge got them all i think) well.
in the end i reran the DCIM purge all test to check if camera only crashes when there are deletable raws, but it crashed again.

this is my file structure, maybe this is useful:
Quote
DCIM
- 100CANON - 0 pics inside
- 122CANON - 41 inside
- 123CANON - 61 inside
- 124CANON - 61 inside
no raws left in sd-card, only jpgs. still cam crashes.

sorry to tell you ;)

maybe it crashes in a loop or something. too bad there isnt a debugger :D
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: GrAnd on 20 / March / 2008, 17:18:04
I bet the next working address is 0x0200

Look at the MPOPUP_MASK 0x00FF and MPOPUP_CANCEL 0x0100... ;)
So, there is no gap anymore for adding extra menu items. At least next time these constants should be changed a bit.
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: rocstar on 21 / March / 2008, 15:13:12
I tried the build for the SD850 and it did not work for me.  I formatted the card several times, and try autoboot as well as manual CHDK boot.  The blue LED turns on, and the screen goes blank and locks up hard.  Requires battery pull.
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: wontolla on 28 / March / 2008, 15:47:45
@ PhyrePhox and rockstar
Thanks for testing and sorry for the late response. I have many things to do lately. You know, the same old story: my sister's racoon ate my card reader and my aunt broke her ankle trying to catch it.

@ PhyrePhox
The camera just dies? Darn, this is a huge step backwards; it already worked in the A560! May be it doesn't work with a lot of files (160 in your case). When I did my tests I always tried with a few only. Please try this new build both with few and lots of files if you can.

@rocstar
Sorry about the problems caused. I don't understand, it works flawlessly in my S3. I hope you dare to try this again, may be first try to erase RAWs in file browser list only, to see if that works, that's a simple loop. Because erase in one folder and erase in DCIM folder takes 2 and 3 nested loops respectively.

It seems I will have to "go back to formula" grrrrrrrrrrr!!!


New builds for people to try (based on Allbest's 48). Please post here if it works or not in your camera. Remember these builds are for testing purposes. Do not use in the field or with valuable pictures. For details on how it works see Reply #31.

allbest-a460-100d-50.zip - 0.22MB (http://www.zshare.net/download/9690615c1a4ac3/)
allbest-a5xx.zip - 1.32MB (http://www.zshare.net/download/9690807afc186d/)
allbest-a6xx.zip - 1.18MB (http://www.zshare.net/download/96909590f17118/)
allbest-a7xx.zip - 0.52MB (http://www.zshare.net/download/96912353b72eeb/)
allbest-g7.zip - 0.89MB (http://www.zshare.net/download/9691381031bf3b/)
allbest-ixus55x.zip - 0.43MB (http://www.zshare.net/download/969210908c0dc0/)
allbest-ixus65_sd630-100a-50.zip - 0.22MB (http://www.zshare.net/download/9692168d60a68d/)
allbest-ixus70x.zip - 0.65MB (http://www.zshare.net/download/9692224bc0bb5f/)
allbest-ixus700x.zip - 0.44MB (http://www.zshare.net/download/96923006041353/)
allbest-ixus8xx.zip - 0.73MB (http://www.zshare.net/download/96920389875bfb/)
allbest-ixus950_sd850-100c-50.zip - 0.22MB (http://www.zshare.net/download/9692334a58b4d5/)
allbest-s2isx.zip - 0.66MB (http://www.zshare.net/download/969240328ea733/)
allbest-s3is-100a-50.zip - 0.22MB (http://www.zshare.net/download/9829191859ff0a/) updated 31 March
   S3 diskboot.bin (http://www.zshare.net/download/98300181ea790c/) ps.fir (http://www.zshare.net/download/9830067d2f5470/) In case you can't unzip previous file


Who the heck has been porting CHDK for IXUS? It's getting harder to upload builds for all cameras!


Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: rocstar on 29 / March / 2008, 01:05:29
Wontolla,
I tried the a 550, and it worked great!
The SD850 still has the same problem.  Just booting the firmware locks up the camera hard and I have to pull the battery to get it back.  The blue print LED turns on steady.  That's the only thing it does.
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: obitus on 30 / March / 2008, 07:04:58
Hello,

I downloaded the file for the S3IS - but I cannot unpack the zip file.
The a5xx.zip works though, I just tested.
Is it possible that the S3IS file is corrupted?

I'd really like to test the release - thanks for the great work!

obitus
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: wontolla on 31 / March / 2008, 08:29:51
@rockstar
Thanks for testing. Well, now we have success with S3 and A550.
Quote
Just booting the firmware locks up the camera hard
So, the problem is when loading the Purge RAW build? When turning on the camera?
Or is it when trying to erase some RAW files in File Browser?
Have you ever build CHDK in your computer? To find the problem in the SD850, one way to go is you make your own build using my diff file.

@obitus
Weird, I just downloaded S3 and I can unpack it. Anyways, I uploaded a fresh zip file and also the "fir" and "bin" files just in case. Thanks for testing.
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: obitus on 31 / March / 2008, 14:14:29
Hello wontolla,

I was now able to download and extract the S3 file.
I have 1 JPG and 1 CRW left with their original names, img_0004.jpg and img_0004.crw
I went to the 100CANON folder, selected "Purge RAW" - and the S3 locked and reloaded, the files still being there.
No matter what is in the directory, my S3 always reloads.
Do you need more info about my S3, settings or anything?
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: Steveo on 01 / April / 2008, 06:46:39
I have an A570IS.  This is a superb feature and I now use it constantly.  I would like to echo obitus' comments above.. but it's weird...

First tried it all options/levels to try it worked, and the easiest was to highlight DCIM folder and purge all.  However, after a day of doing this, it stopped working.  Now as described by obitus, when I try it, the camera locks up (screen image is updated with what the lens sees, but no menu/buttons work.  After couple of seconds the camera goes blank, with lens out if out etc.  A power up restores camera, but the RAW's are still there.

It seems to work if I do the procedure on the 100CANON folder (or whatever the last folder is called before the images).  But it is annoying that it did work and now it's locking the camera up.

Does the code log all images deleted or have a limited buffer or something?  It seems weird it worked perfect for a set amount of time - i'd say I deleted 30-50 before it stopped working, but that is a rough guess if it helps!

Steveo
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: wontolla on 01 / April / 2008, 08:13:16
Thanks guys for your input.

I made several tests last night. Given the weird behaviour I thought the problem was when the folder had too many files and the memory of the camera couldn't cope with it. So I tested with 200 photos and erasing 100 random JPG files. And it worked like a charm! It took like one minute but no hanging.
But then I did the same 200 photos but erasing only one JPG and the camera frizzed.

I will try to change the searching method (may be several partial searches instead of one big loop), I still think there is a problem with the camera's memory but unfortunately I don't understand how things work at low level so may be another developer has a clue. May be there is a way to know state of the memory, if it is full etc.

I'll let you know when I have a new build.
Any clues developers?

This is the Purge RAW function code, three main parts:
1.- is executed when erasing everything in DCIM folder
2.- is executed when a Canon folder is selected
3.- is executed when you call the function in the file list


Code: (c) [Select]
//-------------------------------------------------------------------
static void fselect_purge_cb(unsigned int btn) {

    DIR             *d,  *d2,  *d3,  *d4;
    struct dirent   *de, *de2, *de3, *de4;
    struct fitem    *ptr, *ptr2;
    char            sub_dir[20], sub_dir_search[20];
    char            selected_item[256];
    int             i, found=0;

    if (btn==MBOX_BTN_YES) {
        //If selected folder is DCIM (this is to purge all RAW files in any Canon folder)
        if (selected->name[0] == 'D' && selected->name[1] == 'C' && selected->name[2] == 'I' && selected->name[3] == 'M') {
            sprintf(current_dir+strlen(current_dir), "/%s", selected->name);
            d=opendir(current_dir);
            while ((de=readdir(d)) != NULL) {//Loop to find all Canon folders
                if (de->name[0] != '.' && de->name[1] != '.') {//If item is not UpDir
                    sprintf(sub_dir, "%s/%s", current_dir, de->name);
                    d2=opendir(sub_dir);
                    while ((de2=readdir(d2)) != NULL) {//Loop to find all the RAW files inside a Canon folder
                        if (de2->name[0] == 'C' || de2->name[9] == 'C') {//If file is RAW (Either CRW/CR2 prefix or file extension)
                            d3=opendir(current_dir);
                            while ((de3=readdir(d3)) != NULL) {//Loop to find all Canon folders
                                if (de3->name[0] != '.' && de3->name[1] != '.') {//If item is not UpDir
                                    sprintf(sub_dir_search, "%s/%s", current_dir, de3->name);
                                    d4=opendir(sub_dir_search);
                                    while ((de4=readdir(d4)) != NULL) {//Loop to find a corresponding JPG file inside a Canon folder
                                        if (de2->name[4] == de4->name[4] && de2->name[5] == de4->name[5] &&//If the four digits of the Canon number are the same
                                            de2->name[6] == de4->name[6] && de2->name[7] == de4->name[7] &&
                                            de4->name[9] == 'J' && !(de4->name[0] == 'C' || de4->name[9] == 'C' || de4->name[0] == 0xE5)) {//If file is JPG, is not CRW/CR2 and is not a deleted item
                                            started();
                                            found=1;//A JPG file with the same Canon number was found
                                        }                                 
                                    }
                                    closedir(d4);                 
                                } 
                            }
                            closedir(d3);
                            //If no JPG found, delete RAW file
                            if (found == 0) {
                                sprintf(selected_item, "%s/%s", sub_dir, de2->name);
                                remove(selected_item);
                                finished();
                            }
                            else {
                                found=0;
                                finished();
                            }                             
                        }
                    }
                    closedir(d2);
                }
            }
            closedir(d);
            i=strlen(current_dir);
            while (current_dir[--i] != '/');
            current_dir[i]=0;
        }
        //If item is a Canon folder (this is to purge all RAW files inside a single Canon folder)
        else if (selected->name[3] == 'C') {
            sprintf(current_dir+strlen(current_dir), "/%s", selected->name);
            d=opendir(current_dir);
            while ((de=readdir(d)) != NULL) {//Loop to find all the RAW files inside the Canon folder
                if (de->name[0] == 'C' || de->name[9] == 'C') {//If file is RAW (Either CRW/CR2 prefix or file extension)
                    d2=opendir(current_dir);
                    while ((de2=readdir(d2)) != NULL) {//Loop to find a corresponding JPG file inside the Canon folder
                        if (de->name[4] == de2->name[4] && de->name[5] == de2->name[5] &&//If the four digits of the Canon number are the same
                            de->name[6] == de2->name[6] && de->name[7] == de2->name[7] &&
                            de2->name[9] == 'J' && !(de2->name[0] == 'C' || de2->name[9] == 'C' || de2->name[0] == 0xE5)) {//If file is JPG and is not CRW/CR2 and is not a deleted item
                            started();
                            found=1;//A JPG file with the same Canon number was found
                        }                                 
                    }
                    closedir(d2);
                    //If no JPG found, delete RAW file               
                    if (found == 0) {
                        sprintf(selected_item, "%s/%s", current_dir, de->name);
                        remove(selected_item);
                        finished();
                    }
                    else {
                        found=0;
                        finished();
                    }
                }
            }
            closedir(d);
            i=strlen(current_dir);
            while (current_dir[--i] != '/');
            current_dir[i]=0;
        }
        else {
            //If inside a Canon folder (files list)
            for (ptr=head; ptr; ptr=ptr->next) {//Loop to find all the RAW files in the list
                if ((ptr->name[0] == 'C' || ptr->name[9] == 'C') && !(ptr->marked)) {//If file is RAW (Either CRW/CR2 prefix or file extension) and is not marked
                    for (ptr2=head; ptr2; ptr2=ptr2->next) {//Loop to find a corresponding JPG file in the list
                        if (ptr->name[4] == ptr2->name[4] && ptr->name[5] == ptr2->name[5] &&//If the four digits of the Canon number are the same
                            ptr->name[6] == ptr2->name[6] && ptr->name[7] == ptr2->name[7] &&
                            ptr2->name[9] == 'J' && !(ptr2->name[0] == 'C' || ptr2->name[9] == 'C')) {//If file is JPG and is not CRW/CR2
                            started();
                            found=1;
                        }
                    }
                    //If no JPG found, delete RAW file           
                    if (found == 0) {
                        sprintf(selected_file, "%s/%s", current_dir, ptr->name);
                        remove(selected_file);
                        finished();
                    }
                    else {
                        found=0;
                        finished();
                    }
                }
            }
        }
        gui_fselect_read_dir(current_dir);
    }
    gui_fselect_redraw = 2;
}
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: GrAnd on 01 / April / 2008, 10:21:25
Just a minor speedup suggestion: to insert "break;" just after each "found=1;".

Code: (c) [Select]
                        sprintf(selected_file, "%s/%s", current_dir, ptr->name);I suspect here should be "selected_item", not "selected_file" ???

Code: (c) [Select]
                if (de->name[0] == 'C' || de->name[9] == 'C') {//If file is RAW (Either CRW/CR2 prefix or file extension)What about a deleted file with .CR* extension?

Code: (c) [Select]
                            de2->name[9] == 'J' && !(de2->name[0] == 'C' || de2->name[9] == 'C' || de2->name[0] == 0xE5)) {//If file is JPG and is not CRW/CR2 and is not a deleted itemMinor: Extra unnecessary check: "de2->name[9] == 'J'"  -> so it can'be "de2->name[9] == 'C'"
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: wontolla on 01 / April / 2008, 13:30:57
Thank you for the sugestions GrAnd.
Quote
Just a minor speedup suggestion: to insert "break;" just after each "found=1;".
Minor? That could reduce the effort/time to a half! In the average case. No sense in keep searching if it's already found, right?
My teacher told me to avoid using "goto" or "break" statements. May be he wasn't right after all.

Quote
I suspect here should be "selected_item", not "selected_file"
Since this is the case when the list is already generated by the File Browser, the names of the files are already in the structure, so I can use "selected_file". In fact, this is the first part of the code I wrote, inspired in the "fselect_delete_file_cb" function.

Quote
What about a deleted file with .CR* extension?
What do you mean? If it is already deleted, we don't need to search for its JPG partner.

Quote
Minor: Extra unnecessary check: "de2->name[9] == 'J'"  -> so it can'be "de2->name[9] == 'C'"
True, I'll remove it for the sake of simplicity.

GrAnd, any way to know if the amount of memory is not enough for this application? Or what could be the cause of camera hanging sometimes and sometimes it simply works!

Thanks!

Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: GrAnd on 01 / April / 2008, 13:48:02
My teacher told me to avoid using "goto" or "break" statements. May be he wasn't right after all.
Regarding "goto" - yes, it could be weird. But "break" is very useful sometimes. Especial in case if you have a lot of conditions in the cycle. Of course, the appropriate condition can be placed in "while" statement, e.g.
Code: (c) [Select]
        while (!found && (de4=readdir(d4)) != NULL)

Quote
What about a deleted file with .CR* extension?
What do you mean? If it is already deleted, we don't need to search for its JPG partner.
I mean in that line(s) a deleted file with CRW/CR2 extension can be caught.


GrAnd, any way to know if the amount of memory is not enough for this application? Or what could be the cause of camera hanging sometimes and sometimes it simply works!
But you do not use a dynamic memory (no malloc()/free() functions I see).
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: stevodude on 17 / April / 2008, 20:32:08
so is this in the cvs? or not ready yet. but can I make a build test with raw deletion for my s5is...
sorry for the dummy Q.
thats the only other thing that would be handy, as I have to download all images, then go through all crw/jpg to find the crw files without matching jpg's and delete before running my normal photo process...

Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: PhyrePhoX on 18 / April / 2008, 00:51:17
not in svn yet. you can manually merge the changes and compile on your own though :)
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: wontolla on 24 / April / 2008, 18:15:17
It's been weeks since I worked on this. Sorry for the delay.

To avoid confusion, I moved the links and the explanation of this feature to the first post of this thread. Any other link is outdated.

Regarding the "hanging" problems some of you reported: I've been able to reproduce them only twice, so I can't still find the cause. GrAnd mentioned somewhere else a watchdog timeout, maybe it has something to do here. I'll continue experimenting, but I guess we'll have to get rid of the "Delete all RAW files in DCIM folder" function.

Have fun!
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: Racenviper on 25 / April / 2008, 07:52:26
Regarding the "hanging" problems some of you reported: I've been able to reproduce them only twice, so I can't still find the cause. GrAnd mentioned somewhere else a watchdog timeout, maybe it has something to do here. I'll continue experimenting, but I guess we'll have to get rid of the "Delete all RAW files in DCIM folder" function.

Just my thoughts on why I would never use this feature and the dangers. With my own DSLR experience I on a trip 1500miles from home at Salt Lake City, very beautiful city. Shooting as I normaly do I ran out of space on my cards. At this time I did not have a way to backup my cards either. So I started deleting images I did not need. I did this over a course of three hours, takes pictures delete some. When I got home I had found that half the cards were filled corrupted files.

This only happened to me a year and half ago. From that time I have not deleted a single image from any of my cards with the camera OS. My DLSR's cards are formatted each time before I use them. My CHDK cards, I use the camera feature "Delete All Images"

I just don't like taking chances with my images.
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: wontolla on 25 / April / 2008, 14:26:57
The "hanging" problems consist in the camera shutting down, not images beeing lost.

You are right, the best way to solve the space problem is buying more cards or a portable storage device. The PurgeRAW feature is "just in case" you don't have these options at the time.

I started implementing this because I had the opposite experience than you: In a trip, I run out of space and started deleting bad pictures and continue taking snaps, I had no problems. I guess every one of us have deleted pictures in camera before (with or without CHDK) without any problems. I just thought it was a good idea to be able to erase RAW files too and claim much more space.

Quote
My CHDK cards, I use the camera feature "Delete All Images"
"PurgeRAW" is the same C code as "Delete All Images". I just added a searching capability.

IMO you just had bad luck, it can happen to anybody with DSLR or P&S, with CHDK or Canon's firmware, with PurgeRAW or without it.

BTW. Thanks for the DSLR tip. Now if I ever get a DSLR it won't be because of reliability.



Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: lukg on 17 / June / 2008, 07:14:21
Ok, Wontolla thanks. I tried with your build too, but with no success. I took 2 pictures (jpg+raw), deleted jpgs with canon interface, opened chdk file manager, positioned over DCIM folder and selected PURGE RAW, asked me if I was sure.
Crw files are still there (in 100CANON subdir). I tried to position over the subfolder containing the raw files, but with the same result. What can I do?

EDIT: If I enter the directory containing raw files, the "purge raw" function works. Maybe am I wrong about how "purge raw" works?
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: wontolla on 17 / June / 2008, 14:57:33
You just described the three ways PurgeRAW works. But it looks like only one works in your case.

It is not the first time someone reports a problem when trying to purge ALL raws in DCIM folder. But it seems to work when erasing directly "inside" a particular folder (as it was planned at the begining of this feature).

The reason I added the hability to search through all folders inside DCIM (100CANON, 101CANON, 102CANON etc) is because from time to time ONE of the raw files is saved in a different folder than its jpg companion, so the program would always erase this raw file because it's unable to find the corresponding jpg.

I will continue working on this, but I guess that in the end, we will have to forget about the "searching in all folders" hability.
Title: Re: Erase JPG along with corresponding CRW in any folder - done
Post by: lukg on 17 / June / 2008, 19:01:29
Thank you for your reply! Anyway, It's not a problem for me, i will use this great function in the way it works! Thanks again!