Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Closing "fallow-10": Adding an `update_cache!` method to the flickr s…

…et bits, and the accompanying Rake tasks.
  • Loading branch information...
commit a03eefe3899f7e8e49488168028d488d321a850d 1 parent b460436
@mikewest authored
View
26 .ditz/issue-e900d56b570eb1cedc2c391964acee020c29e50a.yaml
@@ -0,0 +1,26 @@
+--- !ditz.rubyforge.org,2008-03-06/issue
+title: Add `update_cache!` method to Flickr.
+desc: ""
+type: :task
+component: Fallow
+release: v0.2
+reporter: Mike West <mike@mikewest.org>
+status: :closed
+disposition: :fixed
+creation_time: 2008-11-16 12:37:08.651104 Z
+references: []
+
+id: e900d56b570eb1cedc2c391964acee020c29e50a
+log_events:
+- - 2008-11-16 12:37:10.282852 Z
+ - Mike West <mike@mikewest.org>
+ - created
+ - ""
+- - 2008-11-16 12:37:49.074747 Z
+ - Mike West <mike@mikewest.org>
+ - changed status from unstarted to in_progress
+ - ""
+- - 2008-11-16 12:56:00.371860 Z
+ - Mike West <mike@mikewest.org>
+ - closed with disposition fixed
+ - ""
View
13 Rakefile
@@ -69,6 +69,10 @@ THIN_SOCKETS = '/tmp/mikewestorg.sock'
Fallow::Twitter.update_cache!
end
+ task :populate_flickr do
+ Fallow::Flickr.update_cache!
+ end
+
task :sync_twitter do
Fallow::Twitter.get_tweets!
end
@@ -85,9 +89,9 @@ THIN_SOCKETS = '/tmp/mikewestorg.sock'
Fallow::Homepage.new.render()
end
- task :populate => [:reset_db, :populate_articles, :populate_delicious, :populate_twitter, :populate_archive, :populate_homepage]
+ task :populate => [:reset_db, :populate_articles, :populate_delicious, :populate_twitter, :populate_flickr, :populate_archive, :populate_homepage]
- task :update_bookmarks => [:sync_delicious, :populate_archive, :populate_homepage]
+ task :sync => [:sync_delicious, :sync_flickr, :sync_twitter]
#
# Git Tasks
@@ -122,6 +126,11 @@ THIN_SOCKETS = '/tmp/mikewestorg.sock'
task :rethin => [:restart_thin, :remove_logs]
+ desc 'Start lobster locally'
+ task :lobster do
+ `rackup -Ilib #{ROOT_DIR}/rackup.ru`
+ end
+
#
# Log Tasks
#
View
4 fallow/cache.rb
@@ -190,8 +190,8 @@ def Cache.update_flickr_set( path, data )
"id" => data['id'].to_i,
"secret" => data['secret'],
"farm" => data['farm'].to_i,
- "primary" => data['primary'].to_i,
- "photos" => data['photos'].to_i
+ "primary" => data['primary'].to_i
+# "photos" => data['photos'].to_i
)
Cache.db.commit
# rescue Exception => boom
View
15 fallow/flickr.rb
@@ -26,8 +26,6 @@ def Flickr.get_set_list!
next if Flickr.set_exists?( attributes['id'] )
-Fallow.log( 'Processing Set #' + attributes['id'] )
-
photo = Flickr.get_photo_data( attributes['primary'], attributes['secret'], attributes['id'] )
photoset = {
@@ -46,6 +44,19 @@ def Flickr.get_set_list!
Flickr.persist( photoset['path'], photoset, true )
end
end
+
+ def Flickr.update_cache!
+ require 'find'
+ Find.find( FLICKR_ROOT ) do |set|
+ if File.file?(set) && set.match(%r{/(\d+).yaml$})
+ puts "Rendering /flickr/#{$1}\n"
+
+ data = File.open( set ) { |yf| YAML::load( yf ) }
+
+ Flickr.persist( "/flickr/#{$1}", data, false )
+ end
+ end
+ end
private
def Flickr.set_exists?( set_id )
Please sign in to comment.
Something went wrong with that request. Please try again.