Commit 95bc6477 authored by Hugo's avatar Hugo
Browse files

Add support for new camera interface

parent fc4ca805
......@@ -412,12 +412,22 @@ class SourceType < ActiveRecord::Base
end
class CameraInterface < ActiveRecord::Base
end
class Camera < ActiveRecord::Base
has_one :counter, :as => :source
has_one :camera_interface
def http_get_data(date)
query = "/local/people-counter/.api?export-csv&date=#{date.strftime('%Y%m%d')}&res=15m"
# TODO: this is just a quick-fix, elegantize code
if camera_interface.name == 'local'
query = "/local/people-counter/.api?export-csv&date=#{date.strftime('%Y%m%d')}&res=15m"
else
query = "/stereo/people-counter/export.json?resolution=15minute&date=#{date.strftime('%Y%m%d')}&method=download"
end
url = URI.parse(address + query)
http = Net::HTTP.new(url.host, url.port)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment