Page 2 of 3
Re: EXIF Info..
Posted: 11 Feb 2011 21:04
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:
Re: EXIF Info..
Posted: 17 Oct 2011 14:02
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>
Thank you.
Re: EXIF Info..
Posted: 18 Oct 2011 03:41
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.
Re: EXIF Info..
Posted: 18 Oct 2011 09:12
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...
Re: EXIF Info..
Posted: 18 Oct 2011 09:50
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.
Re: EXIF Info..
Posted: 18 Oct 2011 10:07
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?

Look into ForEach loops...
Re: EXIF Info..
Posted: 18 Oct 2011 11:27
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?

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.
Re: EXIF Info..
Posted: 18 Oct 2011 11:55
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?
Re: EXIF Info..
Posted: 18 Oct 2011 13:53
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]
Re: EXIF Info..
Posted: 18 Oct 2011 16:47
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.
Re: EXIF Info..
Posted: 18 Oct 2011 16:50
by admin
Ah, sorry, did not see that.
I don't see a solution at the moment (there might be one anyway).
Re: EXIF Info..
Posted: 18 Oct 2011 17:33
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?

Re: EXIF Info..
Posted: 18 Oct 2011 18:00
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?

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
Re: EXIF Info..
Posted: 19 Oct 2011 03:10
by aimy
Thanks a lot for your concern really
But since I'm not a travelling person

, actually I didn't bother much about that Geotagging, that's why I didn't turn that feature on
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.
Re: EXIF Info..
Posted: 19 Oct 2011 09:40
by admin
You softened my heart. Next version can do this:
Code: Select all
rename b, '*-<prop CameraModel>', p;