sleeproom 0.4.4 → 0.9.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,7 @@
3
3
  require "configatron"
4
4
  require "colorize"
5
5
  require "fileutils"
6
+ require "tmpdir"
6
7
  require "yaml"
7
8
  require "logger"
8
9
 
@@ -64,6 +65,7 @@ module SleepRoom
64
65
  def self.create_config_file(config, settings)
65
66
  path = config_path(config)
66
67
  return false if File.exist?(path)
68
+
67
69
  mkdir(File.dirname(path)) unless Dir.exist?(File.dirname(path))
68
70
  write_config_file(config, settings)
69
71
  end
@@ -105,7 +107,7 @@ module SleepRoom
105
107
  default_save_name: "%ROOMNAME%-%TIME%.ts",
106
108
  minyami: {
107
109
  threads: 8,
108
- retries: 999,
110
+ retries: 999
109
111
  },
110
112
  logger: {
111
113
  console: true,
@@ -122,9 +124,9 @@ module SleepRoom
122
124
  mkdir(config_dir) unless Dir.exist?(config_dir)
123
125
 
124
126
  mkdir("#{config_dir}/tmp") unless Dir.exist?("#{config_dir}/tmp")
125
-
127
+
126
128
  init_base
127
-
129
+
128
130
  record = {
129
131
  "default" => []
130
132
  }
@@ -150,6 +152,7 @@ module SleepRoom
150
152
  def self.settings
151
153
  configatron
152
154
  end
155
+
153
156
  def self.load_status
154
157
  SleepRoom.load_config(:status)
155
158
  rescue Error
@@ -164,11 +167,11 @@ module SleepRoom
164
167
  retry
165
168
  end
166
169
 
167
- def self.running?(pid=nil)
170
+ def self.running?(pid = nil)
168
171
  pid = SleepRoom.load_config(:pid) if pid.nil?
169
172
  Process.kill(0, pid)
170
173
  true
171
- rescue
174
+ rescue StandardError
172
175
  false
173
176
  end
174
177
 
@@ -183,7 +186,7 @@ module SleepRoom
183
186
  SleepRoom.create_config_file(:status, status)
184
187
  end
185
188
 
186
- def self.create_record(record = {default: []})
189
+ def self.create_record(record = { default: [] })
187
190
  SleepRoom.create_config_file(:record, record)
188
191
  end
189
192
 
@@ -192,6 +195,34 @@ module SleepRoom
192
195
  SleepRoom.write_config_file(:pid, pid)
193
196
  end
194
197
 
198
+ def self.find_tmp_directory(output, call_time)
199
+ regex = /Proccessing (.*) finished./
200
+ output = "#{configatron.save_path}/#{output}"
201
+ log = "#{output}.out"
202
+ if media_name = File.readlines(log).select { |line| line =~ regex }.last.match(regex)[1]
203
+ directories = Dir["#{Dir.tmpdir}/minyami_#{call_time.to_i / 10}*"]
204
+ directories.each do |path|
205
+ if Dir.glob("#{path}/*.ts").select{ |e| e.include?(media_name)}
206
+ next unless Dir.glob("#{path}/*.ts").last.include?(media_name)
207
+
208
+ return path
209
+ end
210
+ end
211
+ end
212
+ return false
213
+ rescue => e
214
+ puts e.full_message
215
+ SleepRoom.error("寻找失败.")
216
+ end
217
+
218
+ def self.move_ts_to_archive(tmp, path, name)
219
+ FileUtils.cp_r(tmp, path)
220
+ FileUtils.mv(File.join(path, File.basename(tmp)), File.join(path, name))
221
+ rescue => e
222
+ puts e.full_message
223
+ SleepRoom.error("复制失败.")
224
+ end
225
+
195
226
  # @param string [String]
196
227
  # @return [nil]
197
228
  def self.info(string)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SleepRoom
4
- VERSION = "0.4.4"
4
+ VERSION = "0.9.0.beta1"
5
5
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.summary = "sleeproom"
12
12
  spec.homepage = "https://github.com/KoellM/sleeproom"
13
13
  spec.license = "MIT"
14
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
15
15
 
16
16
  spec.metadata["homepage_uri"] = spec.homepage
17
17
  # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
@@ -25,13 +25,16 @@ Gem::Specification.new do |spec|
25
25
  spec.executables = ["sleeproom"]
26
26
  spec.require_paths = ["lib"]
27
27
 
28
- spec.add_runtime_dependency("colorize", "~> 0.8.0")
29
28
  spec.add_runtime_dependency("async", "~> 1.26.0")
29
+ spec.add_runtime_dependency("async-http-faraday", "~> 0.9.0")
30
30
  spec.add_runtime_dependency("async-websocket", "~> 0.15.0")
31
+ spec.add_runtime_dependency("colorize", "~> 0.8.0")
31
32
  spec.add_runtime_dependency("configatron", "~> 4.5.0")
32
- spec.add_runtime_dependency("async-http-faraday", "~> 0.9.0")
33
+ spec.add_runtime_dependency("falcon", "~> 0.36.0")
34
+ spec.add_runtime_dependency("roda", "~> 3.33.0")
35
+ spec.add_runtime_dependency("ruby-next-core", "~> 0.9.0")
33
36
  spec.add_runtime_dependency("terminal-table", "~> 1.8.0")
34
-
37
+
35
38
  spec.post_install_message = <<~STR
36
39
  SleepRoom 需要:
37
40
  [Minyami] https://github.com/Last-Order/minyami
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sleeproom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.9.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-02 00:00:00.000000000 Z
11
+ date: 2020-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: colorize
14
+ name: async
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.8.0
19
+ version: 1.26.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.8.0
26
+ version: 1.26.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: async
28
+ name: async-http-faraday
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.26.0
33
+ version: 0.9.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.26.0
40
+ version: 0.9.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: async-websocket
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.15.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: colorize
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.8.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.8.0
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: configatron
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +81,35 @@ dependencies:
67
81
  - !ruby/object:Gem::Version
68
82
  version: 4.5.0
69
83
  - !ruby/object:Gem::Dependency
70
- name: async-http-faraday
84
+ name: falcon
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.36.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.36.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: roda
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 3.33.0
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 3.33.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: ruby-next-core
71
113
  requirement: !ruby/object:Gem::Requirement
72
114
  requirements:
73
115
  - - "~>"
@@ -121,6 +163,7 @@ files:
121
163
  - lib/sleeproom/record/api/streaming_api.rb
122
164
  - lib/sleeproom/record/record.rb
123
165
  - lib/sleeproom/record/tasks.rb
166
+ - lib/sleeproom/record/web/app.rb
124
167
  - lib/sleeproom/record/websocket.rb
125
168
  - lib/sleeproom/record/write_status.rb
126
169
  - lib/sleeproom/utils.rb
@@ -143,12 +186,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
143
186
  requirements:
144
187
  - - ">="
145
188
  - !ruby/object:Gem::Version
146
- version: 2.3.0
189
+ version: 2.5.0
147
190
  required_rubygems_version: !ruby/object:Gem::Requirement
148
191
  requirements:
149
- - - ">="
192
+ - - ">"
150
193
  - !ruby/object:Gem::Version
151
- version: '0'
194
+ version: 1.3.1
152
195
  requirements: []
153
196
  rubygems_version: 3.1.4
154
197
  signing_key: