twitchus 0.0.3 → 0.0.4
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/Gemfile +1 -1
- data/lib/twitchus/checker.rb +3 -3
- data/lib/twitchus/version.rb +1 -1
- data/lib/twitchus/worker.rb +6 -4
- metadata +9 -4
data/Gemfile
CHANGED
data/lib/twitchus/checker.rb
CHANGED
@@ -4,8 +4,8 @@ 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? }
|
7
|
+
def fetch_all(channels, timeout = 0)
|
8
|
+
channels.map { |channel| check(channel); sleep timeout if timeout }.select { |c| !c.nil? }
|
9
9
|
end
|
10
10
|
|
11
11
|
# Return a list of online channel names
|
@@ -19,7 +19,7 @@ module Twitchus
|
|
19
19
|
|
20
20
|
response.first
|
21
21
|
rescue RestClient::BadRequest => e
|
22
|
-
$stderr.puts "RestClient::BadRequest for #{channel}"
|
22
|
+
$stderr.puts "RestClient::BadRequest for #{channel}, #{e}"
|
23
23
|
nil
|
24
24
|
end
|
25
25
|
|
data/lib/twitchus/version.rb
CHANGED
data/lib/twitchus/worker.rb
CHANGED
@@ -11,12 +11,14 @@ module Twitchus
|
|
11
11
|
# Empty the online channel list first
|
12
12
|
@storage.clear
|
13
13
|
|
14
|
-
online_channels = @checker.fetch_all(@config.channels)
|
14
|
+
online_channels = @checker.fetch_all(@config.channels, 0.5)
|
15
15
|
online_channels.each do |channel|
|
16
|
+
next if Integer === channel
|
17
|
+
|
16
18
|
data = {
|
17
|
-
name:
|
18
|
-
channel:
|
19
|
-
image:
|
19
|
+
name: channel["title"],
|
20
|
+
channel: c["login"],
|
21
|
+
image: c["image_url_huge"]
|
20
22
|
}
|
21
23
|
|
22
24
|
@storage.push data.to_json
|
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.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -201,15 +201,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
201
201
|
- - ! '>='
|
202
202
|
- !ruby/object:Gem::Version
|
203
203
|
version: '0'
|
204
|
+
segments:
|
205
|
+
- 0
|
206
|
+
hash: -1490566209112504012
|
204
207
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
208
|
none: false
|
206
209
|
requirements:
|
207
210
|
- - ! '>='
|
208
211
|
- !ruby/object:Gem::Version
|
209
212
|
version: '0'
|
213
|
+
segments:
|
214
|
+
- 0
|
215
|
+
hash: -1490566209112504012
|
210
216
|
requirements: []
|
211
217
|
rubyforge_project:
|
212
|
-
rubygems_version: 1.8.
|
218
|
+
rubygems_version: 1.8.23
|
213
219
|
signing_key:
|
214
220
|
specification_version: 3
|
215
221
|
summary: Twitchus is a gem for managing a list of Twitch.tv streams
|
@@ -223,4 +229,3 @@ test_files:
|
|
223
229
|
- spec/twitchus/config_spec.rb
|
224
230
|
- spec/twitchus/storage_spec.rb
|
225
231
|
- spec/twitchus_spec.rb
|
226
|
-
has_rdoc:
|