Permalink
Browse files

Added buttons to control other options, such as writing XMP files and…

… performing the actual tagging.

Corrected the path to the internal python files; added the python files as resources.
Added a polyline to track the points from the GPX file; currently displays *all* points, resulting in a large HTML file.
Changed all output in python files to standard error.
  • Loading branch information...
1 parent 0124e0b commit df6755b90d4116b8676694f68aef82b04e019da9 @imolloy committed Jun 30, 2011
Showing with 252 additions and 48 deletions.
  1. +151 −33 English.lproj/MainMenu.xib
  2. +28 −0 GPX Tagger.xcodeproj/project.pbxproj
  3. +5 −0 GPXController.h
  4. +37 −7 GPXController.m
  5. +23 −3 GoogleMaps.py
  6. +8 −5 geotag.py
View
184 English.lproj/MainMenu.xib
@@ -21,8 +21,8 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="372"/>
<integer value="29"/>
+ <integer value="610"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1323,7 +1323,7 @@
<object class="NSWindowTemplate" id="972006081">
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{335, 528}, {696, 222}}</string>
+ <string key="NSWindowRect">{{335, 530}, {696, 220}}</string>
<int key="NSWTFlags">1954021376</int>
<string key="NSWindowTitle">GPX Tagger</string>
<string key="NSWindowClass">NSWindow</string>
@@ -1337,7 +1337,7 @@
<object class="NSTextField" id="104229112">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{20, 180}, {234, 22}}</string>
+ <string key="NSFrame">{{20, 178}, {234, 22}}</string>
<reference key="NSSuperview" ref="439893737"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="773218529">
@@ -1374,7 +1374,7 @@
<object class="NSTextField" id="647270672">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{20, 148}, {234, 22}}</string>
+ <string key="NSFrame">{{20, 146}, {234, 22}}</string>
<reference key="NSSuperview" ref="439893737"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="907577578">
@@ -1391,7 +1391,7 @@
<object class="NSButton" id="347262794">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{253, 174}, {123, 32}}</string>
+ <string key="NSFrame">{{253, 172}, {123, 32}}</string>
<reference key="NSSuperview" ref="439893737"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="492906507">
@@ -1411,7 +1411,7 @@
<object class="NSButton" id="280589736">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{253, 141}, {123, 32}}</string>
+ <string key="NSFrame">{{253, 139}, {123, 32}}</string>
<reference key="NSSuperview" ref="439893737"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="877446641">
@@ -1431,7 +1431,7 @@
<object class="NSSlider" id="706630860">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{85, 110}, {222, 26}}</string>
+ <string key="NSFrame">{{85, 108}, {222, 26}}</string>
<reference key="NSSuperview" ref="439893737"/>
<bool key="NSViewCanDrawConcurrently">YES</bool>
<bool key="NSEnabled">YES</bool>
@@ -1453,7 +1453,7 @@
<object class="NSButton" id="958933378">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{18, 24}, {63, 18}}</string>
+ <string key="NSFrame">{{18, 22}, {63, 18}}</string>
<reference key="NSSuperview" ref="439893737"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="66433356">
@@ -1480,7 +1480,7 @@
<object class="NSButton" id="870420167">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{85, 22}, {63, 21}}</string>
+ <string key="NSFrame">{{85, 20}, {63, 21}}</string>
<reference key="NSSuperview" ref="439893737"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="743888015">
@@ -1502,7 +1502,7 @@
<object class="NSButton" id="681124873">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{280, 12}, {96, 32}}</string>
+ <string key="NSFrame">{{280, 10}, {96, 32}}</string>
<reference key="NSSuperview" ref="439893737"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="472044255">
@@ -1522,7 +1522,7 @@
<object class="NSTextField" id="675676681">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{331, 112}, {42, 17}}</string>
+ <string key="NSFrame">{{331, 110}, {42, 17}}</string>
<reference key="NSSuperview" ref="439893737"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="413695150">
@@ -1551,7 +1551,7 @@
<object class="NSTextField" id="595139084">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{319, 81}, {54, 17}}</string>
+ <string key="NSFrame">{{319, 79}, {54, 17}}</string>
<reference key="NSSuperview" ref="439893737"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="1024476752">
@@ -1567,7 +1567,7 @@
<object class="NSTextField" id="870353754">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{317, 50}, {56, 17}}</string>
+ <string key="NSFrame">{{317, 48}, {56, 17}}</string>
<reference key="NSSuperview" ref="439893737"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="104933290">
@@ -1583,7 +1583,7 @@
<object class="NSTextField" id="179330361">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{20, 112}, {59, 22}}</string>
+ <string key="NSFrame">{{20, 110}, {59, 22}}</string>
<reference key="NSSuperview" ref="439893737"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="298884706">
@@ -1671,7 +1671,7 @@
<object class="NSSlider" id="27787277">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{85, 76}, {222, 26}}</string>
+ <string key="NSFrame">{{85, 74}, {222, 26}}</string>
<reference key="NSSuperview" ref="439893737"/>
<bool key="NSEnabled">YES</bool>
<object class="NSSliderCell" key="NSCell" id="385883230">
@@ -1692,7 +1692,7 @@
<object class="NSTextField" id="360985453">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{20, 80}, {59, 22}}</string>
+ <string key="NSFrame">{{20, 78}, {59, 22}}</string>
<reference key="NSSuperview" ref="439893737"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="616643724">
@@ -1763,7 +1763,7 @@
<object class="NSSlider" id="274236751">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{85, 44}, {222, 26}}</string>
+ <string key="NSFrame">{{85, 42}, {222, 26}}</string>
<reference key="NSSuperview" ref="439893737"/>
<bool key="NSEnabled">YES</bool>
<object class="NSSliderCell" key="NSCell" id="1061558912">
@@ -1784,7 +1784,7 @@
<object class="NSTextField" id="770318914">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{20, 48}, {59, 22}}</string>
+ <string key="NSFrame">{{20, 46}, {59, 22}}</string>
<reference key="NSSuperview" ref="439893737"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="435965452">
@@ -1880,7 +1880,7 @@
<string>public.url-name</string>
</object>
</object>
- <string key="NSFrame">{{378, 0}, {318, 222}}</string>
+ <string key="NSFrame">{{378, -2}, {318, 222}}</string>
<reference key="NSSuperview" ref="439893737"/>
<reference key="NSNextKeyView"/>
<string key="FrameName"/>
@@ -1909,7 +1909,7 @@
<object class="NSButton" id="327618939">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{184, 12}, {96, 32}}</string>
+ <string key="NSFrame">{{184, 10}, {96, 32}}</string>
<reference key="NSSuperview" ref="439893737"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="515557055">
@@ -1926,8 +1926,17 @@
<int key="NSPeriodicInterval">25</int>
</object>
</object>
+ <object class="NSProgressIndicator" id="1009788281">
+ <reference key="NSNextResponder" ref="439893737"/>
+ <int key="NSvFlags">1292</int>
+ <object class="NSPSMatrix" key="NSDrawMatrix"/>
+ <string key="NSFrame">{{166, 20}, {16, 16}}</string>
+ <reference key="NSSuperview" ref="439893737"/>
+ <int key="NSpiFlags">20746</int>
+ <double key="NSMaxValue">100</double>
+ </object>
</object>
- <string key="NSFrameSize">{696, 222}</string>
+ <string key="NSFrameSize">{696, 220}</string>
<reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
@@ -2770,6 +2779,46 @@
</object>
<int key="connectionID">601</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">writeXMPBox</string>
+ <reference key="source" ref="298288047"/>
+ <reference key="destination" ref="958933378"/>
+ </object>
+ <int key="connectionID">605</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">writeEXIFBox</string>
+ <reference key="source" ref="298288047"/>
+ <reference key="destination" ref="870420167"/>
+ </object>
+ <int key="connectionID">606</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">selectGPX:</string>
+ <reference key="source" ref="298288047"/>
+ <reference key="destination" ref="347262794"/>
+ </object>
+ <int key="connectionID">607</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">selectImages:</string>
+ <reference key="source" ref="298288047"/>
+ <reference key="destination" ref="280589736"/>
+ </object>
+ <int key="connectionID">608</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">progressIndication</string>
+ <reference key="source" ref="298288047"/>
+ <reference key="destination" ref="1009788281"/>
+ </object>
+ <int key="connectionID">611</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -3327,7 +3376,6 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="104229112"/>
<reference ref="647270672"/>
- <reference ref="347262794"/>
<reference ref="280589736"/>
<reference ref="179330361"/>
<reference ref="360985453"/>
@@ -3343,6 +3391,8 @@
<reference ref="327618939"/>
<reference ref="747056636"/>
<reference ref="681124873"/>
+ <reference ref="347262794"/>
+ <reference ref="1009788281"/>
</object>
<reference key="parent" ref="972006081"/>
</object>
@@ -4107,6 +4157,11 @@
<reference key="object" ref="515557055"/>
<reference key="parent" ref="327618939"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">610</int>
+ <reference key="object" ref="1009788281"/>
+ <reference key="parent" ref="439893737"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -4404,6 +4459,8 @@
<string>602.IBPluginDependency</string>
<string>602.IBViewBoundsToFrameTransform</string>
<string>603.IBPluginDependency</string>
+ <string>610.IBPluginDependency</string>
+ <string>610.IBViewBoundsToFrameTransform</string>
<string>72.IBPluginDependency</string>
<string>72.ImportedFromIB2</string>
<string>73.IBPluginDependency</string>
@@ -4537,7 +4594,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{525, 802}, {197, 73}}</string>
- <string>{{658, 836}, {448, 20}}</string>
+ <string>{{504, 736}, {448, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{74, 862}</string>
@@ -4562,9 +4619,9 @@
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
- <string>{{312, 634}, {696, 222}}</string>
+ <string>{{348, 453}, {696, 220}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{312, 634}, {696, 222}}</string>
+ <string>{{348, 453}, {696, 220}}</string>
<integer value="1"/>
<string>{{33, 99}, {480, 360}}</string>
<string>{3.40282e+38, 3.40282e+38}</string>
@@ -4661,7 +4718,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABDRQAAw6OAAA</bytes>
+ <bytes key="NSTransformStruct">P4AAAL+AAABDfQAAw0wAAA</bytes>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -4761,6 +4818,10 @@
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <object class="NSAffineTransform">
+ <bytes key="NSTransformStruct">P4AAAL+AAABDGgAAwjgAAA</bytes>
+ </object>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
@@ -4804,7 +4865,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">604</int>
+ <int key="maxID">611</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -4813,14 +4874,42 @@
<string key="className">GPXController</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="actions">
- <string key="NS.key.0">process:</string>
- <string key="NS.object.0">id</string>
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>process:</string>
+ <string>selectGPX:</string>
+ <string>selectImages:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ </object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
- <string key="NS.key.0">process:</string>
- <object class="IBActionInfo" key="NS.object.0">
- <string key="name">process:</string>
- <string key="candidateClassName">id</string>
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>process:</string>
+ <string>selectGPX:</string>
+ <string>selectImages:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBActionInfo">
+ <string key="name">process:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">selectGPX:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">selectImages:</string>
+ <string key="candidateClassName">id</string>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
@@ -4832,8 +4921,11 @@
<string>imagesField</string>
<string>minuteField</string>
<string>processButton</string>
+ <string>progressIndication</string>
<string>secondField</string>
<string>webView</string>
+ <string>writeEXIFBox</string>
+ <string>writeXMPBox</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -4842,8 +4934,11 @@
<string>NSTextField</string>
<string>NSTextField</string>
<string>NSButton</string>
+ <string>NSProgressIndicator</string>
<string>NSTextField</string>
<string>WebView</string>
+ <string>NSButton</string>
+ <string>NSButton</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
@@ -4855,8 +4950,11 @@
<string>imagesField</string>
<string>minuteField</string>
<string>processButton</string>
+ <string>progressIndication</string>
<string>secondField</string>
<string>webView</string>
+ <string>writeEXIFBox</string>
+ <string>writeXMPBox</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -4881,13 +4979,25 @@
<string key="candidateClassName">NSButton</string>
</object>
<object class="IBToOneOutletInfo">
+ <string key="name">progressIndication</string>
+ <string key="candidateClassName">NSProgressIndicator</string>
+ </object>
+ <object class="IBToOneOutletInfo">
<string key="name">secondField</string>
<string key="candidateClassName">NSTextField</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">webView</string>
<string key="candidateClassName">WebView</string>
</object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">writeEXIFBox</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">writeXMPBox</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -5505,6 +5615,14 @@
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">NSProgressIndicator</string>
+ <string key="superclassName">NSView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">AppKit.framework/Headers/NSProgressIndicator.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">NSResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
View
28 GPX Tagger.xcodeproj/project.pbxproj
@@ -12,6 +12,11 @@
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
+ 9E09B3F613BB9B400005E0DD /* geotag.py in Resources */ = {isa = PBXBuildFile; fileRef = 9E09B3F513BB9B400005E0DD /* geotag.py */; };
+ 9E09B40213BB9B730005E0DD /* EXIF.py in Resources */ = {isa = PBXBuildFile; fileRef = 9E09B3FE13BB9B730005E0DD /* EXIF.py */; };
+ 9E09B40313BB9B730005E0DD /* GoogleMaps.py in Resources */ = {isa = PBXBuildFile; fileRef = 9E09B3FF13BB9B730005E0DD /* GoogleMaps.py */; };
+ 9E09B40413BB9B730005E0DD /* gps.py in Resources */ = {isa = PBXBuildFile; fileRef = 9E09B40013BB9B730005E0DD /* gps.py */; };
+ 9E09B40513BB9B730005E0DD /* iso8601.py in Resources */ = {isa = PBXBuildFile; fileRef = 9E09B40113BB9B730005E0DD /* iso8601.py */; };
9E7E94BE13BABE00001D350C /* GPXController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E7E94BD13BABE00001D350C /* GPXController.m */; };
9E999F2A13BAE2D600D80015 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E999F2913BAE2D600D80015 /* WebKit.framework */; };
/* End PBXBuildFile section */
@@ -29,6 +34,11 @@
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
8D1107310486CEB800E47090 /* GPX_Tagger-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GPX_Tagger-Info.plist"; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* GPX Tagger.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "GPX Tagger.app"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 9E09B3F513BB9B400005E0DD /* geotag.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = geotag.py; sourceTree = "<group>"; };
+ 9E09B3FE13BB9B730005E0DD /* EXIF.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = EXIF.py; sourceTree = "<group>"; };
+ 9E09B3FF13BB9B730005E0DD /* GoogleMaps.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = GoogleMaps.py; sourceTree = "<group>"; };
+ 9E09B40013BB9B730005E0DD /* gps.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = gps.py; sourceTree = "<group>"; };
+ 9E09B40113BB9B730005E0DD /* iso8601.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = iso8601.py; sourceTree = "<group>"; };
9E7E94BC13BABE00001D350C /* GPXController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPXController.h; sourceTree = "<group>"; };
9E7E94BD13BABE00001D350C /* GPXController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPXController.m; sourceTree = "<group>"; };
9E999F2913BAE2D600D80015 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
@@ -85,6 +95,7 @@
29B97314FDCFA39411CA2CEA /* GPX Tagger */ = {
isa = PBXGroup;
children = (
+ 9E09B40613BB9B780005E0DD /* Python */,
080E96DDFE201D6D7F000001 /* Classes */,
29B97315FDCFA39411CA2CEA /* Other Sources */,
29B97317FDCFA39411CA2CEA /* Resources */,
@@ -125,6 +136,18 @@
name = Frameworks;
sourceTree = "<group>";
};
+ 9E09B40613BB9B780005E0DD /* Python */ = {
+ isa = PBXGroup;
+ children = (
+ 9E09B3FE13BB9B730005E0DD /* EXIF.py */,
+ 9E09B3FF13BB9B730005E0DD /* GoogleMaps.py */,
+ 9E09B40013BB9B730005E0DD /* gps.py */,
+ 9E09B40113BB9B730005E0DD /* iso8601.py */,
+ 9E09B3F513BB9B400005E0DD /* geotag.py */,
+ );
+ name = Python;
+ sourceTree = "<group>";
+ };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -177,6 +200,11 @@
files = (
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */,
+ 9E09B3F613BB9B400005E0DD /* geotag.py in Resources */,
+ 9E09B40213BB9B730005E0DD /* EXIF.py in Resources */,
+ 9E09B40313BB9B730005E0DD /* GoogleMaps.py in Resources */,
+ 9E09B40413BB9B730005E0DD /* gps.py in Resources */,
+ 9E09B40513BB9B730005E0DD /* iso8601.py in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
5 GPXController.h
@@ -17,7 +17,12 @@
IBOutlet NSTextField *secondField;
IBOutlet NSButton *processButton;
IBOutlet WebView *webView;
+ IBOutlet NSButton *writeXMPBox;
+ IBOutlet NSButton *writeEXIFBox;
+ IBOutlet NSProgressIndicator *progressIndication;
}
-(IBAction)process:(id)sender;
+-(IBAction)selectGPX:(id)sender;
+-(IBAction)selectImages:(id)sender;
NSTask *gpxgeotag;
@end
View
44 GPXController.m
@@ -12,38 +12,68 @@ @implementation GPXController
- (id)init {
self = [super init];
[[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(finishedDownload:)
+ selector:@selector(finishedTagging:)
name:NSTaskDidTerminateNotification
object:nil];
gpxgeotag = nil; // This is a good time to initialize the pointer
return self;
}
-- (void)finishedDownload:(NSNotification *)aNotification {
+- (void)finishedTagging:(NSNotification *)aNotification {
[processButton setTitle:@"Process"];
[processButton setEnabled:YES];
[gpxgeotag release]; // Don't forget to clean up memory
gpxgeotag = nil; // Just in case...
// And render the results
- //NSString *absolutePath = [shortPath stringByExpandingTildeInPath];
- // initFileURLWithPath
NSString *indexPath = @"~/Library/Application%20Support/GPX%20Tagger/index.html";
[[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[indexPath stringByExpandingTildeInPath]]]];
+ [progressIndication stopAnimation:self];
+ [progressIndication release];
}
- (IBAction)process:(id)sender {
NSLog(@"The User pressed process");
[processButton setEnabled:NO];
gpxgeotag = [[NSTask alloc] init];
[gpxgeotag setLaunchPath:@"/usr/bin/python"];
- [gpxgeotag setArguments:[NSArray arrayWithObjects:@"../../geotag.py",
+ NSString *path = [[NSBundle mainBundle] pathForResource:@"geotag" ofType:@"py"];
+ NSMutableArray *args = [NSMutableArray arrayWithObjects:path,
@"--hours", [hourField stringValue],
@"--minutes", [minuteField stringValue],
@"--seconds", [secondField stringValue],
@"--gpx", [gpxField stringValue],
@"-i", [imagesField stringValue],
- @"--maps", @"~/Library/Application Support/GPX Tagger",
- nil]];
+ @"--maps", @"~/Library/Application Support/GPX Tagger", nil];
+ if (NSOnState == [writeXMPBox state]) {
+ [args addObject:@"-x"];
+ }
+ if (NSOnState == [writeEXIFBox state]) {
+ [args addObject:@"-e"];
+ }
+ [gpxgeotag setArguments:args];
+ progressIndication = [[NSProgressIndicator alloc] init];
+ [progressIndication setUsesThreadedAnimation:YES];
+ [progressIndication startAnimation:self];
[gpxgeotag launch];
}
+
+-(IBAction)selectGPX:(id)sender {
+ NSOpenPanel *op = [NSOpenPanel openPanel];
+ [op setCanChooseFiles:YES];
+ [op setCanChooseDirectories:NO];
+ if ([op runModal] == NSOKButton) {
+ NSString *filename = [op filename];
+ [gpxField setStringValue:filename];
+ }
+}
+
+-(IBAction)selectImages:(id)sender {
+ NSOpenPanel *op = [NSOpenPanel openPanel];
+ [op setCanChooseFiles:NO];
+ [op setCanChooseDirectories:YES];
+ if ([op runModal] == NSOKButton) {
+ NSString *filename = [op filename];
+ [imagesField setStringValue:filename];
+ }
+}
@end
View
26 GoogleMaps.py
@@ -7,8 +7,10 @@ class GoogleMaps(object):
exif_map = {'EXIF ISOSpeedRatings' : 'ISO', 'EXIF FocalLength' : 'Focal', 'EXIF ExposureTime' : 'Shutter', 'EXIF FocalLengthIn35mmFilm' : '35mm Focal', 'EXIF FNumber' : 'F-Stop', 'EXIF Flash' : 'Flash', 'EXIF ExposureBiasValue' : 'Exposure Bias', 'EXIF ExposureProgram' : 'Exposure Program', 'EXIF ExposureMode' : 'Exposure Mode'}
def __init__(self, map='~'):
self.root = os.path.expanduser(map) + '/'
- os.makedirs(self.root + 'images')
+ if not os.path.exists(self.root + 'images'):
+ os.makedirs(self.root + 'images')
self.markers = []
+ self.track = []
self.fd = open(self.root + 'index.html', 'w')
def write_prefix(self, lat, lon):
@@ -39,9 +41,26 @@ def write_prefix(self, lat, lon):
});
var contentStrings = {}
""" % (lat, lon))
+
+ def add_track(self, x, y):
+ self.track.append((x,y))
+
+ def write_track(self):
+ self.fd.write("""var meanderPathCoordinates = [""")
+ self.fd.write(',\n'.join(['new google.maps.LatLng(%f, %f)' % (lat, lon) for (lat,lon) in self.track]))
+ self.fd.write('];\n')
+
def write_suffix(self):
# Write a canned suffix to cloe remainng tags and initialize the canvas
- self.fd.write("""}
+ self.fd.write("""
+ var meanderPath = new google.maps.Polyline({
+ path: meanderPathCoordinates,
+ strokeColor: "#000000",
+ strokeOpacity: 1.0,
+ strokeWeight: 2
+ });
+ meanderPath.setMap(map);
+ }
</script>
</head>
<body onload="initialize()">
@@ -96,4 +115,5 @@ def URL(self):
i += 1
self.write_prefix(sum(lats)/len(lats), sum(lons)/len(lons))
self.fd.write(base_url)
- self.write_suffix()
+ self.write_track()
+ self.write_suffix()
View
13 geotag.py
@@ -78,7 +78,7 @@ def nearest_time_sql(self, t):
Uses the Database to search for the nearest two points
"""
if self.verbose:
- print 'SQL Time',t
+ sys.stderr.write('SQL Time %s' % t)
self.cursor.execute('SELECT * FROM tracklog WHERE dt <= ? ORDER BY dt DESC LIMIT 1', (t,))
d = self.cursor.fetchone()
if d != None:
@@ -96,7 +96,7 @@ def nearest_time_sql(self, t):
t1 = None
self.cursor.fetchall()
if self.verbose:
- print 'SQL Resuls',t0,t1
+ sys.stderr.write('SQL Resuls %s %s' % (t0,t1))
if t0 == None or t1 == None:
return None
return t0,t1
@@ -168,6 +168,11 @@ def image_time(self, path_name, timezone='GMT', delta_hours=0, delta_minutes=0,
self.files_read += 1
return cdt
+ def add_track(self, precision=5):
+ self.cursor.execute('SELECT lat, lon FROM tracklog ORDER BY dt')
+ for (x,y) in self.cursor:
+ self.GM.add_track(x, y)
+
def correlate_timestamp(self, *args):
# if os.isatty(1):
# pbar = progressbar.ProgressBar(len(args), widgets=[progressbar.ETA(), ' ', progressbar.Percentage(), ' ', progressbar.Bar()]).start()
@@ -202,8 +207,6 @@ def correlate_timestamp(self, *args):
sys.stderr.write("Error Processing Last Command:\n\t%s\n" % cmd)
else:
self.files_tagged += 1
- # if os.isatty(1):
- # pbar.finish()
def main(*args, **options):
@@ -215,6 +218,7 @@ def main(*args, **options):
else:
gti.correlate_timestamp(*args)
sys.stdout.write('%d Timestamped Photos\n%d Successfully GeoTagged Photos\n' % (gti.files_read, gti.files_tagged))
+ gti.add_track()
gti.GM.URL()
if __name__ == '__main__':
@@ -232,6 +236,5 @@ def main(*args, **options):
parser.add_option('-v', '--verbose', dest='verbose', default=False, action='store_true', help='Verbose Output')
parser.add_option('--maps', dest='maps', default='/Users/imolloy/Desktop/html', help='Location to save GoogleMaps output')
(options, args) = parser.parse_args()
- print options.__dict__
main(*args, **options.__dict__)

0 comments on commit df6755b

Please sign in to comment.