EXIF Info..

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: EXIF Info..

Post by Stefan »

admin wrote:No, the comma has to stay:
Right, i just realized this too, Sorry.
BTW, if $CamMod is the same for each file, the script can be done much easier, and with a summary preview for all files...
Good point.


In the meantime i have tried to do the preview on my own:

Code: Select all

$list = get("SelectedItemsNames", "|");

  $array="";
  $index=1;   
  while($index < 20)
  {
      //get one after the other file from file list $file:
      $file = gettoken($list, $index, "|");
      if ($file==""){break;}
     
      //read property from actual file:
      $CamMod = property("CameraModel", $file);
      //trim space and tabs around the reported property:
      $CamMod = regexreplace($CamMod, "\s*|\t*(.*)\s*|\t*", "$1");

      //Property #25 is on my system Exif Date Taken. YMMV.
      $DateTaken =  replace(property(#25, $file),":",""); 
      $DateTaken =  regexreplace($DateTaken,"(\d\d)\.(\d\d)\.(\d\d\d\d)(.+)","$3.$2.$1$4");
             
      $ExtPos = strpos($file, ".", strlen($file) -5);
      $fileBase = substr($file, , $ExtPos);
      $fileExt  = substr($file, $ExtPos);

      $file = "$DateTaken~$fileBase";
      if ($CamMod != ""){ $file = "$file"."_"."$CamMod"}
      $file = "$file$fileExt";
      $array = "$array$file<crlf>";

   //precess next file:
   incr $index;
   }
  text $array;
  msg "OK to rename or cancel?",1;

  msg "if you have pressed OK you will see this dialog too.";
  //rename code goes here:

aimy
Posts: 186
Joined: 26 Feb 2007 15:44

Re: EXIF Info..

Post by aimy »

Hi again..

Currently, the current script I have as provided by Stefan is this:

Code: Select all

$list = get("SelectedItemsPathNames", "|");

  $index=1;   
  while(true)
  {
      //get one after the other file from file list $file:
      $file = gettoken($list, $index, "|");
      if ($file==""){break;}
     
      //read property from actual file:
      $CamMod = property("CameraModel", $file);
      //trim space and tabs around the reported property:
      $CamMod = regexreplace($CamMod, "\s*|\t*(.*)\s*|\t*", "$1");
       
       //rename only if that property is not empty :
      if ($CamMod != "")
      {
           rename b, '<dateexif yyyymmdd.hhnnss>~*_' . $CamMod, , $file;
      }
     
   //process next file:
   incr $index;
   }
The problem with this script:
1. Quite slow.. Yesterday I have to wait about a minute or two to rename 700+ files!
2. No preview

So, my question is.. Since XYplorer is capable of reading the EXIF date as in the common rule of batch rename e.g <dateexif yyyymmdd.hhnnss>~*, could it be extended to read all the other EXIF infos specifically the camera_property in this case?

So, all I have to do is to put a command something like <dateexif yyyymmdd.hhnnss>~*_<campropexif> :mrgreen:

Thank you.

aimy
Posts: 186
Joined: 26 Feb 2007 15:44

Re: EXIF Info..

Post by aimy »

As you all might already aware, today's technology of digital photography also have implemented GPS info on the photos taken.

So, wouldn't it be great if XYplorer users could be let to freely playing around with those useful info with Batch Rename?

Thank you.

admin
Site Admin
Posts: 66362
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: EXIF Info..

Post by admin »

aimy wrote:As you all might already aware, today's technology of digital photography also have implemented GPS info on the photos taken.

So, wouldn't it be great if XYplorer users could be let to freely playing around with those useful info with Batch Rename?

Thank you.
Sure, when I find the time...

aimy
Posts: 186
Joined: 26 Feb 2007 15:44

Re: EXIF Info..

Post by aimy »

admin wrote:
aimy wrote:As you all might already aware, today's technology of digital photography also have implemented GPS info on the photos taken.

So, wouldn't it be great if XYplorer users could be let to freely playing around with those useful info with Batch Rename?

Thank you.
Sure, when I find the time...
Thanks admin.

But in the meantime, is there any interim solutions for this problem to resolve the slowness and to include the renaming preview?

Thank you.

admin
Site Admin
Posts: 66362
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: EXIF Info..

Post by admin »

aimy wrote:
admin wrote:
aimy wrote:As you all might already aware, today's technology of digital photography also have implemented GPS info on the photos taken.

So, wouldn't it be great if XYplorer users could be let to freely playing around with those useful info with Batch Rename?

Thank you.
Sure, when I find the time...
Thanks admin.

But in the meantime, is there any interim solutions for this problem to resolve the slowness and to include the renaming preview?

Thank you.
What about writing better code? :wink: Look into ForEach loops...

aimy
Posts: 186
Joined: 26 Feb 2007 15:44

Re: EXIF Info..

Post by aimy »

admin wrote:
aimy wrote:
admin wrote:
aimy wrote:As you all might already aware, today's technology of digital photography also have implemented GPS info on the photos taken.

So, wouldn't it be great if XYplorer users could be let to freely playing around with those useful info with Batch Rename?

Thank you.
Sure, when I find the time...
Thanks admin.

But in the meantime, is there any interim solutions for this problem to resolve the slowness and to include the renaming preview?

Thank you.
What about writing better code? :wink: Look into ForEach loops...
Thanks for the idea.

So, what I have now is..

Code: Select all

// selected list items
  foreach($token,<get SelectedItemsPathNames |>) {
      $CamMod = property("CameraModel", $token);
      //trim space and tabs around the reported property:
      $CamMod = regexreplace($CamMod, "\s*|\t*(.*)\s*|\t*", "$1");
      //echo $CamMod
        rename b, '<dateexif yyyymmdd.hhnnss>~*_'.$CamMod, , $token;
     }
So, how do I turn on the preview? I have tested several methods but the only thing I managed to is to preview each file one by one :(

The other problems is that how could I make the script to be treated as ONE SINGLE PROCESS for UNDO?

Please find the attached files for sample images with EXIF.

Thank you.
To see the attached files, you need to log into the forum.

zer0
Posts: 2676
Joined: 19 Jan 2009 20:11

Re: EXIF Info..

Post by zer0 »

aimy wrote:So, wouldn't it be great if XYplorer users could be let to freely playing around with those useful info with Batch Rename?
May I ask why you would want to mess around with photos' geotagging information?
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build

admin
Site Admin
Posts: 66362
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: EXIF Info..

Post by admin »

aimy wrote:So, how do I turn on the preview? I have tested several methods but the only thing I managed to is to preview each file one by one :(
Look fiercely at the syntax of rename. Do you see the word preview anywhere?

Code: Select all

rename [mode (b|r|s|k|e)], pattern, [preview (p)], [itemlist], [flags=1] 

aimy
Posts: 186
Joined: 26 Feb 2007 15:44

Re: EXIF Info..

Post by aimy »

admin wrote:Look fiercely at the syntax of rename. Do you see the word preview anywhere?

Code: Select all

rename [mode (b|r|s|k|e)], pattern, [preview (p)], [itemlist], [flags=1] 
As I said, using the current coding as above, I only manage to see the preview one by one, not the whole list like the standard batch rename.

Could someone here help me please...

Thank you.

admin
Site Admin
Posts: 66362
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: EXIF Info..

Post by admin »

Ah, sorry, did not see that.

I don't see a solution at the moment (there might be one anyway).

aimy
Posts: 186
Joined: 26 Feb 2007 15:44

Re: EXIF Info..

Post by aimy »

zer0 wrote:
aimy wrote:So, wouldn't it be great if XYplorer users could be let to freely playing around with those useful info with Batch Rename?
May I ask why you would want to mess around with photos' geotagging information?
Oh I'm sorry.. I just realized that the info is actually in the longitude/latitude format, isn't it?

I thought it is a text like Nottingham for example. If it is, it's very sensible why I want to use that info right? :wink:

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: EXIF Info..

Post by TheQwerty »

aimy wrote:
zer0 wrote:
aimy wrote:So, wouldn't it be great if XYplorer users could be let to freely playing around with those useful info with Batch Rename?
May I ask why you would want to mess around with photos' geotagging information?
Oh I'm sorry.. I just realized that the info is actually in the longitude/latitude format, isn't it?

I thought it is a text like Nottingham for example. If it is, it's very sensible why I want to use that info right? :wink:
It would be slow but you could use a web service to look up the coordinates and then read results to get a city...
https://code.google.com/apis/maps/docum ... eGeocoding
https://maps.googleapis.com/maps/api/ge ... nsor=false
http://www.wolframalpha.com/input/?i=38 ... %2711.58+W
http://www.geody.com/geolook.php?world= ... bm1=submit

aimy
Posts: 186
Joined: 26 Feb 2007 15:44

Re: EXIF Info..

Post by aimy »

Thanks a lot for your concern really 8)

But since I'm not a travelling person :mrgreen:, actually I didn't bother much about that Geotagging, that's why I didn't turn that feature on :D

Anyway, back to my main concern, all the EXIF info should be useful in file renaming right?

So anyone could please help me out in my case. I've already tried the ForEach method for 100 files, but it seems that the processing is just about the same with the one that Stefan had provided earlier, it's just less coding perhaps.

Thank you.

admin
Site Admin
Posts: 66362
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: EXIF Info..

Post by admin »

You softened my heart. Next version can do this:

Code: Select all

rename b, '*-<prop CameraModel>', p;

Post Reply