ipcam 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +56 -0
- data/COPYRIGHT.md +99 -0
- data/Gemfile +2 -0
- data/LICENSE +21 -0
- data/README.md +59 -0
- data/Rakefile +2 -0
- data/bin/ipcam +129 -0
- data/ipcam.gemspec +50 -0
- data/lib/ipcam/main.rb +344 -0
- data/lib/ipcam/version.rb +3 -0
- data/lib/ipcam/webserver.rb +178 -0
- data/lib/ipcam/websock.rb +380 -0
- data/resource/common/js/msgpack-rpc.js +191 -0
- data/resource/common/js/util.js +135 -0
- data/resource/extern/css/bootstrap.min.css +7 -0
- data/resource/extern/css/ion.rangeSlider.min.css +1 -0
- data/resource/extern/css/pretty-checkbox.min.css +12 -0
- data/resource/extern/js/bootstrap.min.js +7 -0
- data/resource/extern/js/ion.rangeSlider.min.js +2 -0
- data/resource/extern/js/jquery-3.4.1.min.js +2 -0
- data/resource/extern/js/jquery.nicescroll.min.js +2 -0
- data/resource/extern/js/msgpack.min.js +2 -0
- data/resource/extern/js/popper.min.js +5 -0
- data/resource/ipcam/js/main.js +486 -0
- data/resource/ipcam/js/session.js +61 -0
- data/resource/ipcam/scss/main/style.scss +91 -0
- data/resource/ipcam/views/main.erb +68 -0
- data/resource/ipcam/views/settings.erb +19 -0
- data/run.sh +3 -0
- metadata +228 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 22776da9c02a7fd1ae5c228c5b481e224813c34c3ef4aee7d97012a591ac9ee2
|
4
|
+
data.tar.gz: 8db5e894b95bb15d9b96b9cce0f8253b2bbefe351657b39b54a483b94c240465
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 89984e612237d5da9e3da485a193aa51c3c085f4bfa7ec4a3576f5ce1a4938f80fe6b8137b5f12d9ffb0c62d18864b9d8afbc8f70db246cb4c20fbec1f9eae6f
|
7
|
+
data.tar.gz: 795bcceaad793ac33551e575e35f826cd12572a18139e533e521fd446cd8ff519127d5ef7ab19155a7c37c4556fe58c75e817859e80cfb071cebc6fe77684c75
|
data/.gitignore
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
# Gemfile.lock
|
46
|
+
# .ruby-version
|
47
|
+
# .ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
51
|
+
|
52
|
+
# private files
|
53
|
+
.rbenv-gemsets
|
54
|
+
.ruby-version
|
55
|
+
Gemfile.lock
|
56
|
+
/tmp
|
data/COPYRIGHT.md
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
## Ruby-gems
|
2
|
+
### puma
|
3
|
+
```
|
4
|
+
Some code copyright (c) 2005, Zed Shaw
|
5
|
+
Copyright (c) 2011, Evan Phoenix
|
6
|
+
All rights reserved.
|
7
|
+
```
|
8
|
+
|
9
|
+
https://raw.githubusercontent.com/puma/puma/master/LICENSE
|
10
|
+
|
11
|
+
### sinatra
|
12
|
+
```
|
13
|
+
Copyright (c) 2007, 2008, 2009 Blake Mizerany
|
14
|
+
Copyright (c) 2010-2017 Konstantin Haase
|
15
|
+
Copyright (c) 2015-2017 Zachary Scott
|
16
|
+
```
|
17
|
+
|
18
|
+
https://raw.githubusercontent.com/sinatra/sinatra/master/LICENSE
|
19
|
+
|
20
|
+
### sinatra-contrib
|
21
|
+
```
|
22
|
+
Copyright (c) 2008-2017 Nicolas Sanguinetti, entp.com, Konstantin Haase
|
23
|
+
Copyright (c) 2015-2017 Zachary Scott
|
24
|
+
```
|
25
|
+
|
26
|
+
https://raw.githubusercontent.com/sinatra/sinatra/master/sinatra-contrib/LICENSE
|
27
|
+
|
28
|
+
### sassc
|
29
|
+
```
|
30
|
+
Copyright (c) Ryan Boland & Contributors
|
31
|
+
```
|
32
|
+
|
33
|
+
https://raw.githubusercontent.com/sass/sassc-ruby/master/LICENSE.txt
|
34
|
+
|
35
|
+
### eventmachine
|
36
|
+
```
|
37
|
+
Copyright: (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
38
|
+
```
|
39
|
+
|
40
|
+
https://raw.githubusercontent.com/eventmachine/eventmachine/master/LICENSE
|
41
|
+
|
42
|
+
### em-websocket
|
43
|
+
```
|
44
|
+
Copyright (c) 2009-2014 Ilya Grigorik, Martyn Loughra
|
45
|
+
```
|
46
|
+
|
47
|
+
https://raw.githubusercontent.com/igrigorik/em-websocket/master/LICENCE
|
48
|
+
|
49
|
+
### msgpack
|
50
|
+
```
|
51
|
+
Copyright © 2008-2015 Sadayuki Furuhashi
|
52
|
+
```
|
53
|
+
|
54
|
+
https://raw.githubusercontent.com/msgpack/msgpack-ruby/master/LICENSE
|
55
|
+
|
56
|
+
## JavaScript
|
57
|
+
### jQuery
|
58
|
+
```
|
59
|
+
(c) JS Foundation and other contributors
|
60
|
+
```
|
61
|
+
|
62
|
+
https://raw.githubusercontent.com/jquery/jquery/master/LICENSE.txt
|
63
|
+
|
64
|
+
### bootstrao
|
65
|
+
```
|
66
|
+
Copyright (c) 2011-2019 Twitter, Inc.
|
67
|
+
Copyright (c) 2011-2019 The Bootstrap Authors
|
68
|
+
```
|
69
|
+
|
70
|
+
https://raw.githubusercontent.com/twbs/bootstrap/master/LICENSE
|
71
|
+
|
72
|
+
### Popper.js
|
73
|
+
```
|
74
|
+
Copyright © 2016 Federico Zivolo and contributors
|
75
|
+
```
|
76
|
+
|
77
|
+
https://raw.githubusercontent.com/FezVrasta/popper.js/master/LICENSE.md
|
78
|
+
|
79
|
+
### ion.RangeSlider
|
80
|
+
```
|
81
|
+
Copyright © 2018 by Denis Ineshin (http://ionden.com)
|
82
|
+
```
|
83
|
+
|
84
|
+
https://raw.githubusercontent.com/IonDen/ion.rangeSlider/master/License.md
|
85
|
+
|
86
|
+
### niceScroll
|
87
|
+
```
|
88
|
+
Copyright (c) 2011-17 InuYaksa
|
89
|
+
```
|
90
|
+
|
91
|
+
https://raw.githubusercontent.com/inuyaksa/jquery.nicescroll/master/MIT.LICENSE
|
92
|
+
|
93
|
+
### msgpack-lite
|
94
|
+
```
|
95
|
+
Copyright (c) 2015 Yusuke Kawasaki
|
96
|
+
```
|
97
|
+
|
98
|
+
https://raw.githubusercontent.com/kawanet/msgpack-lite/master/LICENSE
|
99
|
+
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2019 Hiroshi Kuwagata
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# ipcam
|
2
|
+
Sample application for "V4L2 for Ruby".
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
|
6
|
+
Add this line to your application's Gemfile:
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
gem 'ipcam'
|
10
|
+
```
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install ipcam
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
```
|
22
|
+
ipcam [options] [device-file]
|
23
|
+
options:
|
24
|
+
--bind=ADDR
|
25
|
+
--port=PORT
|
26
|
+
-d, --database-file=FILE
|
27
|
+
--log-file=FILE
|
28
|
+
--log-age=AGE
|
29
|
+
--log-size=SIZE
|
30
|
+
--log-level=LEVEL
|
31
|
+
--develop-mode
|
32
|
+
```
|
33
|
+
|
34
|
+
### options
|
35
|
+
<dl>
|
36
|
+
<dt>--bind=ADDR</dt>
|
37
|
+
<dd>Specify the address to which the HTTP server binds. by default, IPv6 any address("::") is used.</dd>
|
38
|
+
|
39
|
+
<dt>--port=PORT</dt>
|
40
|
+
<dd>Specify the port number to which the HTTP server binds. by default 4567 is used.</dd>
|
41
|
+
|
42
|
+
<dt>-d, --database-file=FILE</dt>
|
43
|
+
<dd>Specify the file name to save the camera setting value. by default, it tries to save to "~/.ipcam.db".</dd>
|
44
|
+
|
45
|
+
<dt>--log-file=FILE</dt>
|
46
|
+
<dd></dd>
|
47
|
+
|
48
|
+
<dt>--log-age=AGE</dt>
|
49
|
+
<dd></dd>
|
50
|
+
|
51
|
+
<dt>--log-level=LEVEL</dt>
|
52
|
+
<dd></dd>
|
53
|
+
</dl>
|
54
|
+
|
55
|
+
### device-file
|
56
|
+
specify target device file (ex: /dev/video1). if omittedm, it will use "/dev/video0".
|
57
|
+
|
58
|
+
## License
|
59
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/ipcam
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
#
|
5
|
+
# Sample for v4l2-ruby
|
6
|
+
#
|
7
|
+
# Copyright (C) 2019 Hiroshi Kuwagata <kgt9221@gmail.com>
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'pathname'
|
11
|
+
require 'optparse'
|
12
|
+
require 'logger'
|
13
|
+
|
14
|
+
Thread.abort_on_exception = true
|
15
|
+
|
16
|
+
Signal.trap(:INT) {IPCam.stop}
|
17
|
+
Signal.trap(:TERM) {IPCam.stop}
|
18
|
+
|
19
|
+
#
|
20
|
+
# アプリ全体で参照する定数の定義
|
21
|
+
#
|
22
|
+
TRADITIONAL_NAME = "IP camera"
|
23
|
+
APP_NAME = "ipcam"
|
24
|
+
|
25
|
+
BASE_DIR = Pathname.new(File.expand_path(__FILE__)).dirname.parent
|
26
|
+
LIB_DIR = BASE_DIR + "lib"
|
27
|
+
RESOURCE_DIR = BASE_DIR + "resource"
|
28
|
+
APP_LIB_DIR = LIB_DIR + APP_NAME
|
29
|
+
APP_RESOURCE_DIR = RESOURCE_DIR + APP_NAME
|
30
|
+
|
31
|
+
#
|
32
|
+
# バージョン定数の読み込み
|
33
|
+
#
|
34
|
+
require "#{APP_LIB_DIR + "version"}"
|
35
|
+
|
36
|
+
#
|
37
|
+
# コマンドラインオプションの評価
|
38
|
+
#
|
39
|
+
OptionParser.new { |opt|
|
40
|
+
log = {
|
41
|
+
:device => nil,
|
42
|
+
:shift_age => 10,
|
43
|
+
:shift_size => 1024 * 1024,
|
44
|
+
:level => :INFO
|
45
|
+
}
|
46
|
+
|
47
|
+
opt.version = IPCam::VERSION
|
48
|
+
opt.banner += " [DEVICE-FILE]"
|
49
|
+
|
50
|
+
opt.on('--bind=ADDR') { |val|
|
51
|
+
$bind_addr = val
|
52
|
+
}
|
53
|
+
|
54
|
+
opt.on('--port=PORT', Integer) { |val|
|
55
|
+
$bind_port = val
|
56
|
+
$ws_port = val + 1
|
57
|
+
}
|
58
|
+
|
59
|
+
opt.on('-d', '--database-file=FILE') { |val|
|
60
|
+
$db_file = Pathname.new(val)
|
61
|
+
}
|
62
|
+
|
63
|
+
opt.on('--log-file=FILE') { |val|
|
64
|
+
log[:device] = val
|
65
|
+
}
|
66
|
+
|
67
|
+
opt.on('--log-age=AGE') { |val|
|
68
|
+
case val.downcase
|
69
|
+
when /^\d+$/
|
70
|
+
log[:shift_age] = val.to_i
|
71
|
+
|
72
|
+
when /^(dayly|weekly|monthly)$/
|
73
|
+
log[:shift_age] = val
|
74
|
+
|
75
|
+
else
|
76
|
+
raise("Invalid log age spec '#{val}'.")
|
77
|
+
end
|
78
|
+
}
|
79
|
+
|
80
|
+
opt.on('--log-size=SIZE', Integer) { |val|
|
81
|
+
log[:shift_size] = val
|
82
|
+
}
|
83
|
+
|
84
|
+
opt.on('--log-level=LEVEL') { |val|
|
85
|
+
log[:level] = val.upcase.to_sym
|
86
|
+
}
|
87
|
+
|
88
|
+
opt.on('--develop-mode') {
|
89
|
+
$develop_mode = true
|
90
|
+
}
|
91
|
+
|
92
|
+
opt.order!(ARGV)
|
93
|
+
|
94
|
+
|
95
|
+
if log[:device]
|
96
|
+
$log_device = File.open(log[:device], "a")
|
97
|
+
$log_device.sync = true
|
98
|
+
else
|
99
|
+
$log_device = STDOUT
|
100
|
+
end
|
101
|
+
|
102
|
+
$logger = Logger.new($log_device,
|
103
|
+
log[:shift_age],
|
104
|
+
log[:shift_size],
|
105
|
+
:level => log[:level],
|
106
|
+
:datetime_format => "%Y-%m-%dT%H:%M:%S")
|
107
|
+
|
108
|
+
$bind_addr ||= "::"
|
109
|
+
$http_port ||= 4567
|
110
|
+
$ws_port ||= 4568
|
111
|
+
$db_file ||= Pathname.new(ENV['HOME']) + ".#{APP_NAME}.db"
|
112
|
+
$target = ARGV[0] || "/dev/video0"
|
113
|
+
|
114
|
+
if $db_file.exist? and (not $db_file.writable?)
|
115
|
+
raise("#{$db_file.to_s} is not writable")
|
116
|
+
end
|
117
|
+
}
|
118
|
+
|
119
|
+
#
|
120
|
+
# アプリケーション本体の読み込み
|
121
|
+
#
|
122
|
+
require "#{APP_LIB_DIR + "main"}"
|
123
|
+
require "#{APP_LIB_DIR + "webserver"}"
|
124
|
+
require "#{APP_LIB_DIR + "websock"}"
|
125
|
+
|
126
|
+
#
|
127
|
+
# アプリケーションの起動
|
128
|
+
#
|
129
|
+
IPCam.start
|
data/ipcam.gemspec
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "ipcam/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "ipcam"
|
8
|
+
spec.version = IPCam::VERSION
|
9
|
+
spec.authors = ["Hirosho Kuwagata"]
|
10
|
+
spec.email = ["kgt9221@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{spectrum analyzer for wav file.}
|
13
|
+
spec.description = %q{spectrum analyzer for wav file.}
|
14
|
+
spec.homepage = "https://github.com/kwgt/ipcam"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
if spec.respond_to?(:metadata)
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
19
|
+
else
|
20
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
21
|
+
"public gem pushes."
|
22
|
+
end
|
23
|
+
|
24
|
+
# Specify which files should be added to the gem when it is released.
|
25
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been
|
26
|
+
# added into git.
|
27
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
28
|
+
`git ls-files -z`.split("\x0").reject { |f|
|
29
|
+
f.match(%r{^(test|spec|features|run\.sh)/})
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
spec.bindir = "bin"
|
34
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
35
|
+
spec.require_paths = ["none"]
|
36
|
+
|
37
|
+
spec.required_ruby_version = ">= 2.4.0"
|
38
|
+
|
39
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
40
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
41
|
+
spec.add_dependency "v4l2-ruby", "~> 0.9.2"
|
42
|
+
spec.add_dependency "puma", "~> 3.12.1"
|
43
|
+
spec.add_dependency "sinatra", "~> 2.0.5"
|
44
|
+
spec.add_dependency "sinatra-contrib", "~> 2.0.5"
|
45
|
+
spec.add_dependency "sassc", "~> 2.0.1"
|
46
|
+
spec.add_dependency "eventmachine", "~> 1.2.7"
|
47
|
+
spec.add_dependency "em-websocket", "~> 0.5.1"
|
48
|
+
spec.add_dependency "msgpack", "~> 1.2.6"
|
49
|
+
spec.add_dependency "msgpack-rpc-stack", "~> 0.6.3"
|
50
|
+
end
|