eufycam 0.1.0 → 0.2.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 +4 -4
- data/.github/workflows/default.yml +145 -0
- data/.gitignore +3 -0
- data/.rubocop.yml +26 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +96 -0
- data/Guardfile +15 -0
- data/Rakefile +6 -4
- data/bin/setup +1 -2
- data/eufycam.gemspec +23 -15
- data/exe/eufycam +7 -0
- data/lib/eufycam/cli.rb +65 -0
- data/lib/eufycam/client.rb +74 -0
- data/lib/eufycam/ffmpeg.rb +9 -0
- data/lib/eufycam/version.rb +3 -1
- data/lib/eufycam.rb +5 -3
- data/lib/tasks/build.rake +8 -0
- data/lib/tasks/console.rake +9 -0
- data/lib/tasks/release.rake +18 -0
- data/lib/tasks/version.rake +8 -0
- metadata +102 -7
- data/.travis.yml +0 -7
- data/bin/console +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbaf48c3ec5e53fad83aeaf98636cd219ce9900781226746a9a2c11f35f16ab5
|
4
|
+
data.tar.gz: cd31ae3d91343c9fc8e9170a86b54dabfca22cd8ab4547d31dd5836ec2b3ab5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7a6129b2246f03972acced9cd26800495f7693c92bb1b68c67b4b1b4142e95578d2fc46e849d2df0fb0b332a95afd44ac03318f0c3c7ab8402eeb4b84fb0dcd
|
7
|
+
data.tar.gz: 8a555aaa9371447a19c99ce0617b26927fe7ecf97052269592281c76cbc6bdec21a0fed2980bd8cd10720ac5426255e9d61bfffeb5a517c22cf1b2aea8504568
|
@@ -0,0 +1,145 @@
|
|
1
|
+
name: Default
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
name: Build
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v2
|
13
|
+
- name: Set up Ruby 2.6
|
14
|
+
uses: actions/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: 2.6.x
|
17
|
+
- uses: actions/cache@v1
|
18
|
+
with:
|
19
|
+
path: vendor/bundle
|
20
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
21
|
+
restore-keys: ${{ runner.os }}-gems-
|
22
|
+
- name: Install Bundler
|
23
|
+
run: gem install bundler
|
24
|
+
- name: Configure Bundler
|
25
|
+
run: bundle config path vendor/bundle
|
26
|
+
- name: Bundle Install
|
27
|
+
run: bundle install --jobs 4 --retry 3
|
28
|
+
- name: Set EUFYCAM_VERSION
|
29
|
+
run: echo ::set-env name=EUFYCAM_VERSION::$(bundle exec rake version)
|
30
|
+
- name: Build
|
31
|
+
run: bundle exec rake build
|
32
|
+
- name: Upload Gem
|
33
|
+
uses: actions/upload-artifact@v1
|
34
|
+
with:
|
35
|
+
name: eufycam-${{ env.EUFYCAM_VERSION }}.gem
|
36
|
+
path: eufycam-${{ env.EUFYCAM_VERSION }}.gem
|
37
|
+
|
38
|
+
lint:
|
39
|
+
name: Lint
|
40
|
+
runs-on: ubuntu-latest
|
41
|
+
needs: [build]
|
42
|
+
|
43
|
+
steps:
|
44
|
+
- uses: actions/checkout@v2
|
45
|
+
- name: Set up Ruby 2.6
|
46
|
+
uses: actions/setup-ruby@v1
|
47
|
+
with:
|
48
|
+
ruby-version: 2.6.x
|
49
|
+
- uses: actions/cache@v1
|
50
|
+
with:
|
51
|
+
path: vendor/bundle
|
52
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
53
|
+
restore-keys: ${{ runner.os }}-gems-
|
54
|
+
- name: Install Bundler
|
55
|
+
run: gem install bundler
|
56
|
+
- name: Configure Bundler
|
57
|
+
run: bundle config path vendor/bundle
|
58
|
+
- name: Bundle Install
|
59
|
+
run: bundle install --jobs 4 --retry 3
|
60
|
+
- name: Run Rubocop
|
61
|
+
run: bundle exec rubocop
|
62
|
+
|
63
|
+
test:
|
64
|
+
name: Test
|
65
|
+
runs-on: ubuntu-latest
|
66
|
+
needs: [build]
|
67
|
+
|
68
|
+
steps:
|
69
|
+
- uses: actions/checkout@v2
|
70
|
+
- name: Set up Ruby 2.6
|
71
|
+
uses: actions/setup-ruby@v1
|
72
|
+
with:
|
73
|
+
ruby-version: 2.6.x
|
74
|
+
- uses: actions/cache@v1
|
75
|
+
with:
|
76
|
+
path: vendor/bundle
|
77
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
78
|
+
restore-keys: ${{ runner.os }}-gems-
|
79
|
+
- name: Install Bundler
|
80
|
+
run: gem install bundler
|
81
|
+
- name: Configure Bundler
|
82
|
+
run: bundle config path vendor/bundle
|
83
|
+
- name: Bundle Install
|
84
|
+
run: bundle install --jobs 4 --retry 3
|
85
|
+
- name: Run RSpec
|
86
|
+
run: bundle exec rake spec
|
87
|
+
|
88
|
+
release:
|
89
|
+
name: Release
|
90
|
+
runs-on: ubuntu-latest
|
91
|
+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
92
|
+
needs: [test, lint]
|
93
|
+
|
94
|
+
steps:
|
95
|
+
- uses: actions/checkout@v2
|
96
|
+
- name: Set up Ruby 2.6
|
97
|
+
uses: actions/setup-ruby@v1
|
98
|
+
with:
|
99
|
+
ruby-version: 2.6.x
|
100
|
+
- name: Install Bundler
|
101
|
+
run: gem install bundler
|
102
|
+
- name: Configure Bundler
|
103
|
+
run: bundle config path vendor/bundle
|
104
|
+
|
105
|
+
- name: Configure Gem
|
106
|
+
run: |
|
107
|
+
mkdir -p $HOME/.gem
|
108
|
+
touch $HOME/.gem/credentials
|
109
|
+
chmod 0600 $HOME/.gem/credentials
|
110
|
+
printf -- "---\n:rubygems_api_key: ${{secrets.RUBYGEMS_API_KEY}}\n:github: Bearer ${{secrets.PERSONAL_ACCESS_TOKEN}}" > $HOME/.gem/credentials
|
111
|
+
|
112
|
+
- name: Bundle
|
113
|
+
run: bundle install --jobs 4 --retry 3
|
114
|
+
- name: Set EUFYCAM_VERSION
|
115
|
+
run: echo ::set-env name=EUFYCAM_VERSION::$(bundle exec rake version)
|
116
|
+
- uses: actions/download-artifact@v1
|
117
|
+
with:
|
118
|
+
name: eufycam-${{ env.EUFYCAM_VERSION }}.gem
|
119
|
+
path: /tmp
|
120
|
+
- run: ls /tmp
|
121
|
+
- run: mv /tmp/eufycam-${{ env.EUFYCAM_VERSION }}.gem .
|
122
|
+
- name: Push Gem to Rubygems
|
123
|
+
run: bundle exec rake release[rubygems]
|
124
|
+
- name: Push Gem to Github Package Registry
|
125
|
+
run: bundle exec rake release[github]
|
126
|
+
- name: Create Release
|
127
|
+
id: create_release
|
128
|
+
uses: actions/create-release@latest
|
129
|
+
env:
|
130
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
131
|
+
with:
|
132
|
+
tag_name: ${{ github.ref }}
|
133
|
+
release_name: ${{ github.ref }}
|
134
|
+
draft: false
|
135
|
+
prerelease: false
|
136
|
+
|
137
|
+
- name: Upload Release Asset
|
138
|
+
uses: actions/upload-release-asset@v1
|
139
|
+
env:
|
140
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
141
|
+
with:
|
142
|
+
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
143
|
+
asset_path: eufycam-${{ env.EUFYCAM_VERSION }}.gem
|
144
|
+
asset_name: eufycam-${{ env.EUFYCAM_VERSION }}.gem
|
145
|
+
asset_content_type: application/binary
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# The behavior of RuboCop can be controlled via the .rubocop.yml
|
2
|
+
# configuration file. It makes it possible to enable/disable
|
3
|
+
# certain cops (checks) and to alter their behavior if they accept
|
4
|
+
# any parameters. The file can be placed either in your home
|
5
|
+
# directory or in some project directory.
|
6
|
+
#
|
7
|
+
# RuboCop will start looking for the configuration file in the directory
|
8
|
+
# where the inspected file is and continue its way up to the root directory.
|
9
|
+
#
|
10
|
+
# See https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md
|
11
|
+
#
|
12
|
+
---
|
13
|
+
Layout/LineLength:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Metrics/BlockLength:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Metrics/ClassLength:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
Metrics/MethodLength:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Style/Documentation:
|
26
|
+
Enabled: false
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
eufycam (0.2.0)
|
5
|
+
colorize
|
6
|
+
gli
|
7
|
+
terminal-table
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
ast (2.4.0)
|
13
|
+
coderay (1.1.2)
|
14
|
+
colorize (0.8.1)
|
15
|
+
diff-lcs (1.3)
|
16
|
+
ffi (1.12.2)
|
17
|
+
formatador (0.2.5)
|
18
|
+
gli (2.19.0)
|
19
|
+
guard (2.16.2)
|
20
|
+
formatador (>= 0.2.4)
|
21
|
+
listen (>= 2.7, < 4.0)
|
22
|
+
lumberjack (>= 1.0.12, < 2.0)
|
23
|
+
nenv (~> 0.1)
|
24
|
+
notiffany (~> 0.0)
|
25
|
+
pry (>= 0.9.12)
|
26
|
+
shellany (~> 0.0)
|
27
|
+
thor (>= 0.18.1)
|
28
|
+
guard-compat (1.2.1)
|
29
|
+
guard-rspec (4.7.3)
|
30
|
+
guard (~> 2.1)
|
31
|
+
guard-compat (~> 1.1)
|
32
|
+
rspec (>= 2.99.0, < 4.0)
|
33
|
+
jaro_winkler (1.5.4)
|
34
|
+
listen (3.2.1)
|
35
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
36
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
37
|
+
lumberjack (1.2.4)
|
38
|
+
method_source (1.0.0)
|
39
|
+
nenv (0.3.0)
|
40
|
+
notiffany (0.1.3)
|
41
|
+
nenv (~> 0.1)
|
42
|
+
shellany (~> 0.0)
|
43
|
+
parallel (1.19.1)
|
44
|
+
parser (2.7.1.1)
|
45
|
+
ast (~> 2.4.0)
|
46
|
+
pry (0.13.1)
|
47
|
+
coderay (~> 1.1)
|
48
|
+
method_source (~> 1.0)
|
49
|
+
rainbow (3.0.0)
|
50
|
+
rake (13.0.1)
|
51
|
+
rb-fsevent (0.10.3)
|
52
|
+
rb-inotify (0.10.1)
|
53
|
+
ffi (~> 1.0)
|
54
|
+
rexml (3.2.4)
|
55
|
+
rspec (3.9.0)
|
56
|
+
rspec-core (~> 3.9.0)
|
57
|
+
rspec-expectations (~> 3.9.0)
|
58
|
+
rspec-mocks (~> 3.9.0)
|
59
|
+
rspec-core (3.9.1)
|
60
|
+
rspec-support (~> 3.9.1)
|
61
|
+
rspec-expectations (3.9.1)
|
62
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
63
|
+
rspec-support (~> 3.9.0)
|
64
|
+
rspec-mocks (3.9.1)
|
65
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
66
|
+
rspec-support (~> 3.9.0)
|
67
|
+
rspec-support (3.9.2)
|
68
|
+
rubocop (0.81.0)
|
69
|
+
jaro_winkler (~> 1.5.1)
|
70
|
+
parallel (~> 1.10)
|
71
|
+
parser (>= 2.7.0.1)
|
72
|
+
rainbow (>= 2.2.2, < 4.0)
|
73
|
+
rexml
|
74
|
+
ruby-progressbar (~> 1.7)
|
75
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
76
|
+
ruby-progressbar (1.10.1)
|
77
|
+
shellany (0.0.1)
|
78
|
+
terminal-table (1.8.0)
|
79
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
80
|
+
thor (1.0.1)
|
81
|
+
unicode-display_width (1.7.0)
|
82
|
+
|
83
|
+
PLATFORMS
|
84
|
+
ruby
|
85
|
+
|
86
|
+
DEPENDENCIES
|
87
|
+
bundler (~> 2.0)
|
88
|
+
eufycam!
|
89
|
+
guard-rspec
|
90
|
+
pry
|
91
|
+
rake (~> 13.0)
|
92
|
+
rspec (~> 3.0)
|
93
|
+
rubocop
|
94
|
+
|
95
|
+
BUNDLED WITH
|
96
|
+
2.0.2
|
data/Guardfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'guard/rspec/dsl'
|
4
|
+
|
5
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
6
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
7
|
+
rspec = dsl.rspec
|
8
|
+
ruby = dsl.ruby
|
9
|
+
|
10
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
11
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
12
|
+
watch(rspec.spec_files)
|
13
|
+
|
14
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
15
|
+
end
|
data/Rakefile
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
|
2
|
-
require "rspec/core/rake_task"
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
|
-
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
|
5
|
+
Dir.glob('lib/tasks/*.rake').each { |r| load r }
|
5
6
|
|
6
|
-
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
8
|
+
task default: :spec
|
data/bin/setup
CHANGED
data/eufycam.gemspec
CHANGED
@@ -1,29 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
|
-
lib = File.expand_path(
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
5
|
+
require 'eufycam/version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
8
|
+
spec.name = 'eufycam'
|
8
9
|
spec.version = Eufycam::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
10
|
+
spec.authors = ['Kyle Decot']
|
11
|
+
spec.email = ['kyle.decot@icloud.com']
|
11
12
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
13
|
+
spec.summary = 'Ruby interface for Eufycam'
|
14
|
+
spec.description = 'Ruby interface for Eufycam'
|
15
|
+
spec.homepage = 'https://github.com/kyledecot/eufycam'
|
16
|
+
spec.license = 'MIT'
|
16
17
|
|
17
18
|
# Specify which files should be added to the gem when it is released.
|
18
19
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
-
spec.files = Dir.chdir(File.expand_path(
|
20
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
20
21
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
22
|
end
|
22
|
-
spec.bindir =
|
23
|
+
spec.bindir = 'exe'
|
23
24
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
-
spec.require_paths = [
|
25
|
+
spec.require_paths = ['lib']
|
25
26
|
|
26
|
-
spec.
|
27
|
-
spec.
|
28
|
-
spec.
|
27
|
+
spec.add_runtime_dependency 'colorize'
|
28
|
+
spec.add_runtime_dependency 'gli'
|
29
|
+
spec.add_runtime_dependency 'terminal-table'
|
30
|
+
|
31
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
32
|
+
spec.add_development_dependency 'guard-rspec'
|
33
|
+
spec.add_development_dependency 'pry'
|
34
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
35
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
36
|
+
spec.add_development_dependency 'rubocop'
|
29
37
|
end
|
data/exe/eufycam
ADDED
data/lib/eufycam/cli.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'gli'
|
5
|
+
require 'terminal-table'
|
6
|
+
require 'colorize'
|
7
|
+
|
8
|
+
module Eufycam
|
9
|
+
class CLI
|
10
|
+
extend GLI::App
|
11
|
+
|
12
|
+
flag 'email',
|
13
|
+
default_value: ENV['EUFYCAM_EMAIL'],
|
14
|
+
arg_name: 'EMAIL'
|
15
|
+
|
16
|
+
flag 'password',
|
17
|
+
mask: true,
|
18
|
+
default_value: ENV['EUFYCAM_PASSWORD'],
|
19
|
+
arg_name: 'PASSWORD'
|
20
|
+
|
21
|
+
command :devices do |devices|
|
22
|
+
devices.command :timelapse do |timelapse|
|
23
|
+
timelapse.flag 'device-name', arg_name: 'DEVICE_NAME'
|
24
|
+
|
25
|
+
timelapse.action do |_global_options, options, _args|
|
26
|
+
# client = Client.new(global_options.slice('username', 'password'))
|
27
|
+
|
28
|
+
puts "capture a timelapse #{options['device-name']}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
devices.command 'start-stream' do |start_stream|
|
33
|
+
start_stream.action do |global_options, options, _args|
|
34
|
+
client = Client.new(**global_options.slice(:email, :password))
|
35
|
+
|
36
|
+
puts client.start_stream(
|
37
|
+
device_name: options['device-name']
|
38
|
+
).to_json
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
devices.command 'play' do |play|
|
43
|
+
play.action do |global_options, options, _args|
|
44
|
+
client = Client.new(**global_options.slice(:email, :password))
|
45
|
+
|
46
|
+
url = client.start_stream(
|
47
|
+
device_name: options['device-name']
|
48
|
+
)['url']
|
49
|
+
|
50
|
+
`ffplay -loglevel panic #{url}`
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
devices.command 'list' do |list|
|
55
|
+
list.action do |global_options, _options, _args|
|
56
|
+
client = Client.new(**global_options.slice(:email, :password))
|
57
|
+
|
58
|
+
results = client.list_devices
|
59
|
+
|
60
|
+
puts results.to_json
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'uri'
|
4
|
+
require 'json'
|
5
|
+
require 'net/http'
|
6
|
+
|
7
|
+
module Eufycam
|
8
|
+
class Client
|
9
|
+
def initialize(email:, password:)
|
10
|
+
@email = email
|
11
|
+
@password = password
|
12
|
+
end
|
13
|
+
|
14
|
+
def post(path, access_token, body = nil)
|
15
|
+
uri = URI("https://mysecurity.eufylife.com/api/v1/#{path}")
|
16
|
+
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
|
17
|
+
yield http.request(request(path, access_token, body))
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def request(path, auth_token, body = nil)
|
22
|
+
uri = URI("https://mysecurity.eufylife.com/api/v1/#{path}")
|
23
|
+
|
24
|
+
Net::HTTP::Post.new(uri).tap do |post|
|
25
|
+
post.body = body.to_json
|
26
|
+
post['x-auth-token'] = auth_token unless auth_token.nil?
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def generate_auth_token
|
31
|
+
post('passport/login', nil, {
|
32
|
+
email: ENV.fetch('EUFYCAM_EMAIL'),
|
33
|
+
password: ENV.fetch('EUFYCAM_PASSWORD')
|
34
|
+
}) do |response|
|
35
|
+
JSON.parse(response.body)['data']['auth_token']
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def list_devices(auth_token = generate_auth_token)
|
40
|
+
post('app/get_devs_list', auth_token) do |response|
|
41
|
+
JSON.parse(response.body)['data']
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def start_stream(device_name:)
|
46
|
+
auth_token = generate_auth_token
|
47
|
+
body = list_devices(auth_token)
|
48
|
+
.detect { |d| d['device_name'] == device_name }
|
49
|
+
.slice('station_sn', 'device_sn')
|
50
|
+
|
51
|
+
post(
|
52
|
+
'web/equipment/start_stream',
|
53
|
+
auth_token,
|
54
|
+
body
|
55
|
+
) do |response|
|
56
|
+
JSON.parse(response.body)['data']
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def capture_image(url, filename)
|
61
|
+
system('ffmpeg', '-hide_banner', '-loglevel', 'panic', '-i', url.to_s, '-r', '5', filename.to_s)
|
62
|
+
end
|
63
|
+
|
64
|
+
def timelapse(device_name, directory)
|
65
|
+
url = start_stream(device_name)
|
66
|
+
|
67
|
+
loop do
|
68
|
+
capture_image(url, File.expand_path("#{directory}/#{Time.now.to_i}.png"))
|
69
|
+
print '.'
|
70
|
+
sleep(1)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
data/lib/eufycam/version.rb
CHANGED
data/lib/eufycam.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eufycam/version'
|
4
|
+
|
5
|
+
version = Eufycam::VERSION
|
6
|
+
|
7
|
+
desc "Release eufycam-#{version}.gem"
|
8
|
+
task :release, [:key] do |_task, args|
|
9
|
+
args.with_defaults(key: 'rubygems')
|
10
|
+
|
11
|
+
key = args.key.to_sym
|
12
|
+
host = {
|
13
|
+
rubygems: 'https://rubygems.org',
|
14
|
+
github: 'https://rubygems.pkg.github.com/kyledecot'
|
15
|
+
}.fetch(key)
|
16
|
+
|
17
|
+
sh %(gem push --key=#{key} --host=#{host} eufycam-#{version}.gem)
|
18
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eufycam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Decot
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: colorize
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: gli
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: terminal-table
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
13
55
|
- !ruby/object:Gem::Dependency
|
14
56
|
name: bundler
|
15
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -24,20 +66,48 @@ dependencies:
|
|
24
66
|
- - "~>"
|
25
67
|
- !ruby/object:Gem::Version
|
26
68
|
version: '2.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard-rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
27
97
|
- !ruby/object:Gem::Dependency
|
28
98
|
name: rake
|
29
99
|
requirement: !ruby/object:Gem::Requirement
|
30
100
|
requirements:
|
31
101
|
- - "~>"
|
32
102
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
103
|
+
version: '13.0'
|
34
104
|
type: :development
|
35
105
|
prerelease: false
|
36
106
|
version_requirements: !ruby/object:Gem::Requirement
|
37
107
|
requirements:
|
38
108
|
- - "~>"
|
39
109
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
110
|
+
version: '13.0'
|
41
111
|
- !ruby/object:Gem::Dependency
|
42
112
|
name: rspec
|
43
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,26 +122,51 @@ dependencies:
|
|
52
122
|
- - "~>"
|
53
123
|
- !ruby/object:Gem::Version
|
54
124
|
version: '3.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
55
139
|
description: Ruby interface for Eufycam
|
56
140
|
email:
|
57
141
|
- kyle.decot@icloud.com
|
58
|
-
executables:
|
142
|
+
executables:
|
143
|
+
- eufycam
|
59
144
|
extensions: []
|
60
145
|
extra_rdoc_files: []
|
61
146
|
files:
|
147
|
+
- ".github/workflows/default.yml"
|
62
148
|
- ".gitignore"
|
63
149
|
- ".rspec"
|
150
|
+
- ".rubocop.yml"
|
64
151
|
- ".ruby-version"
|
65
|
-
- ".travis.yml"
|
66
152
|
- Gemfile
|
153
|
+
- Gemfile.lock
|
154
|
+
- Guardfile
|
67
155
|
- LICENSE.txt
|
68
156
|
- README.md
|
69
157
|
- Rakefile
|
70
|
-
- bin/console
|
71
158
|
- bin/setup
|
72
159
|
- eufycam.gemspec
|
160
|
+
- exe/eufycam
|
73
161
|
- lib/eufycam.rb
|
162
|
+
- lib/eufycam/cli.rb
|
163
|
+
- lib/eufycam/client.rb
|
164
|
+
- lib/eufycam/ffmpeg.rb
|
74
165
|
- lib/eufycam/version.rb
|
166
|
+
- lib/tasks/build.rake
|
167
|
+
- lib/tasks/console.rake
|
168
|
+
- lib/tasks/release.rake
|
169
|
+
- lib/tasks/version.rake
|
75
170
|
homepage: https://github.com/kyledecot/eufycam
|
76
171
|
licenses:
|
77
172
|
- MIT
|
data/.travis.yml
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "eufycam"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|