herpes 0.0.2.5 → 0.0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/herpes +4 -2
- data/examples/mirai_nikki.rb +20 -0
- data/lib/herpes/rss.rb +5 -1
- data/lib/herpes/version.rb +1 -1
- data/lib/herpes.rb +12 -0
- metadata +5 -4
data/bin/herpes
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
# and this is another reason for making herpes, awesomely easy inlineable checkers
|
2
|
+
every 1.hour do
|
3
|
+
state[:mirai_nikki_torrents] ||= []
|
4
|
+
|
5
|
+
open('http://www.aozorateam.net/tracker/index/index.php').read.scan(%r((http://.*?%20Mirai%20Nikki%20-%20(\d+)%20.*\.mkv\.torrent))) {|uri, num|
|
6
|
+
next if state[:mirai_nikki_torrents].member?(uri)
|
7
|
+
|
8
|
+
state[:mirai_nikki_torrents].push(uri)
|
9
|
+
|
10
|
+
with :email do
|
11
|
+
via :procmail
|
12
|
+
|
13
|
+
to 'herpes'
|
14
|
+
from 'Mirai Nikki <rss@herpes>'
|
15
|
+
subject "Episode #{num} available"
|
16
|
+
|
17
|
+
send "Torrent: #{uri}"
|
18
|
+
end
|
19
|
+
}
|
20
|
+
end
|
data/lib/herpes/rss.rb
CHANGED
@@ -48,7 +48,11 @@ Herpes::Module.define :rss do
|
|
48
48
|
@rss.each {|r|
|
49
49
|
(state[:rss] ||= {})[r.url] ||= []
|
50
50
|
|
51
|
-
|
51
|
+
content = begin
|
52
|
+
open(r.url).read
|
53
|
+
rescue SocketError; end or next
|
54
|
+
|
55
|
+
RSS::Parser.parse(content, false).tap {|p|
|
52
56
|
p.items.reverse_each {|item|
|
53
57
|
next if state[:rss][r.url].member?(if p.is_a?(RSS::Atom::Feed)
|
54
58
|
item.link.href
|
data/lib/herpes/version.rb
CHANGED
data/lib/herpes.rb
CHANGED
@@ -99,6 +99,10 @@ class Herpes
|
|
99
99
|
@pool.resize(number)
|
100
100
|
end
|
101
101
|
|
102
|
+
def log_at (path = nil)
|
103
|
+
path ? @log_at = File.expand_path(path) : @log_at
|
104
|
+
end
|
105
|
+
|
102
106
|
def state (path = nil)
|
103
107
|
if path && path != @path
|
104
108
|
@path = File.expand_path(path)
|
@@ -263,6 +267,14 @@ class Herpes
|
|
263
267
|
}
|
264
268
|
}
|
265
269
|
end
|
270
|
+
rescue Exception => e
|
271
|
+
File.open(log_at, ?a) {|f|
|
272
|
+
f.write "[#{Time.now}] "
|
273
|
+
f.write "From: #{caller[0, 1].join "\n"}\n"
|
274
|
+
f.write "#{e.class}: #{e.message}\n"
|
275
|
+
f.write e.backtrace.to_a.join "\n"
|
276
|
+
f.write "\n\n"
|
277
|
+
} if log_at
|
266
278
|
ensure
|
267
279
|
save
|
268
280
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: herpes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.2.
|
4
|
+
version: 0.0.2.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: threadpool
|
16
|
-
requirement: &
|
16
|
+
requirement: &19567300 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *19567300
|
25
25
|
description:
|
26
26
|
email: meh@paranoici.org
|
27
27
|
executables:
|
@@ -32,6 +32,7 @@ files:
|
|
32
32
|
- README.md
|
33
33
|
- bin/herpes
|
34
34
|
- examples/generator.rb
|
35
|
+
- examples/mirai_nikki.rb
|
35
36
|
- examples/rss.rb
|
36
37
|
- herpes.gemspec
|
37
38
|
- lib/herpes.rb
|