Skip to content

Instantly share code, notes, and snippets.

View bhaity's full-sized avatar

Sikandar Shukla bhaity

View GitHub Profile
[{"created_at":"2012-10-18T16:10:36Z","id":664034,"person_id":73560,"photo_id":468190,"position":1908,"updated_at":"2012-10-18T16:10:36Z","person":{"created_at":"2012-10-18T16:10:36Z","id":73560,"name":"Daniel Best","photo_id":null,"title":null,"updated_at":"2012-10-18T16:10:36Z"}},{"created_at":"2012-10-18T16:10:40Z","id":664035,"person_id":73561,"photo_id":468190,"position":1909,"updated_at":"2012-10-18T16:10:40Z","person":{"created_at":"2012-10-18T16:10:40Z","id":73561,"name":"Percy Champman","photo_id":null,"title":null,"updated_at":"2012-10-18T16:10:40Z"}},{"created_at":"2012-10-18T16:10:45Z","id":664036,"person_id":73562,"photo_id":468190,"position":1910,"updated_at":"2012-10-18T16:10:45Z","person":{"created_at":"2012-10-18T16:10:45Z","id":73562,"name":"Hannibal Lecter","photo_id":null,"title":null,"updated_at":"2012-10-18T16:10:45Z"}},{"created_at":"2012-10-23T17:27:41Z","id":664044,"person_id":73548,"photo_id":468190,"position":1918,"updated_at":"2012-10-23T17:27:41Z","person":{"created_at":"2012-09-2
def zip(hash)
#this method takes a hash in the format {FIRST_PHOTO_ID => {:dpi=>INT,
# :watermark=>BOOL},
# SECOND_PHOTO_ID => {:dpi=>INT,
# :watermark=>BOOL} }
require 'zip/zip'
#new_hash_of_photos = {}
hash.each do |id, specs|
%x[exiftool -iptc:DateCreated="#{event.date_created}" -iptc:DigitalCreationDate="#{event.date_created}" -iptc:DigitalCreationTime="#{event.time_created}" -iptc:Headline="#{event.name}" -iptc:By-line="#{event.by_line}" -iptc:City="#{event.city}" -iptc:Province-State="#{event.state}" -iptc:Country-PrimaryLocationName="#{event.country_primary_location_name}" -iptc:CopyrightNotice="#{event.copyright_notice}" -iptc:Sub-location="#{event.sub_location}" -iptc:Caption-Abstract="#{people_string}" #{path}]
to_write = {:date_created=>"", :time_created=>"", :name=>"", :by_line=>"", :city=>"", :state=>"", :country_primary_location_name=>"", :copyright_notice=>"", :sub_location=>"", :caption=>""}
iptc_values = ["2013:11:19", "20:48:57", "InStyle Editor Ariel Foxman Hosts a Cocktail Party to Welcome Eric Wilson as InStyle’s First Fashion News Director", "Billy Farrell/BFAnyc.com", "New York", "New York", "United States", "BFA NYC", "The Skylark, NYC", "Zac Posen, Vera Wang, Ariel Foxman, Karin Tracy"]
i=0
to_write.each do |key,value|
to_write[key] = iptc_values[i]
i = i+1
end
to_write.each_with_index do |(key, value), index|
to_write[key] = iptc_values[index]
end
Entry.objects.filter(
... headline__startswith='What'
... ).exclude(
... pub_date__gte=datetime.date.today()
... ).filter(
... pub_date__gte=datetime(2005, 1, 30)
... )