grandstream_camera 0.0.1 → 0.0.2
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 +4 -4
- data/README.md +13 -2
- data/bin/gs_camera +59 -0
- data/lib/grandstream/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c811fe73092517e9c001df438d2799a08db56ca1
|
4
|
+
data.tar.gz: 6444734474203cc82ad30c3d29906284822860c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d262c8f06f30d698f10b19d9f7a8ca28bbd9e5e9ce8e21b7e7896e2008f993be191ebec64e683c5c2251325a7b30f93297247fba9ee6180564b6407ffbd67db
|
7
|
+
data.tar.gz: b20feed1a80409e4ea55de1242edfc941a80881ce3691d1ac20f926762f19d20fe77d7f9e81ffc9df3965bce04f11c6fd9b435e6f26730a9e92642bd78e5764d
|
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Grandstream
|
2
2
|
|
3
|
-
|
3
|
+
This gem provides an interface for interacting with Grandsteam IP Cameras.
|
4
|
+
|
5
|
+
For more information see http://www.grandstream.com/index.php/products/ip-video-surveillance
|
6
|
+
|
7
|
+
For API information view the Grandstream API documentation at http://www.grandstream.com/products/surveillance/general/documents/grandstream_http_api.pdf
|
4
8
|
|
5
9
|
## Installation
|
6
10
|
|
@@ -21,7 +25,14 @@ Or install it yourself as:
|
|
21
25
|
client = Grandstream::Client.new("10.0.1.4")
|
22
26
|
options = client.load_options("audio_video") # returns a hash of options
|
23
27
|
client.set_options "audio_video", { "primary.video.framerate": 30 }
|
24
|
-
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
## Command Line Utility
|
32
|
+
|
33
|
+
A command line utility is also provided in the gem which can take snapshots from the camera.
|
34
|
+
|
35
|
+
gs_camera snapshot --ip 10.0.1.4 --outfile image.jpg
|
25
36
|
|
26
37
|
## Contributing
|
27
38
|
|
data/bin/gs_camera
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "grandstream"
|
3
|
+
require "pathname"
|
4
|
+
require "optparse"
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
class CommandProcessor
|
9
|
+
attr_accessor :options
|
10
|
+
def initialize(options)
|
11
|
+
@options = options
|
12
|
+
end
|
13
|
+
|
14
|
+
def snapshot
|
15
|
+
abort("No Camera IP given") unless options[:ip]
|
16
|
+
abort("No output file given") unless options[:out_file]
|
17
|
+
client = Grandstream::Client.new(options[:ip])
|
18
|
+
client.get_snapshot(options[:out_file])
|
19
|
+
puts "Snapshot downloaded."
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def header
|
25
|
+
"\nGrandstream IP Camera Utility (#{Grandstream::VERSION})\n\n"
|
26
|
+
end
|
27
|
+
|
28
|
+
def executable_name
|
29
|
+
Pathname.new(__FILE__).basename
|
30
|
+
end
|
31
|
+
|
32
|
+
def short_help
|
33
|
+
"#{executable_name} <command> <options>\nFor more help use #{executable_name} help.\n\n"
|
34
|
+
end
|
35
|
+
|
36
|
+
command = ARGV.shift
|
37
|
+
|
38
|
+
options = {}
|
39
|
+
parser = OptionParser.new do |opts|
|
40
|
+
opts.banner = "#{header}Usage: #{executable_name} command [options]"
|
41
|
+
opts.on('--outfile NAME', String, 'Output filename') { |v| options[:out_file] = v }
|
42
|
+
opts.on('-h', '--help', 'Displays help') { puts opts }
|
43
|
+
opts.on('--ip IP_ADDRESS', String, 'Set the IP address for the camera') { |v| options[:ip] = v}
|
44
|
+
end
|
45
|
+
parser.parse!
|
46
|
+
|
47
|
+
processor = CommandProcessor.new(options)
|
48
|
+
|
49
|
+
abort(parser.to_s) unless command
|
50
|
+
|
51
|
+
if processor.respond_to?(command)
|
52
|
+
processor.send(command.to_sym)
|
53
|
+
else
|
54
|
+
puts parser
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
puts ""
|
data/lib/grandstream/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grandstream_camera
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Bellus
|
@@ -56,7 +56,8 @@ description: Grandstream IP camera HTTP api for setting and retrieving camera op
|
|
56
56
|
and performing various tasks.
|
57
57
|
email:
|
58
58
|
- joe@5sigma.io
|
59
|
-
executables:
|
59
|
+
executables:
|
60
|
+
- gs_camera
|
60
61
|
extensions: []
|
61
62
|
extra_rdoc_files: []
|
62
63
|
files:
|
@@ -65,6 +66,7 @@ files:
|
|
65
66
|
- LICENSE.txt
|
66
67
|
- README.md
|
67
68
|
- Rakefile
|
69
|
+
- bin/gs_camera
|
68
70
|
- grandstream.gemspec
|
69
71
|
- lib/grandstream.rb
|
70
72
|
- lib/grandstream/client.rb
|