Permalink
Browse files

fixed bug where photos were taken at night, changed run time

  • Loading branch information...
CorpusCallosum committed Dec 16, 2012
1 parent 35c2a85 commit 60f725cd055d4515ffa62765b7c3a6857128a3ec
Showing with 1,288 additions and 1,780 deletions.
  1. +11 −6 app/controllers/photo_controller.rb
  2. +2 −2 app/models/photo.rb
  3. +4 −0 app/models/region.rb
  4. +11 −2 app/views/region/index.html.erb
  5. +2 −3 config/s3.yml
  6. +6 −12 processing/StyleBlasterGrabber/StyleBlasterGrabber.pde
  7. +313 −0 processing/StyleBlasterGrabber/StyleBlasterGrabber.pde.BACKUP.984.pde
  8. +2 −2 ...source/StyleBlasterGrabber_Mexico.pde → StyleBlasterGrabber/StyleBlasterGrabber.pde.BASE.984.pde}
  9. +4 −4 ...ource/StyleBlasterGrabber_Mexico.pde → StyleBlasterGrabber/StyleBlasterGrabber.pde.LOCAL.984.pde}
  10. +3 −2 ...urce/StyleBlasterGrabber_Mexico.pde → StyleBlasterGrabber/StyleBlasterGrabber.pde.REMOTE.984.pde}
  11. +2 −2 processing/StyleBlasterGrabber/application.macosx/StyleBlasterGrabber.app/Contents/Info.plist
  12. BIN ...rabber/application.macosx/StyleBlasterGrabber.app/Contents/Resources/Java/StyleBlasterGrabber.jar
  13. BIN ...lasterGrabber/application.macosx/StyleBlasterGrabber.app/Contents/Resources/Java/gifAnimation.jar
  14. +874 −0 processing/StyleBlasterGrabber/application.macosx/source/StyleBlasterGrabber.java
  15. +54 −38 processing/StyleBlasterGrabber/application.macosx/source/StyleBlasterGrabber.pde
  16. +0 −4 processing/StyleBlasterGrabber_Mexico/application.linux32/StyleBlasterGrabber_Mexico
  17. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/lib/StyleBlasterGrabber_Mexico.jar
  18. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/lib/core.jar
  19. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/lib/gifAnimation.jar
  20. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/lib/gluegen-rt.jar
  21. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/lib/jogl.jar
  22. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/lib/opengl.jar
  23. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/lib/postToWeb.jar
  24. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/lib/video.jar
  25. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/libgluegen-rt.so
  26. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/libjogl.so
  27. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/libjogl_awt.so
  28. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/libjogl_cg.so
  29. +0 −89 processing/StyleBlasterGrabber_Mexico/application.linux32/source/MotionSensor.pde
  30. +0 −423 processing/StyleBlasterGrabber_Mexico/application.linux32/source/OpticalFlow.pde
  31. +0 −29 processing/StyleBlasterGrabber_Mexico/application.linux32/source/timer.pde
  32. +0 −4 processing/StyleBlasterGrabber_Mexico/application.linux64/StyleBlasterGrabber_Mexico
  33. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/lib/StyleBlasterGrabber_Mexico.jar
  34. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/lib/core.jar
  35. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/lib/gifAnimation.jar
  36. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/lib/gluegen-rt.jar
  37. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/lib/jogl.jar
  38. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/lib/opengl.jar
  39. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/lib/postToWeb.jar
  40. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/lib/video.jar
  41. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/libgluegen-rt.so
  42. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/libjogl.so
  43. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/libjogl_awt.so
  44. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/libjogl_cg.so
  45. +0 −89 processing/StyleBlasterGrabber_Mexico/application.linux64/source/MotionSensor.pde
  46. +0 −423 processing/StyleBlasterGrabber_Mexico/application.linux64/source/OpticalFlow.pde
  47. +0 −29 processing/StyleBlasterGrabber_Mexico/application.linux64/source/timer.pde
  48. +0 −75 .../StyleBlasterGrabber_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Info.plist
  49. BIN ...abber_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/MacOS/JavaApplicationStub
  50. BIN ...ber_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/MacOS/JavaApplicationStub64
  51. +0 −1 ...ing/StyleBlasterGrabber_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/PkgInfo
  52. BIN ...tion.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/StyleBlasterGrabber_Mexico.jar
  53. BIN ...Grabber_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/core.jar
  54. BIN ...Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/gifAnimation.jar
  55. BIN ...r_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/gluegen-rt.jar
  56. BIN ...Grabber_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/jogl.jar
  57. BIN ...co/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/libgluegen-rt.jnilib
  58. BIN ...r_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/libjogl.jnilib
  59. BIN ...xico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/libjogl_awt.jnilib
  60. BIN ...exico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/libjogl_cg.jnilib
  61. BIN ...abber_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/opengl.jar
  62. BIN ...er_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/postToWeb.jar
  63. BIN ...rabber_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/video.jar
  64. BIN ...erGrabber_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/sketch.icns
  65. +0 −89 processing/StyleBlasterGrabber_Mexico/application.macosx/source/MotionSensor.pde
  66. +0 −423 processing/StyleBlasterGrabber_Mexico/application.macosx/source/OpticalFlow.pde
  67. +0 −29 processing/StyleBlasterGrabber_Mexico/application.macosx/source/timer.pde
  68. BIN processing/StyleBlasterGrabber_Mexico/application.windows32/lib/gifAnimation.jar
  69. BIN processing/StyleBlasterGrabber_Mexico/application.windows64/lib/gifAnimation.jar
@@ -4,14 +4,15 @@ class PhotoController < ApplicationController
http_basic_authenticate_with :name => "style", :password => "blaster", :only => :delete
- before_filter :get_hour, :fetch_region
+ before_filter :get_hour
+ before_filter :fetch_region, :except => [:create]
# Show something appropriate
def index
@limit = params[:limit] || 10;
if @nighttime
- @photos = @region.photos.where("created_at > ? AND score > 0", now - 24 * 3600).order("score DESC").limit(@limit)
+ @photos = @region.photos.where("created_at > ? AND score > 0", midnight).order("score DESC").limit(@limit)
else
@photos = @region.photos.order("id DESC").limit(@limit)
end
@@ -86,9 +87,9 @@ def random
# /upload API used by processing, returns url to image
def create
@region = Region.find_by_name(params[:name])
- if params[:secret] == @region.secret
- @photo = Photo.create( :photo => params[:test], :score => 1, :region => @region )
- end
+# if params[:secret] == @region.secret
+ @photo = Photo.create( :photo => params[:test], :score => 1, :region => @region )
+# end
render :text => @photo.photo.url
# render :text => "http://localhost:3000/gallery/" + @photo.id.to_s
@@ -113,7 +114,7 @@ def destroy
def fetch_region
if request.subdomain == "www"
- @region = Region.find(1)
+ @region = Region.find(2)
return true
elsif @region = Region.find_by_name(request.subdomain)
return true
@@ -130,6 +131,10 @@ def now
Time.now.in_time_zone("America/New_York")
end
+ def midnight
+ Time.now.in_time_zone("America/New_York").midnight
+ end
+
def get_hour
@hour = now.hour
@nighttime = (@hour < 7 or @hour >= 16)
View
@@ -10,8 +10,8 @@ class Photo < ActiveRecord::Base
:bucket => 'styleblast',
:path => ':attachment/:style/:basename.:extension',
:s3_credentials => {
- :access_key_id => ENV['ASDF_S3_KEY'],
- :secret_access_key => ENV['ASDF_S3_SECRET']
+ :access_key_id => ENV['OKFOCUS_S3_KEY'],
+ :secret_access_key => ENV['OKFOCUS_S3_SECRET']
}
end
View
@@ -1,4 +1,8 @@
class Region < ActiveRecord::Base
attr_accessible :name, :title, :secret, :tagline, :css, :manifesto
has_many :photos
+
+ def path
+ "http://#{name}.styleblaster.net/"
+ end
end
@@ -6,15 +6,24 @@
&middot;
<%= region.name %>
&middot;
- <big><%= region.title %></big>
+ <big><%= link_to region.title, region.path %></big>
<span>
<%= region.css == "" ? "x" : "css" %>
</span>
<span>
<%= region.manifesto == "" ? "x" : "manifesto" %>
</span>
-<span>
+<span style="width: 200px;">
<%= region.photos.count %> photos
+</span>
+<span style="width: 300px;">
+ <%= link_to "latest", region.path + "latest" %>
+ <%= link_to "random", region.path + "random" %>
+ <%= link_to "top scores", region.path + "top" %>
+ <%= link_to "today", region.path + "today" %>
+</span>
+<span style="width: 200px;">
+ <%= region.photos.order("id DESC").first.created_at %>
</span>
<br>
<% end %>
View
@@ -1,4 +1,3 @@
-access_key_id: <%= ENV['ASDF_S3_KEY'] %>
-secret_access_key: <%= ENV['ASDF_S3_SECRET'] %>
+access_key_id: <%= ENV['OKFOCUS_S3_KEY'] %>
+secret_access_key: <%= ENV['OKFOCUS_S3_SECRET'] %>
bucket: styleblast
-
@@ -27,8 +27,8 @@ MotionSensor motionSensor;
//SETUP VARS
String version = "1.5";
-int startHour = 7; //am
-int endHour = 16; //3:59pm
+int startHour = 8; //am
+int endHour = 15; //3pm
int endMinute = 25;
boolean production = true;
@@ -63,21 +63,14 @@ public void setup() {
fill(255, 50, 50);
noFill();
String[] cameras = Capture.list();
- if (version == "2.0") {
- cam = new Capture(this, 1280, 960, "Logitech Camera");
- }
- else {
+
// cam = new Capture(this, 2592,1944);
//Logitech 910c
//cam = new Capture(this, 1280, 960);
//Microsoft Studio
cam = new Capture(this, 1920, 1080);
// cam = new Capture(this, 1280, 720);
- }
-
- if (version == "2.0") {
- // cam.start();
- }
+cam.settings();
//set global framerate
int f = 25;
frameRate(f);
@@ -103,6 +96,7 @@ public void setup() {
void draw() {
background(0);
blast = false;
+ // println("hour(): "+hour());
if (hour()>=startHour) {
if (hour()<endHour) {
if (cam.available()) {
@@ -166,11 +160,11 @@ void draw() {
text("xFlowSum: "+of.xFlowSum, width - 150, height - 5); // time (msec) for this frame
}
+ grab = false;
if (blast) {
//BLAST OFF!
boolean hit = false;
- grab = false;
//update the reference image on the sensors
motionSensor._image = grabImage;
Oops, something went wrong.

0 comments on commit 60f725c

Please sign in to comment.