1 2 3 Previous Next 31 Replies Latest reply: Jan 17, 2012 12:41 PM by léonie
Kirby Krieger Level 6 Level 6 (11,945 points)

Is there any way to sort the Images in the Browser by time of day, independent of date?  Time is available -- each Image has a date/time stamp, and the Filter HUD Rule "Date" includes a "Capture Hour" option.

 

Thanks.

 

(Ideally, I'd like to sort by solar time -- I'd think this would be of interest to naturalists -- but that seems to be a project for coming years.)

 

Message was edited by: Kirby Krieger -- corrected name of Rule option.


MacBook Pro 13, Mac OS X (10.6.8), 8 G / 500 G internal / 5 TB external / NEC 2490 / ColorMunki Pho
  • 1. Re: Sort by time of day, regardless of date
    Frank Caggiano Level 7 Level 7 (23,830 points)
  • 2. Re: Sort by time of day, regardless of date
    Kirby Krieger Level 6 Level 6 (11,945 points)

    Brilliant!

     

    Just to make sure (I'm rather dim regarding scripts):  What I did was copy your code into the Scripts Editor, and then save it in "~/Library/Scripts/Aperture" as "Create and Fill Custom Time Field for selected Aperture Images" (yes, didn't have to make the name so descriptive).  Then I select Images in Aperture, click the Script menulet and select "Create and Fill ... ".  I have to manually add the custom field "Capture Time" to my Metadata Overlay(s) and/or Metadata Preset(s) -- and of course the Overlay to add it to is "List View", so that I can then sort on it in the Browser.

     

    Is that the best way to do it?

     

    I see you include it on Import.  I'm still mulling that over ... I will likely do it after Import by Project as needed.

     

    Thanks for remembering and for providing your script! 

  • 3. Re: Sort by time of day, regardless of date
    Kirby Krieger Level 6 Level 6 (11,945 points)

    Hmmm.

     

    I guess it's time to convert to Military time.

    /___sbsstatic___/migration-images/172/17270852-1.jpg

     

    Any other way 'round this?  My guess is that this is going to be tricky.

  • 4. Re: Sort by time of day, regardless of date
    Kirby Krieger Level 6 Level 6 (11,945 points)

    More easily done than I thought.  I changed all my time formats to 24-hour format (I used "00-23"), deleted the contents of the "Capture Time" field, and ran Frank's script again.  Screenshot:

    /___sbsstatic___/migration-images/172/17271149-1.jpg

     

    We still need to work on having the percentage offset from solar noon (which is still what I want), but this is useful and most appreciated.

  • 5. Re: Sort by time of day, regardless of date
    Frank Caggiano Level 7 Level 7 (23,830 points)

    Just back, I see you have it pretty much worked out. Glad to help.

     

    Right once the script adds the custom field and populates it then you can use it the same as any metadata field in Aperture. Does that answer the question?

     

    Anyway as for needing to have 24hr time set, yeah for time sorting that's pretty much a have to have. As you found out sorting times with AM PM  doesn't work to good. I suppose the script could translate the times into a 24 hour format regardless of the system settings. I always use 24 hour time, just seems to make more sense and it drives my kids insane (explaining to their friends why the microwave says it's 20:37)

     

    Using it on import, I added this code into my standard on-import script so it gets run on all new images. If you will be running it on images on a need-to-have basis you might want to turn it into a service, this way you can just access it from the Aperture->Services menu. It would be a fairly easy conversion let me know if you're interested.

     

    regards

     

    Message was edited by: Frank Caggiano - Interested in hearing more about the solar offset you mentioned.

  • 6. Re: Sort by time of day, regardless of date
    Kirby Krieger Level 6 Level 6 (11,945 points)

    Frank -- thanks for the offer to create a Service instead of a Script.  Not worth the time.  Works fine as a Script: easily available from my Menubar (along with some other Aperture scripts).

     

    Does the script produce a "time-code" that is then formatted according to system settings, or is the result straight text?

     

    There are four Times formats set system-wide.  If the script result is a time-code that is then formatted according to the system setting, then I need only set one of them to 24-hour time.  But it may be that the script needs 24-hour time as input.  (I think it's the former -- I'm asking to save me the trouble of trying all the possibilities.)

    Screenshot:

    /___sbsstatic___/migration-images/172/17275226-1.jpg

     

    Re: %age offset from solar time.  That was something we touched on in the thread you cited.  My interest is in exactly that: the angle of inclination at the time of exposure.  "Time of day" is no more than a rough proxy for that.  Since we now have universal time and global geo-coding, the angle of inclination should be easy to compute for any photograph.  My interest isn't forensic in a hard sense: for my nature photographs, I'm interestedin how they document diurnal rhythms (and, in an artistic sense, what I'm calling "the natural rhythm of light").  I'm operating on the assumption that those rhythms follow the sun, and rhyme only vaguely with the steady tick-tocking of our masterful timekeepers.  Currently I'm working on a sort of "Year as a Day" collection of photos taken in one particular National Park (Blackwater NWR on Maryland's Eastern Shore) over the course of a couple of years.  I'm manually sorting the good photos into the day's rhythm.  Sorting them by time is a helpful start (but still, naturally, quite bejiggled from my aim).

  • 7. Re: Sort by time of day, regardless of date
    léonie Level 9 Level 9 (51,725 points)

    I'm manually sorting the good photos into the day's rhythm.

    As a start, to replace your old astrolabe?

     

    Complete Sun and Moon Data for One Day: http://aa.usno.navy.mil/data/docs/RS_OneDay.php

     

    Cheers

    Léonie

  • 8. Re: Sort by time of day, regardless of date
    Frank Caggiano Level 7 Level 7 (23,830 points)

    I made a change to the script which should eliminate the need to set your system time to 24hr format (even though that's what all the kool kids do)

     

    Here it is:

     

    display dialog "Aperture will Start." & return & return & "Select image(s), press Continue when ready" buttons {"Continue", "Stop"} default button 1

    set the user_choice to the button returned of the result

     

    if the user_choice is "Stop" then

      tellme to quit

    end if

     

    tell application "Aperture"

      activate

              set imageSel to (get selection)

     

              if imageSel is {} then

                        error "Please select an image."

              else

                        repeat with i from 1 to count of imageSel

                                  tell item i of imageSel

                                            set imageDate to value of EXIF tag "ImageDate"

                                            set hrs to hours of imageDate

                                            if hrs < 10 then

                                                      set hrs to "0" & hrs

                                            end if

     

                                            set mins to minutes of imageDate

                                            if mins < 10 then

                                                      set mins to "0" & mins

                                            end if

     

                                            set secs to seconds of imageDate

                                            if secs < 10 then

                                                      set secs to "0" & secs

                                            end if

     

                                            set timeString to (hrs & ":" & mins & ":" & secs) as rich text

                                            display dialog "Time is: " & timeString

      --set s to time string of imageDate

      make new custom tag with properties {name:"Capture Time", value:timeString}

                                  end tell

                        end repeat

              end if

    end tell

     

     

    It dismantles the time in the EXIF data and puts it back together again in 24 hr format. At least that is what I think it will do. As I said I have my system set to 24 hour format and my Canon only does 24 hour in the EXIF data so I can't really give ti a good test.

     

    Give it a shot and if it works you won't need to change your system time format.

  • 9. Re: Sort by time of day, regardless of date
    Frank Caggiano Level 7 Level 7 (23,830 points)

    If I'm understanding you what you are looking for is true solar time, correct?

     

    Wall time is only an aproximation of solar time and is is only correct at the midpoint of a time zone when no daylight saving time is in effect you would need to calculate your position and then apply a correction.

     

    For example when the wall clock says it is 12:00 locations to the east of the TZ midpoint will have later solar times and locations to the west of the midpoint will have earlier solar times.

     

    If you Google solar time you'll get a number of interesting hits.

     

    Let me know if I'm understanding what you are looking for,

     

    regards

     

    Take a look at Solar Position Calculator from NASA

     

    this is pretty kool too

     

    Solar Time

     

    Message was edited by: Frank Caggiano

  • 10. Re: Sort by time of day, regardless of date
    CalxOddity Level 3 Level 3 (680 points)

    Hi Kirby,

           Sort of related - I use keywords for time of day (dawn/morning/midday/afternoon/sunset/dusk/night) to capture this info.  Mind you, I don't need precision...

  • 11. Re: Sort by time of day, regardless of date
    Kirby Krieger Level 6 Level 6 (11,945 points)

    It's a great suggestion -- thanks.  I had started to implement something like that, but dropped it awhile ago.  Off to make a button set now.

     

    I still like to see a time-of-day sort hard-wired into the Aperture brain.

  • 12. Re: Sort by time of day, regardless of date
    Kirby Krieger Level 6 Level 6 (11,945 points)

    leonieDF wrote:

    As a start, to replace your old astrolabe?

    God's bodkin -- that's why He gave us the transitor.

     

    Just as a thought experiment, wonder what Mr. Jobs would have done with the old sky finder.

  • 13. Re: Sort by time of day, regardless of date
    Kirby Krieger Level 6 Level 6 (11,945 points)

    Works well.  Thanks!  Can I remove this line:

    display dialog "Time is: " & timeString


    without harming anything?

  • 14. Re: Sort by time of day, regardless of date
    Frank Caggiano Level 7 Level 7 (23,830 points)

    oops, debug statement snuck thru, that's what you get when you're on the bleeding edge of sw development

     

    Yes you can get rid of it.

1 2 3 Previous Next