<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,12 +1,12 @@
-require 'osc'
-#module OSC
-#  class UDPSocket
-#    def initialize
-#    end
-#    def connect(a,b)
-#    end
-#  end
-#end
+#require 'osc'
+module OSC
+  class UDPSocket
+    def initialize
+    end
+    def connect(a,b)
+    end
+  end
+end
 
 helpers do
   class LC 
@@ -30,52 +30,46 @@ helpers do
     attr_writer :rgb
 
     def initialize(socket, opts=nil)
-      @sock = socket 
-      @colour = opts[:colour] if opts.is_a?(Hash) &amp;&amp; opts.has_key?(:colour)
-      @light = opts[:light].to_i if opts.is_a?(Hash) &amp;&amp; opts.has_key?(:light)
+      @sock     = socket 
+      @rgb      = opts[:rgb]
       @channels = opts[:channels] if opts.is_a?(Hash) &amp;&amp; opts.has_key?(:channels)
-      @rgb = opts[:rgb]
+      @colour   = opts[:colour] if opts.is_a?(Hash) &amp;&amp; opts.has_key?(:colour)
+      @light    = opts[:light].to_i if opts.is_a?(Hash) &amp;&amp; opts.has_key?(:light)
     end
     
     def display
       count = 0
-      colour_channel_hash.each do |c|
-        @sock.send OSC::Message.new(&quot;/dmx/#{@channels[@light][count]}/set&quot;, 'f', c), 0
+      channel_data_from_rgb(color_as_rgb).each do |c|
+        #@sock.send OSC::Message.new(&quot;/dmx/#{@channels[@light][count]}/set&quot;, 'f', c), 0
         count = count + 1
       end
       self.to_s
     end 
 
     def to_s
-      &quot;Setting the color to &lt;em style='#{self.to_css}font-weight:bold;'&gt;#{@colour}&lt;/em&gt; for light &lt;em&gt;#{@light}&lt;/em&gt;\n&quot;
+      &quot;Light #{@light} : rgb(#{self.to_css})\n&quot;
     end
 
     def to_css
-      # color: rgb(51, 51, 51);
-      if @rgb.has_key?(@colour.to_sym)
-        &quot;color:rgb(#{@rgb[@colour.to_sym].join(',')});&quot; 
-      else
-        c = @colour.gsub('rgb','').gsub('-',',')
-        &quot;color:rgb(#{c});&quot; 
-      end
+      color_as_rgb.join(',') 
     end
 
     private
 
-    def colour_channel_hash
-      return [] unless @rgb
+    def color_as_rgb 
+      return [0,0,0] if @colour == 'off' 
+      return [(rand * 255).to_i,(rand * 255).to_i,(rand * 255).to_i] if @colour == 'random' 
 
       if @rgb.has_key?(@colour.to_sym)
-        c = @rgb[@colour.to_sym] 
+        return @rgb[@colour.to_sym] 
       else
-        c = @colour.gsub('rgb','').split('-')
+        return @colour.gsub('rgb','').split('-')
       end
+    end
 
+    def channel_data_from_rgb(d)
       data = []
-      (1..3).each do |i|
-        data &lt;&lt; '%.1f' % ((c[i-1].to_f/255.0 * 100.0).to_f / 100)
-      end
-
+      (1..3).each {|i| data &lt;&lt; '%.1f' % ((d[i-1].to_f/255.0 * 100.0).to_f / 100) }
       data
     end
 
@@ -100,8 +94,8 @@ get %r{/(1|2|all)+/(rgb\d{0,3}-\d{0,3}-\d{0,3}|red|blue|green|random|off)+$} do
   lights = [params['captures'].first]
   lights = @lights if lights.include?('all')
   colour = params['captures'][1]
-  colour = 'rgb0-0-0' if colour == 'off'
   halt 404, 'Oh dear! I understand what you\'re saying' unless lights &amp;&amp; colour 
+  content_type 'text/plain', :charset =&gt; 'utf-8'
   LC.set_lights(
     :lights =&gt; lights,
     :colour =&gt; colour,</diff>
      <filename>app.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,18 +3,18 @@
 &lt;head profile=&quot;http://gmpg.org/xfn/11&quot;&gt;
 &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
 &lt;head&gt;
-&lt;title&gt;7th floor Henry Wood House spotlights controller&lt;/title&gt;
+&lt;title&gt;7th floor HWH spotlights controller&lt;/title&gt;
 &lt;/head&gt;
 &lt;body&gt;
 &lt;h1&gt;HWH 7th floor spotlight proxy&lt;/h1&gt;
-&lt;p&gt;This makes playing with the spotlights a sych. Hopefully the urls give a clue.&lt;/p&gt;
+&lt;p&gt;Makes playing with the spotlights a sych. The urls are all you need.&lt;/p&gt;
 &lt;ul&gt;
-&lt;li&gt;&lt;code&gt;&lt;a href=&quot;http://lights.local/all/red&quot;&gt;http://lights.local/all/red&lt;/a&gt;&lt;/code&gt;&lt;/li&gt;
-&lt;li&gt;&lt;code&gt;&lt;a href=&quot;http://lights.local/all/green&quot;&gt;http://lights.local/all/green&lt;/a&gt;&lt;/code&gt;&lt;/li&gt;
-&lt;li&gt;&lt;code&gt;&lt;a href=&quot;http://lights.local/all/blue&quot;&gt;http://lights.local/all/blue&lt;/a&gt;&lt;/code&gt;&lt;/li&gt;
-&lt;li&gt;&lt;code&gt;&lt;a href=&quot;http://lights.local/1/red&quot;&gt;http://lights.local/1/red&lt;/a&gt;&lt;/code&gt;&lt;/li&gt;
-&lt;li&gt;&lt;code&gt;&lt;a href=&quot;http://lights.local/2/blue&quot;&gt;http://lights.local/2/blue&lt;/a&gt;&lt;/code&gt;&lt;/li&gt;
-&lt;li&gt;&lt;code&gt;&lt;a href=&quot;http://lights.local/all/off&quot;&gt;http://lights.local/all/off&lt;/a&gt;&lt;/code&gt;&lt;/li&gt;
+&lt;li&gt;&lt;code&gt;&lt;a href=&quot;http://lights.local/all/red&quot;&gt;http://lights.local/all/(red|green|blue)&lt;/a&gt;&lt;/code&gt;&lt;/li&gt;
+&lt;li&gt;&lt;code&gt;&lt;a href=&quot;http://lights.local/1/red&quot;&gt;http://lights.local/(all|1|2)/red&lt;/a&gt;&lt;/code&gt;&lt;/li&gt;
+&lt;li&gt;&lt;code&gt;&lt;a href=&quot;http://lights.local/all/off&quot;&gt;http://lights.local/(all|1|2)/off&lt;/a&gt;&lt;/code&gt;&lt;/li&gt;
+&lt;li&gt;&lt;code&gt;&lt;a href=&quot;http://lights.local/all/random&quot;&gt;http://lights.local/(all|1|2)/random&lt;/a&gt;&lt;/code&gt;&lt;/li&gt;
 &lt;/ul&gt;
+&lt;p&gt;Simple huh?&lt;/p&gt;
+&lt;em&gt;BEWARE: the lights will just queue if everyones trys at the same time&lt;/em&gt;
 &lt;/body&gt;
 &lt;/html&gt;</diff>
      <filename>views/index.erb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>aecbb137e8bf8954a73bdd9349775aa9321c060d</id>
    </parent>
  </parents>
  <author>
    <name>Duncan Robertson</name>
    <email>duncan@whomwah.com</email>
  </author>
  <url>http://github.com/whomwah/light-controller/commit/e40d770712e6d60c924d816ff67109a9bca831d2</url>
  <id>e40d770712e6d60c924d816ff67109a9bca831d2</id>
  <committed-date>2009-04-23T14:12:07-07:00</committed-date>
  <authored-date>2009-04-23T14:12:07-07:00</authored-date>
  <message>all the urls work just fine now</message>
  <tree>b54420df989812b5ffa0b7cb1896c56406d4c226</tree>
  <committer>
    <name>Duncan Robertson</name>
    <email>duncan@whomwah.com</email>
  </committer>
</commit>
