Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
digibib
counterstat
Commits
95bc6477
Commit
95bc6477
authored
May 23, 2018
by
Hugo
Browse files
Add support for new camera interface
parent
fc4ca805
Changes
1
Hide whitespace changes
Inline
Side-by-side
models/countermodels.rb
View file @
95bc6477
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment