/////////////////////////////////////////////////////////////////////////////// //v0.1 - o8/2o14 //- initial //v0.5 //- resolves exiftool path //- exiftoolpath in quotes //- black/white list of extensions //- prepared to support updates //todos // - fails to create tmp file for libary paths /////////////////////////////////////////////////////////////////////////////// // add/edit columns here /////////////////////////////////////////////////////////////////////////////// var COLUMNS = [ // col-name groupname tagname col-label justify default callback new Column("LensID", "Composite", "LensID", "Lens ID", "left", "-", GetLens), new Column("CropFactor", "Composite", "ScaleFactor35efl", "Crop Factor", "right", "", null), new Column("HFDistance", "Composite", "HyperfocalDistance", "HF Distance", "right", "", null), new Column("FocusMode", "Panasonic", "FocusMode", "Focus Mode", "left", "", null), new Column("Shutter", "Panasonic", "ShutterType", "Shutter", "left", "", null), new Column("Faces", "XMP-mwg-rs", "RegionName", "Faces", "left", "", null), //picasa face region names new Column("Ratio", "", "", "Ratio", "right", "", GetRatio, "native"), new Column("Orientation", "", "", "Orientation", "right", "", GetOrientation, "native") ]; /////////////////////////////////////////////////////////////////////////////// // callbacks to calculate own values /////////////////////////////////////////////////////////////////////////////// // GetLens(): fix missing lens-id, by looking for camera model (with fixed lens) // this is a exiftool type column, providing all known exiftool tags function GetLens(tags, column, data){ //if column.value is not empty and not equal to default, exif tag was found if (column.value!="" && column.value!=column.defaultValue){ //keep original exif valie by simply returning it return column.value. replace("LUMIX","Lumix"). replace("VARIO","Vario"). replace("OLYMPUS M.","Olympus "); } //column value is empty or default, try to return custom lens-id based on //additional exif informatiom try{ if (tags["ExifIFD"]["FNumber"]=="0") return "Prime lens (manual)"; if (tags["IFD0"]["Model"]=="FC-S3"){ //we inject a crop factor information for this camera here as well, //to avoid another callback for the cropfactor column tags["Composite"]["ScaleFactor35efl"]="4.9"; return "Kyocera S3, 38-76mm, F2.8-3.5"; } if (tags["IFD0"]["Model"]=="DMC-FX01") return "FX-01 28-102mm F2.8-5.6"; if (tags["IFD0"]["Model"]=="DMC-FZ28") return "FZ-28 27-486mm F2.8-4.4"; if (tags["IFD0"]["Model"]=="DMC-FX77") return "FX-77 24-120mm F2.5-5.9"; if (tags["IFD0"]["Model"]=="DMC-FZ150") return "FZ-150 25-600mm F2.8-5.2"; if (tags["IFD0"]["Model"]=="DMC-FZ200") return "FZ-200 25-600mm F2.8"; } catch(e){} //still here, return the columns default value return column.defaultValue; } /////////////////////////////////////////////////////////////////////////////// // GetRatio(): get image ratio with DOs native image metadata support // this is a native type column, providing metadata fetched by DO function GetRatio(metadata, column, data){ return GetImageRatio(metadata.picwidth,metadata.picheight); } /////////////////////////////////////////////////////////////////////////////// // GetOrientation(): get image orientation function GetOrientation(metadata, column, data){ if (metadata.picwidth>metadata.picheight) return "Landscape"; return "Portrait"; } /////////////////////////////////////////////////////////////////////////////// // following code is not meant to be edited, but feel free to do so. o) /////////////////////////////////////////////////////////////////////////////// var shell = new ActiveXObject("WScript.Shell"); var fso = new ActiveXObject("Scripting.FileSystemObject"); String.prototype.lTrim = doLTrim; function doLTrim(){return this.replace(/^\s*/,'');} String.prototype.rTrim = doRTrim; function doRTrim(){return this.replace(/\s*$/,'');} String.prototype.trim = doTrim; function doTrim(){return this.lTrim().rTrim();} /////////////////////////////////////////////////////////////////////////////// function OnInit(data) { //onOnit //uid added via script wizard, do not change after publishing this script var uid = "0EC23487-9ECF-4C42-96D6-793C0B83454F"; //resource center url added via script wizard (required for updating) var url = "http://resource.dopus.com/viewtopic.php?f=35&t=22729"; data.name = "Column.File: ExtendedEXIF"; data.desc = "Columns for extended/custom exif information."; data.copyright = "tbone"; data.min_version = "11.5.1" data.version = "0.5"; data.default_enable = true; for (var c=0;cx){ var z=x; x=y; y=z; } var hcf = FindHCF(x, y); var factorW = x/hcf; var factorH = y/hcf; switch (factorW){ case 1: case 2: case 3: case 4: case 5: case 6: case 9: case 10: case 21: //return return factorW+":"+factorH; } var ratio = x/y; if (ratio>0.9 && ratio<1.1){ return "1:1";} if (ratio>1.09 && ratio<1.3){ return "5:4"; } if (ratio>1.29 && ratio<1.4){ return "4:3"; } if (ratio>1.4 && ratio<1.60){ return "3:2";} if (ratio>1.61 && ratio<1.70){ return "5:3";} if (ratio>1.7 && ratio<1.88){ return "16:9";} if (ratio>1.87 && ratio<2.25){ return "2:1";} if (ratio>2.24 && ratio<2.4){ return "21:9";} //common ratio could not be found return factorW+":"+factorH; } /////////////////////////////////////////////////////////////////////////////// function OnAboutScript(data){ //v0.1 var cmd = DOpus.Create.Command(); if (!cmd.Commandlist('s').exists("ScriptWizard")){ if (DOpus.Dlg.Request("The 'ScriptWizard' add-in has not been found.\n\n"+ "Install 'ScriptWizard' from [resource.dopus.com].\nThe add-in enables this dialog and also offers "+ "easy updating of scripts and many more.","Yes, take me there!|Cancel", "No About.. ", data.window)) cmd.RunCommand('http://resource.dopus.com/viewtopic.php?f=35&t=23179');} else cmd.RunCommand('ScriptWizard ABOUT WIN='+data.window+' FILE="'+Script.File+'"'); } //MD5 = "a9bcf89a066ca9a9a904de6bf70c94e9"; DATE = "2014.11.21 - 02:00:03"