twitchus 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.
- data/config.example.yml +9 -0
- data/lib/twitchus/checker.rb +5 -0
- data/lib/twitchus/version.rb +1 -1
- data/lib/twitchus/worker.rb +8 -2
- metadata +3 -3
data/config.example.yml
CHANGED
data/lib/twitchus/checker.rb
CHANGED
@@ -4,6 +4,11 @@ require "json"
|
|
4
4
|
module Twitchus
|
5
5
|
class Checker
|
6
6
|
|
7
|
+
def fetch_all(channels)
|
8
|
+
channels.map { |channel| check(channel) }.select { |c| !c.nil? }
|
9
|
+
end
|
10
|
+
|
11
|
+
# Return a list of online channel names
|
7
12
|
def check_all(channels)
|
8
13
|
channels.select { |channel| online?(channel) }
|
9
14
|
end
|
data/lib/twitchus/version.rb
CHANGED
data/lib/twitchus/worker.rb
CHANGED
@@ -11,9 +11,15 @@ module Twitchus
|
|
11
11
|
# Empty the online channel list first
|
12
12
|
@storage.clear
|
13
13
|
|
14
|
-
online_channels = @checker.
|
14
|
+
online_channels = @checker.fetch_all(@config.channels)
|
15
15
|
online_channels.each do |channel|
|
16
|
-
|
16
|
+
data = {
|
17
|
+
name: channel["title"],
|
18
|
+
channel: channel["channel"]["login"],
|
19
|
+
image: channel["channel"]["image_url_huge"]
|
20
|
+
}
|
21
|
+
|
22
|
+
@storage.push data.to_json
|
17
23
|
end
|
18
24
|
end
|
19
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitchus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -203,7 +203,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
203
203
|
version: '0'
|
204
204
|
segments:
|
205
205
|
- 0
|
206
|
-
hash:
|
206
|
+
hash: -4568344585535927602
|
207
207
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
208
208
|
none: false
|
209
209
|
requirements:
|
@@ -212,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
212
212
|
version: '0'
|
213
213
|
segments:
|
214
214
|
- 0
|
215
|
-
hash:
|
215
|
+
hash: -4568344585535927602
|
216
216
|
requirements: []
|
217
217
|
rubyforge_project:
|
218
218
|
rubygems_version: 1.8.24
|