sleeproom 0.9.0.beta1 → 0.9.0.beta3
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/.gitignore +2 -0
- data/README.md +0 -1
- data/lib/sleeproom/cli.rb +13 -7
- data/lib/sleeproom/record.rb +3 -4
- data/lib/sleeproom/record/plugins.rb +9 -0
- data/lib/sleeproom/record/plugins/youtube/upload.rb +1 -0
- data/lib/sleeproom/record/record.rb +69 -57
- data/lib/sleeproom/record/tasks.rb +7 -9
- data/lib/sleeproom/record/websocket.rb +53 -71
- data/lib/sleeproom/utils.rb +20 -7
- data/lib/sleeproom/version.rb +1 -1
- data/sleeproom.gemspec +9 -9
- metadata +27 -27
- data/Gemfile.lock +0 -158
- data/lib/sleeproom/record/web/app.rb +0 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3845e3c4fe71e788a6a58fdccdeafdf54df9a076970e603d255221f9a9eb485d
|
4
|
+
data.tar.gz: 5bb98e697e5b39f8d2a7c77e8b383dfcc68c76d342f9aa9a062cdb1908567bc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10225f5c2f860a9c0862962f0e0e35ed8bd3ceb4d630d7cfc72dd98d388643dea785bab30448b2003c1019dbc3bcb708615ce63cd296fbff549c2d7c2a76d5d6
|
7
|
+
data.tar.gz: 638388a6ab62c5db454155bdf8d21aebd6f1fdd562ea0b807add10c4759008ab2f09e96f535990ca506ffa5ccfdbcccdde7509ef22434b94d660ee0d584322cd
|
data/.gitignore
CHANGED
data/README.md
CHANGED
data/lib/sleeproom/cli.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "backports/2.5" if RUBY_VERSION < "2.5.0"
|
4
3
|
require "ruby-next"
|
5
4
|
require "optparse"
|
6
5
|
require "yaml"
|
@@ -12,6 +11,12 @@ module SleepRoom
|
|
12
11
|
def initialize(argv)
|
13
12
|
SleepRoom.reload_config
|
14
13
|
@options = {}
|
14
|
+
begin
|
15
|
+
minyami = `minyami --version`
|
16
|
+
status = $?
|
17
|
+
rescue => e
|
18
|
+
SleepRoom.warning("无法调用 Minyami: #{e.message}")
|
19
|
+
end
|
15
20
|
build
|
16
21
|
if argv.empty? == false
|
17
22
|
@parser.parse!(argv)
|
@@ -42,18 +47,18 @@ module SleepRoom
|
|
42
47
|
opt.banner += "status".rjust(10)
|
43
48
|
opt.banner += "显示任务状态".rjust(33)
|
44
49
|
opt.banner += "\n"
|
45
|
-
opt.banner += "
|
46
|
-
opt.banner += "显示录制列表".rjust(
|
50
|
+
opt.banner += "lists".rjust(9)
|
51
|
+
opt.banner += "显示录制列表".rjust(34)
|
47
52
|
opt.banner += "\n"
|
48
53
|
opt.banner += "exit".rjust(8)
|
49
54
|
opt.banner += "关闭任务队列".rjust(35)
|
50
55
|
opt.banner += "\n\nCommands:\n"
|
51
56
|
|
52
|
-
opt.on("-a ROOM, NAME", "--add ROOM, GROUP", Array, "
|
57
|
+
opt.on("-a ROOM, NAME", "--add ROOM, GROUP", Array, "添加房间到监视列表") do |room|
|
53
58
|
SleepRoom::Record::Tasks.add(room[0].to_s, room[1].to_s)
|
54
59
|
end
|
55
60
|
|
56
|
-
opt.on("-r", "--remove [ROOM]", "
|
61
|
+
opt.on("-r", "--remove [ROOM]", "从监视列表移除房间") do |room|
|
57
62
|
SleepRoom::Record::Tasks.remove(room)
|
58
63
|
end
|
59
64
|
|
@@ -68,11 +73,12 @@ module SleepRoom
|
|
68
73
|
end
|
69
74
|
end
|
70
75
|
|
71
|
-
opt.on("
|
76
|
+
opt.on("--verbose", "DEBUG") do
|
77
|
+
ENV["SR_DEBUG"] = "DEBUG"
|
72
78
|
@options[:verbose] = true
|
73
79
|
end
|
74
80
|
|
75
|
-
opt.on_tail("--version", "Print version") do
|
81
|
+
opt.on_tail("-v", "--version", "Print version") do
|
76
82
|
STDOUT.puts(opt.version)
|
77
83
|
end
|
78
84
|
|
data/lib/sleeproom/record.rb
CHANGED
@@ -8,21 +8,20 @@ require "sleeproom/record/record"
|
|
8
8
|
require "sleeproom/record/tasks"
|
9
9
|
require "sleeproom/record/websocket"
|
10
10
|
require "sleeproom/record/api/api"
|
11
|
-
require "sleeproom/record/
|
11
|
+
require "sleeproom/record/plugins"
|
12
12
|
require "async"
|
13
|
-
require "roda"
|
14
|
-
require "rack/handler/falcon"
|
15
13
|
require "shellwords"
|
16
14
|
module SleepRoom
|
17
15
|
module Record
|
18
16
|
# Okite!!!
|
19
17
|
# @param url [String]
|
20
18
|
# @return [Integer]
|
21
|
-
def self.call_minyami(url:, is_live: true, threads: configatron.minyami.threads, output:, retries: configatron.minyami.retries)
|
19
|
+
def self.call_minyami(url:, is_live: true, threads: configatron.minyami.threads, output:, retries: configatron.minyami.retries, no_merge: configatron.minyami.no_merge)
|
22
20
|
command = "minyami -d #{Shellwords.escape(url)}"
|
23
21
|
command += " --retries #{retries.to_i}" if retries
|
24
22
|
command += " --threads #{threads.to_i}" if threads
|
25
23
|
command += " --live" if is_live
|
24
|
+
command += " --nomerge" if no_merge
|
26
25
|
output = File.join(configatron.save_path, output)
|
27
26
|
command += " --output #{Shellwords.escape(output)}" if output
|
28
27
|
download_dir_check(output)
|
@@ -0,0 +1 @@
|
|
1
|
+
# Youtube Uploader
|
@@ -16,21 +16,23 @@ module SleepRoom
|
|
16
16
|
@status = queue
|
17
17
|
@running = false
|
18
18
|
@downloading = false
|
19
|
+
set_room_info
|
19
20
|
end
|
20
21
|
|
21
22
|
# Record Room
|
22
23
|
def record
|
23
|
-
set_room_info
|
24
24
|
if @is_live
|
25
25
|
log("Status: broadcast.")
|
26
26
|
download_process if @downloading == false
|
27
27
|
else
|
28
|
+
update_status
|
28
29
|
log("Status: Stop.")
|
29
30
|
end
|
30
31
|
start_websocket
|
31
32
|
rescue => e
|
32
33
|
error(e.full_message)
|
33
34
|
Async::Task.current.sleep 5
|
35
|
+
set_room_info
|
34
36
|
retry
|
35
37
|
end
|
36
38
|
|
@@ -40,6 +42,10 @@ module SleepRoom
|
|
40
42
|
SleepRoom.info("[#{@room}] #{str}")
|
41
43
|
end
|
42
44
|
|
45
|
+
def debug(str)
|
46
|
+
SleepRoom.debug("[#{@room}] #{str}")
|
47
|
+
end
|
48
|
+
|
43
49
|
# Print log
|
44
50
|
# @param str [String]
|
45
51
|
def error(str)
|
@@ -48,52 +54,55 @@ module SleepRoom
|
|
48
54
|
|
49
55
|
private
|
50
56
|
|
57
|
+
def open_handler
|
58
|
+
end
|
59
|
+
|
60
|
+
def message_handler(data)
|
61
|
+
case data["t"].to_i
|
62
|
+
when 101
|
63
|
+
log("Live stop.")
|
64
|
+
@is_live = false
|
65
|
+
set_room_info
|
66
|
+
when 104
|
67
|
+
log("Live start.")
|
68
|
+
download_process
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def close_handler(error)
|
73
|
+
@running = false
|
74
|
+
end
|
75
|
+
|
76
|
+
def error_handler(error)
|
77
|
+
@running = false
|
78
|
+
end
|
79
|
+
|
80
|
+
def ping_handler
|
81
|
+
end
|
82
|
+
|
51
83
|
# Websocket connect
|
52
84
|
def start_websocket(task: Async::Task.current)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
log("Live start.")
|
68
|
-
download_process
|
69
|
-
end
|
70
|
-
elsif event == :status
|
71
|
-
case message[:event]
|
72
|
-
when :ack
|
73
|
-
update_status
|
74
|
-
when :close
|
75
|
-
log("WebSocket Close.")
|
76
|
-
task&.stop
|
77
|
-
when :error
|
78
|
-
error("Network Error.")
|
79
|
-
task&.stop
|
80
|
-
end
|
81
|
-
else
|
82
|
-
# TODO
|
83
|
-
end
|
84
|
-
end
|
85
|
-
rescue => e
|
86
|
-
error("WebSocket stopped.")
|
87
|
-
puts(e.full_message)
|
88
|
-
task&.stop
|
85
|
+
connection = task.async do |task|
|
86
|
+
while @running == false
|
87
|
+
log("Broadcast Key: #{@broadcast_key}")
|
88
|
+
@ws = WebSocket.new(
|
89
|
+
room: @room,
|
90
|
+
broadcast_key: @broadcast_key,
|
91
|
+
url: @broadcast_host,
|
92
|
+
open_handler: method(:open_handler),
|
93
|
+
message_handler: method(:message_handler),
|
94
|
+
close_handler: method(:close_handler),
|
95
|
+
error_handler: method(:error_handler),
|
96
|
+
ping_handler: method(:ping_handler)
|
97
|
+
)
|
98
|
+
@ws.connect
|
89
99
|
end
|
90
100
|
end
|
91
|
-
|
101
|
+
task.children.each(&:wait)
|
92
102
|
ensure
|
103
|
+
log("Websocket task stop.")
|
104
|
+
connection&.stop
|
93
105
|
@running = false
|
94
|
-
task.sleep 5
|
95
|
-
main&.stop
|
96
|
-
start_websocket
|
97
106
|
end
|
98
107
|
|
99
108
|
def set_room_info(task: Async::Task.current)
|
@@ -109,18 +118,19 @@ module SleepRoom
|
|
109
118
|
task.stop
|
110
119
|
rescue => e
|
111
120
|
error(e.message)
|
112
|
-
log("
|
113
|
-
log("
|
121
|
+
log("Cannot parse room info.")
|
122
|
+
log("try again...")
|
114
123
|
task.sleep 5
|
115
124
|
retry
|
116
125
|
end
|
117
126
|
|
118
|
-
def parse_streaming_url
|
127
|
+
def parse_streaming_url(task: Async::Task.current)
|
119
128
|
api = API::StreamingAPI.new(@room_id)
|
120
129
|
api.streaming_url
|
121
130
|
rescue => e
|
122
131
|
SleepRoom.error(e.full_message)
|
123
|
-
log("
|
132
|
+
log("Unable to parse HLS url.")
|
133
|
+
task.sleep 1
|
124
134
|
retry
|
125
135
|
end
|
126
136
|
|
@@ -149,7 +159,7 @@ module SleepRoom
|
|
149
159
|
break if @is_live == true
|
150
160
|
|
151
161
|
log("Waiting for latest status...")
|
152
|
-
task.sleep
|
162
|
+
task.sleep 5
|
153
163
|
retries += 1
|
154
164
|
end
|
155
165
|
completed = true if retries == 3 && @is_live == false
|
@@ -157,18 +167,20 @@ module SleepRoom
|
|
157
167
|
# Live stopped, Minyami process stopped.
|
158
168
|
@status.add(room: @room, status: :completed, live: false)
|
159
169
|
log("Download completed.")
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
+
if configatron.minyami.no_merge
|
171
|
+
log("Find minyami temp files...")
|
172
|
+
tmp_path = SleepRoom.find_tmp_directory(output, call_time)
|
173
|
+
if tmp_path
|
174
|
+
log("Temp files in #{tmp_path}.")
|
175
|
+
save_path = File.dirname("#{configatron.save_path}/#{output}")
|
176
|
+
dir_name = File.basename(output).sub(".ts", "")
|
177
|
+
SleepRoom.move_ts_to_archive(tmp_path, save_path, dir_name)
|
178
|
+
log("Save chunks to #{save_path}/#{dir_name}.")
|
179
|
+
else
|
180
|
+
log("Can not find temp file")
|
181
|
+
end
|
170
182
|
end
|
171
|
-
|
183
|
+
@ws.close
|
172
184
|
@running = false
|
173
185
|
break
|
174
186
|
elsif SleepRoom.running?(pid) == false && @is_live == true
|
@@ -35,14 +35,6 @@ module SleepRoom
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
SleepRoom.info("共启动 #{running_task_count} 个任务.")
|
38
|
-
if configatron.web.use
|
39
|
-
Async do
|
40
|
-
host = configatron.web.server.to_s
|
41
|
-
port = configatron.web.port.to_i
|
42
|
-
Rack::Handler.get(:falcon).run(Web::App, Host: host, Port: port)
|
43
|
-
SleepRoom.info("Web server running. http://#{host}:#{port}/")
|
44
|
-
end
|
45
|
-
end
|
46
38
|
task.children.each(&:wait)
|
47
39
|
rescue StandardError => e
|
48
40
|
puts e.full_message
|
@@ -105,7 +97,13 @@ module SleepRoom
|
|
105
97
|
|
106
98
|
def self.add(room, group)
|
107
99
|
Async do
|
108
|
-
|
100
|
+
if group.empty?
|
101
|
+
if group_match = room.match(/(?<=[((]).*?(?=[))])/)
|
102
|
+
group = group_match[0]
|
103
|
+
else
|
104
|
+
group = "default"
|
105
|
+
end
|
106
|
+
end
|
109
107
|
old_record = SleepRoom.load_config(:record)
|
110
108
|
name = API::RoomAPI.new(room).room_name
|
111
109
|
input_record = { "room" => room, "name" => name }
|
@@ -8,103 +8,85 @@ require "json"
|
|
8
8
|
module SleepRoom
|
9
9
|
module Record
|
10
10
|
class WebSocket
|
11
|
-
|
12
|
-
def initialize(room:, broadcast_key:, url:)
|
11
|
+
def initialize(room:, broadcast_key:, url:, open_handler:, message_handler:, close_handler:, error_handler:, ping_handler:)
|
13
12
|
@room = room
|
14
13
|
@url = "wss://" + url
|
15
14
|
@broadcast_key = broadcast_key
|
16
15
|
@running = false
|
17
|
-
@
|
16
|
+
@endpoint = Async::HTTP::Endpoint.parse(@url)
|
17
|
+
@open_handler = open_handler
|
18
|
+
@message_handler = message_handler
|
19
|
+
@close_handler = close_handler
|
20
|
+
@error_handler = error_handler
|
21
|
+
@ping_handler = ping_handler
|
18
22
|
end
|
19
23
|
|
20
24
|
def connect(task: Async::Task.current)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
@connection = connection
|
26
|
-
@running = true
|
27
|
-
connection.write("SUB\t#{@broadcast_key}")
|
28
|
-
connection.flush
|
29
|
-
log("Connect to websocket server.")
|
30
|
-
yield :status, { event: :connect, time: Time.now }
|
25
|
+
websocket = Async::WebSocket::Client.connect(@endpoint, handler: WebSocketConnection) do |connection|
|
26
|
+
@connection = connection
|
27
|
+
@running = true
|
28
|
+
send("SUB\t#{@broadcast_key}")
|
31
29
|
|
32
|
-
|
33
|
-
|
34
|
-
sub.sleep 60
|
35
|
-
begin
|
36
|
-
connection.write("PING\tshowroom")
|
37
|
-
connection.flush
|
38
|
-
rescue => e
|
39
|
-
log(e.message)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
30
|
+
log("Connect to websocket server.")
|
31
|
+
@open_handler.call
|
43
32
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
connection.close
|
49
|
-
yield :status, { event: :close, time: Time.now }
|
50
|
-
end
|
51
|
-
end
|
33
|
+
ping = task.async do |task|
|
34
|
+
loop do
|
35
|
+
task.sleep 60
|
36
|
+
send("PING\tshowroom")
|
52
37
|
end
|
38
|
+
end
|
53
39
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
connection.close
|
60
|
-
rescue
|
61
|
-
#
|
62
|
-
ensure
|
63
|
-
yield :status, { event: :close, time: Time.now }
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
while message = connection.read
|
69
|
-
if message == "ACK\tshowroom"
|
70
|
-
@last_ack = Time.now
|
71
|
-
yield :status, { event: :ack, time: Time.now } if message == "ACK\tshowroom"
|
72
|
-
end
|
73
|
-
next unless message.start_with?("MSG")
|
40
|
+
while message = connection.read
|
41
|
+
debug("ACK: #{message}")
|
42
|
+
@ping_handler.call if message == "ACK\tshowroom"
|
43
|
+
|
44
|
+
next unless message.start_with?("MSG")
|
74
45
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
46
|
+
begin
|
47
|
+
@message_handler.call(JSON.parse(message.split("\t")[2]))
|
48
|
+
rescue JSON::ParserError => e
|
49
|
+
@error_handler.call(e)
|
50
|
+
log(e.message)
|
80
51
|
end
|
81
|
-
rescue => e
|
82
|
-
yield :status, { event: :error, error: e }
|
83
|
-
SleepRoom.error(e.message)
|
84
|
-
ensure
|
85
|
-
ping_task&.stop
|
86
|
-
status_task&.stop
|
87
|
-
connection.close
|
88
|
-
reconnect_task&.stop
|
89
|
-
log("WebSocket closed.")
|
90
52
|
end
|
53
|
+
rescue => e
|
54
|
+
error "error"
|
55
|
+
@error_handler.call(e)
|
56
|
+
log(e.full_message)
|
57
|
+
ensure
|
58
|
+
ping&.stop
|
59
|
+
@close_handler.call(nil)
|
60
|
+
@running = false
|
61
|
+
log("WebSocket closed.")
|
91
62
|
end
|
92
63
|
end
|
93
64
|
|
65
|
+
def send(data)
|
66
|
+
debug("SEND: #{data}")
|
67
|
+
@connection.write(data)
|
68
|
+
@connection.flush
|
69
|
+
end
|
70
|
+
|
94
71
|
def running?
|
95
72
|
@running
|
96
73
|
end
|
97
74
|
|
98
|
-
attr_writer :running
|
99
|
-
|
100
75
|
def stop
|
101
|
-
@running = false
|
102
76
|
@connection.close
|
103
77
|
end
|
104
78
|
|
105
79
|
def log(str)
|
106
80
|
SleepRoom.info("[#{@room}] #{str}")
|
107
81
|
end
|
82
|
+
|
83
|
+
def error(str)
|
84
|
+
SleepRoom.error("[#{@room}] #{str}")
|
85
|
+
end
|
86
|
+
|
87
|
+
def debug(str)
|
88
|
+
SleepRoom.debug("[#{@room}] #{str}")
|
89
|
+
end
|
90
|
+
end
|
108
91
|
end
|
109
|
-
|
110
|
-
end
|
92
|
+
end
|
data/lib/sleeproom/utils.rb
CHANGED
@@ -6,9 +6,14 @@ require "fileutils"
|
|
6
6
|
require "tmpdir"
|
7
7
|
require "yaml"
|
8
8
|
require "logger"
|
9
|
+
require "dry/files"
|
9
10
|
|
10
11
|
module SleepRoom
|
11
12
|
class Error < StandardError; end
|
13
|
+
def self.files
|
14
|
+
Dry::Files.new
|
15
|
+
end
|
16
|
+
|
12
17
|
# @return [String]
|
13
18
|
def self.root_path
|
14
19
|
Dir.pwd
|
@@ -85,15 +90,10 @@ module SleepRoom
|
|
85
90
|
|
86
91
|
def self.init_base
|
87
92
|
base = {
|
88
|
-
web: {
|
89
|
-
use: true,
|
90
|
-
server: "localhost",
|
91
|
-
port: 3000
|
92
|
-
},
|
93
93
|
proxy: {
|
94
94
|
use: false,
|
95
95
|
server: "localhost",
|
96
|
-
port:
|
96
|
+
port: 1080,
|
97
97
|
type: "socks5"
|
98
98
|
},
|
99
99
|
record: {
|
@@ -107,7 +107,8 @@ module SleepRoom
|
|
107
107
|
default_save_name: "%ROOMNAME%-%TIME%.ts",
|
108
108
|
minyami: {
|
109
109
|
threads: 8,
|
110
|
-
retries: 999
|
110
|
+
retries: 999,
|
111
|
+
no_merge: false,
|
111
112
|
},
|
112
113
|
logger: {
|
113
114
|
console: true,
|
@@ -195,6 +196,10 @@ module SleepRoom
|
|
195
196
|
SleepRoom.write_config_file(:pid, pid)
|
196
197
|
end
|
197
198
|
|
199
|
+
def self.plugins
|
200
|
+
|
201
|
+
end
|
202
|
+
|
198
203
|
def self.find_tmp_directory(output, call_time)
|
199
204
|
regex = /Proccessing (.*) finished./
|
200
205
|
output = "#{configatron.save_path}/#{output}"
|
@@ -229,6 +234,12 @@ module SleepRoom
|
|
229
234
|
log(:info, string)
|
230
235
|
end
|
231
236
|
|
237
|
+
# @param string [String]
|
238
|
+
# @return [nil]
|
239
|
+
def self.debug(string)
|
240
|
+
log(:debug, string) if ENV["SR_DEBUG"]
|
241
|
+
end
|
242
|
+
|
232
243
|
# @param string [String]
|
233
244
|
# @return [nil]
|
234
245
|
def self.warning(string)
|
@@ -250,6 +261,8 @@ module SleepRoom
|
|
250
261
|
warn("[WARN] #{log}".colorize(:yellow))
|
251
262
|
when :error
|
252
263
|
puts("[ERROR] #{log}".colorize(:red))
|
264
|
+
when :debug
|
265
|
+
puts("[DEBUG] #{log}".colorize(:gray))
|
253
266
|
end
|
254
267
|
end
|
255
268
|
file_logger(type, log) if configatron.logger.file.use == true
|
data/lib/sleeproom/version.rb
CHANGED
data/sleeproom.gemspec
CHANGED
@@ -25,15 +25,15 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.executables = ["sleeproom"]
|
26
26
|
spec.require_paths = ["lib"]
|
27
27
|
|
28
|
-
spec.add_runtime_dependency("async", "~> 1.
|
29
|
-
spec.add_runtime_dependency("async-http-faraday", "~> 0.9
|
30
|
-
spec.add_runtime_dependency("async-websocket", "~> 0.
|
31
|
-
spec.add_runtime_dependency("colorize", "~> 0.8
|
32
|
-
spec.add_runtime_dependency("configatron", "~> 4.5
|
33
|
-
spec.add_runtime_dependency("
|
34
|
-
spec.add_runtime_dependency("
|
35
|
-
spec.add_runtime_dependency("
|
36
|
-
spec.add_runtime_dependency("
|
28
|
+
spec.add_runtime_dependency("async", "~> 1.29")
|
29
|
+
spec.add_runtime_dependency("async-http-faraday", "~> 0.9")
|
30
|
+
spec.add_runtime_dependency("async-websocket", "~> 0.18")
|
31
|
+
spec.add_runtime_dependency("colorize", "~> 0.8")
|
32
|
+
spec.add_runtime_dependency("configatron", "~> 4.5")
|
33
|
+
spec.add_runtime_dependency("ruby-next-core", "~> 0.9")
|
34
|
+
spec.add_runtime_dependency("terminal-table", "~> 1.8")
|
35
|
+
spec.add_runtime_dependency("dry-files", "~> 0.1")
|
36
|
+
spec.add_runtime_dependency("dry-auto_inject", "~> 0.6")
|
37
37
|
|
38
38
|
spec.post_install_message = <<~STR
|
39
39
|
SleepRoom 需要:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sleeproom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.0.
|
4
|
+
version: 0.9.0.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -16,126 +16,126 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: '1.29'
|
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: 1.
|
26
|
+
version: '1.29'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
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: 0.9
|
33
|
+
version: '0.9'
|
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: 0.9
|
40
|
+
version: '0.9'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: async-websocket
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: '0.18'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: '0.18'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: colorize
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.8
|
61
|
+
version: '0.8'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.8
|
68
|
+
version: '0.8'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: configatron
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 4.5
|
75
|
+
version: '4.5'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 4.5
|
82
|
+
version: '4.5'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: ruby-next-core
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
89
|
+
version: '0.9'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
96
|
+
version: '0.9'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: terminal-table
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: '1.8'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: '1.8'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: dry-files
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.
|
117
|
+
version: '0.1'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.
|
124
|
+
version: '0.1'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: dry-auto_inject
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: '0.6'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: '0.6'
|
139
139
|
description:
|
140
140
|
email:
|
141
141
|
- i@wug.moe
|
@@ -149,7 +149,6 @@ files:
|
|
149
149
|
- ".rubocop.yml"
|
150
150
|
- ".rubocop_todo.yml"
|
151
151
|
- Gemfile
|
152
|
-
- Gemfile.lock
|
153
152
|
- LICENSE.txt
|
154
153
|
- README.md
|
155
154
|
- Rakefile
|
@@ -161,9 +160,10 @@ files:
|
|
161
160
|
- lib/sleeproom/record/api/room.rb
|
162
161
|
- lib/sleeproom/record/api/room_api.rb
|
163
162
|
- lib/sleeproom/record/api/streaming_api.rb
|
163
|
+
- lib/sleeproom/record/plugins.rb
|
164
|
+
- lib/sleeproom/record/plugins/youtube/upload.rb
|
164
165
|
- lib/sleeproom/record/record.rb
|
165
166
|
- lib/sleeproom/record/tasks.rb
|
166
|
-
- lib/sleeproom/record/web/app.rb
|
167
167
|
- lib/sleeproom/record/websocket.rb
|
168
168
|
- lib/sleeproom/record/write_status.rb
|
169
169
|
- lib/sleeproom/utils.rb
|
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: 1.3.1
|
195
195
|
requirements: []
|
196
|
-
rubygems_version: 3.
|
196
|
+
rubygems_version: 3.2.3
|
197
197
|
signing_key:
|
198
198
|
specification_version: 4
|
199
199
|
summary: sleeproom
|
data/Gemfile.lock
DELETED
@@ -1,158 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
sleeproom (0.9.0.beta1)
|
5
|
-
async (~> 1.26.0)
|
6
|
-
async-http-faraday (~> 0.9.0)
|
7
|
-
async-websocket (~> 0.15.0)
|
8
|
-
colorize (~> 0.8.0)
|
9
|
-
configatron (~> 4.5.0)
|
10
|
-
falcon (~> 0.36.0)
|
11
|
-
roda (~> 3.33.0)
|
12
|
-
ruby-next-core (~> 0.9.0)
|
13
|
-
terminal-table (~> 1.8.0)
|
14
|
-
|
15
|
-
GEM
|
16
|
-
remote: https://rubygems.org/
|
17
|
-
specs:
|
18
|
-
activesupport (6.0.3.2)
|
19
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
20
|
-
i18n (>= 0.7, < 2)
|
21
|
-
minitest (~> 5.1)
|
22
|
-
tzinfo (~> 1.1)
|
23
|
-
zeitwerk (~> 2.2, >= 2.2.2)
|
24
|
-
ast (2.4.1)
|
25
|
-
async (1.26.2)
|
26
|
-
console (~> 1.0)
|
27
|
-
nio4r (~> 2.3)
|
28
|
-
timers (~> 4.1)
|
29
|
-
async-container (0.16.6)
|
30
|
-
async (~> 1.0)
|
31
|
-
async-io (~> 1.26)
|
32
|
-
async-http (0.52.4)
|
33
|
-
async (~> 1.25)
|
34
|
-
async-io (~> 1.28)
|
35
|
-
async-pool (~> 0.2)
|
36
|
-
protocol-http (~> 0.20.0)
|
37
|
-
protocol-http1 (~> 0.13.0)
|
38
|
-
protocol-http2 (~> 0.14.0)
|
39
|
-
async-http-cache (0.2.0)
|
40
|
-
async-http (~> 0.51)
|
41
|
-
async-http-faraday (0.9.0)
|
42
|
-
async-http (~> 0.42)
|
43
|
-
faraday
|
44
|
-
async-io (1.30.0)
|
45
|
-
async (~> 1.14)
|
46
|
-
async-pool (0.3.2)
|
47
|
-
async (~> 1.25)
|
48
|
-
async-websocket (0.15.0)
|
49
|
-
async-http (~> 0.51)
|
50
|
-
async-io (~> 1.23)
|
51
|
-
protocol-websocket (~> 0.7.0)
|
52
|
-
build-environment (1.13.0)
|
53
|
-
colorize (0.8.1)
|
54
|
-
concurrent-ruby (1.1.6)
|
55
|
-
configatron (4.5.1)
|
56
|
-
console (1.8.2)
|
57
|
-
diff-lcs (1.3)
|
58
|
-
falcon (0.36.4)
|
59
|
-
async (~> 1.13)
|
60
|
-
async-container (~> 0.16.0)
|
61
|
-
async-http (~> 0.52.0)
|
62
|
-
async-http-cache (~> 0.2.0)
|
63
|
-
async-io (~> 1.22)
|
64
|
-
build-environment (~> 1.13)
|
65
|
-
localhost (~> 1.1)
|
66
|
-
process-metrics (~> 0.2.0)
|
67
|
-
rack (>= 1.0)
|
68
|
-
samovar (~> 2.1)
|
69
|
-
faraday (1.0.1)
|
70
|
-
multipart-post (>= 1.2, < 3)
|
71
|
-
i18n (1.8.3)
|
72
|
-
concurrent-ruby (~> 1.0)
|
73
|
-
jaro_winkler (1.5.4)
|
74
|
-
localhost (1.1.6)
|
75
|
-
mapping (1.1.1)
|
76
|
-
minitest (5.14.1)
|
77
|
-
multipart-post (2.1.1)
|
78
|
-
nio4r (2.5.2)
|
79
|
-
parallel (1.19.2)
|
80
|
-
parser (2.7.1.4)
|
81
|
-
ast (~> 2.4.1)
|
82
|
-
process-metrics (0.2.1)
|
83
|
-
console (~> 1.8)
|
84
|
-
samovar (~> 2.1)
|
85
|
-
protocol-hpack (1.4.2)
|
86
|
-
protocol-http (0.20.0)
|
87
|
-
protocol-http1 (0.13.0)
|
88
|
-
protocol-http (~> 0.19)
|
89
|
-
protocol-http2 (0.14.0)
|
90
|
-
protocol-hpack (~> 1.4)
|
91
|
-
protocol-http (~> 0.18)
|
92
|
-
protocol-websocket (0.7.4)
|
93
|
-
protocol-http (~> 0.2)
|
94
|
-
protocol-http1 (~> 0.2)
|
95
|
-
rack (2.2.3)
|
96
|
-
rainbow (3.0.0)
|
97
|
-
rake (13.0.1)
|
98
|
-
rexml (3.2.4)
|
99
|
-
roda (3.33.0)
|
100
|
-
rack
|
101
|
-
rspec (3.9.0)
|
102
|
-
rspec-core (~> 3.9.0)
|
103
|
-
rspec-expectations (~> 3.9.0)
|
104
|
-
rspec-mocks (~> 3.9.0)
|
105
|
-
rspec-core (3.9.2)
|
106
|
-
rspec-support (~> 3.9.3)
|
107
|
-
rspec-expectations (3.9.2)
|
108
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
109
|
-
rspec-support (~> 3.9.0)
|
110
|
-
rspec-mocks (3.9.1)
|
111
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
112
|
-
rspec-support (~> 3.9.0)
|
113
|
-
rspec-support (3.9.3)
|
114
|
-
rubocop (0.82.0)
|
115
|
-
jaro_winkler (~> 1.5.1)
|
116
|
-
parallel (~> 1.10)
|
117
|
-
parser (>= 2.7.0.1)
|
118
|
-
rainbow (>= 2.2.2, < 4.0)
|
119
|
-
rexml
|
120
|
-
ruby-progressbar (~> 1.7)
|
121
|
-
unicode-display_width (>= 1.4.0, < 2.0)
|
122
|
-
rubocop-github (0.16.0)
|
123
|
-
rubocop (<= 0.82.0)
|
124
|
-
rubocop-performance (~> 1.0)
|
125
|
-
rubocop-rails (~> 2.0)
|
126
|
-
rubocop-performance (1.6.1)
|
127
|
-
rubocop (>= 0.71.0)
|
128
|
-
rubocop-rails (2.6.0)
|
129
|
-
activesupport (>= 4.2.0)
|
130
|
-
rack (>= 1.1)
|
131
|
-
rubocop (>= 0.82.0)
|
132
|
-
ruby-next-core (0.9.2)
|
133
|
-
ruby-progressbar (1.10.1)
|
134
|
-
samovar (2.1.4)
|
135
|
-
console (~> 1.0)
|
136
|
-
mapping (~> 1.0)
|
137
|
-
terminal-table (1.8.0)
|
138
|
-
unicode-display_width (~> 1.1, >= 1.1.1)
|
139
|
-
thread_safe (0.3.6)
|
140
|
-
timers (4.3.0)
|
141
|
-
tzinfo (1.2.7)
|
142
|
-
thread_safe (~> 0.1)
|
143
|
-
unicode-display_width (1.7.0)
|
144
|
-
zeitwerk (2.3.0)
|
145
|
-
|
146
|
-
PLATFORMS
|
147
|
-
ruby
|
148
|
-
x64-mingw32
|
149
|
-
|
150
|
-
DEPENDENCIES
|
151
|
-
rake (~> 13.0)
|
152
|
-
rspec (~> 3.0)
|
153
|
-
rubocop-github
|
154
|
-
rubocop-performance
|
155
|
-
sleeproom!
|
156
|
-
|
157
|
-
BUNDLED WITH
|
158
|
-
2.1.4
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "roda"
|
4
|
-
module SleepRoom
|
5
|
-
module Web
|
6
|
-
class App < Roda
|
7
|
-
plugin :default_headers,
|
8
|
-
"Content-Type" => "application/json",
|
9
|
-
"X-Frame-Options" => "deny",
|
10
|
-
"X-Content-Type-Options" => "nosniff",
|
11
|
-
"X-XSS-Protection" => "1; mode=block"
|
12
|
-
plugin :content_security_policy do |csp|
|
13
|
-
csp.default_src :none
|
14
|
-
csp.style_src :self
|
15
|
-
csp.form_action :self
|
16
|
-
csp.script_src :self
|
17
|
-
csp.connect_src :self
|
18
|
-
csp.base_uri :none
|
19
|
-
csp.frame_ancestors :none
|
20
|
-
end
|
21
|
-
plugin :public
|
22
|
-
plugin :multi_route
|
23
|
-
plugin :not_found do
|
24
|
-
end
|
25
|
-
plugin :error_handler do |e|
|
26
|
-
$stderr.print "#{e.class}: #{e.message}\n"
|
27
|
-
warn e.backtrace
|
28
|
-
next exception_page(e, assets: true) if ENV["RACK_ENV"] == "development"
|
29
|
-
end
|
30
|
-
|
31
|
-
route "status" do |r|
|
32
|
-
SleepRoom.load_status.sort_by { |hash| hash[:group] }.to_json
|
33
|
-
end
|
34
|
-
|
35
|
-
route "lists" do |r|
|
36
|
-
r.get do
|
37
|
-
SleepRoom.load_config(:record).to_json
|
38
|
-
end
|
39
|
-
|
40
|
-
r.post do
|
41
|
-
end
|
42
|
-
end
|
43
|
-
route do |r|
|
44
|
-
r.public
|
45
|
-
r.multi_route
|
46
|
-
|
47
|
-
r.root do
|
48
|
-
"SleepRoom Web API"
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|