Author Topic: Custom File Prefixes  (Read 5347 times)

Shizuka

  • New to the forum
  • *
  • Posts: 36
Custom File Prefixes
« on: October 20, 2012, 08:26:32 PM »
From the patch from http://www.magiclantern.fm/forum/index.php?topic=3085.0 :
Code: [Select]
+static char file_prefix[8] = "IMG_";
+PROP_HANDLER(PROP_FILE_PREFIX)
+{
+    snprintf(file_prefix, sizeof(file_prefix), "%s", (const char *)buf);
+}
+
+int hdr_increment_file_prefix()
+{
+    if (hdr_counter < 0) return 0; // you have poured alcohol into the CPU?
+    hdr_counter++;
+    if (hdr_counter >= 1000) return 0; // you took 1000 bracketed shots?!
+   
+    if (hdr_counter < 100) snprintf(hdr_prefix, 8, "B%02d_", hdr_counter);
+    else snprintf(hdr_prefix, 8, "B%03d", hdr_counter);
+
+    while (lens_info.job_state) msleep(100);
[b]+    prop_request_change(PROP_FILE_PREFIX, hdr_prefix, 8);[/b]
+    hdr_file_prefix_dirty = 1;
+}
The 550D doesn't support FIO_RenameFile, but from the above code, it seems like it's possible to customize the file prefix of captured images before capture.

Can the replacement of IMG_ and _MG_ with arbitrary 4-character strings be added as a feature?
This is a feature only found in the high end Canon cameras and makes file management much easier (in case of multiple non-1D / 5D3 cameras).

Not sure how this would affect movies (MVI_) or whatever else is implemented in the firmware.

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: Custom File Prefixes
« Reply #1 on: November 28, 2012, 06:00:30 AM »
This would help HDR. I always forget what goes with what.

The patch works.

https://bitbucket.org/OtherOnePercent/tragic-lantern/changeset/a98233251397bc3029b65a35b2ac27aa23e76460

..::T3::..

  • New to the forum
  • *
  • Posts: 4
Re: Custom File Prefixes
« Reply #2 on: November 28, 2012, 09:36:38 AM »
Hey 1%

THX a lot!!!!

Last weekend I thought about, this would be a really nice feature. After I got lost in I big HDR session...

So, it should be available in the next nightly build, right?

Already curious to test...

Shizuka

  • New to the forum
  • *
  • Posts: 36
Re: Custom File Prefixes
« Reply #3 on: November 28, 2012, 09:57:34 AM »
This would help HDR. I always forget what goes with what.

The patch works.

https://bitbucket.org/OtherOnePercent/tragic-lantern/changeset/a98233251397bc3029b65a35b2ac27aa23e76460

Please note that I did not write this patch, so credit appropriately.

Actually I was hoping the file prefix can be set arbitrarily, ie. for example, from a file called A:\DCIMPRFX.TXT containing the four bytes "T2I_", as we don't have alphanumeric input yet.

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: Custom File Prefixes
« Reply #4 on: November 28, 2012, 04:22:08 PM »
Yea, A1ex's patch is much longer in the other thread. But it names brackets like B01 and the next one B02, etc.  There is an on screen keyboard and such but this works for me.

*Its in my build for now.  If you want it in ML tree, ask. Everyone was afraid to test it and thread died.

Shizuka

  • New to the forum
  • *
  • Posts: 36
Re: Custom File Prefixes
« Reply #5 on: November 29, 2012, 08:20:20 AM »
Yea, A1ex's patch is much longer in the other thread. But it names brackets like B01 and the next one B02, etc.  There is an on screen keyboard and such but this works for me.

*Its in my build for now.  If you want it in ML tree, ask. Everyone was afraid to test it and thread died.

I'll test it.

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: Custom File Prefixes
« Reply #6 on: January 05, 2013, 09:44:44 PM »
Should this go in main repo? I've tested it on 600D and its worked well. Will have to add it to 6D.

scrax

  • Contributor
  • Hero Member
  • *****
  • Posts: 1543
  • Code monkey
Re: Custom File Prefixes
« Reply #7 on: January 05, 2013, 11:00:48 PM »
Should this go in main repo? I've tested it on 600D and its worked well. Will have to add it to 6D.
I've tested it too and worked for my 600D,
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Custom File Prefixes
« Reply #8 on: January 05, 2013, 11:32:40 PM »
Not yet, it has a couple of subtle bugs.

For example, this will interfere with long brackets (e.g. 9x1 RAW on 60D): while (lens_info.job_state) msleep(100);