descartes 0.8.12 → 0.9.0
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/lib/descartes/modules/files/replies.txt +1 -0
- data/lib/descartes/modules/hackernews.rb +34 -0
- data/lib/descartes/modules/pigro.rb +16 -20
- data/lib/descartes/modules/tangorin.rb +37 -0
- data/lib/descartes/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b53f5914cc8574d238cdbd31d4d5c12bb1757ec8
|
|
4
|
+
data.tar.gz: bdcb269a87fa6f09a5b669441dd9c069d1bc0858
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 75704cf163bce87fa66e7773987616a4a1d1ace92b7d07c1116247f5550272f56296003fe3a68f37e9cedc9e19a0c3040546fabdc16183c04483c2b49ce7eb50
|
|
7
|
+
data.tar.gz: b48b0158b62789d4c88ecc1d7161f369835db2c084fc82be21e3d89cb39095e0d4a3a9f4786fdfdf3cf8dc6aed47d029e11bfc90928874c71d019b48515d8a9d
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
##
|
|
2
|
+
## DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
3
|
+
## Version 2, December 2004
|
|
4
|
+
##
|
|
5
|
+
## Everyone is permitted to copy and distribute verbatim or modified
|
|
6
|
+
## copies of this license document, and changing it is allowed as long
|
|
7
|
+
## as the name is changed.
|
|
8
|
+
##
|
|
9
|
+
## DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
10
|
+
## TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
11
|
+
##
|
|
12
|
+
## 0. You just DO WHAT THE FUCK YOU WANT TO.
|
|
13
|
+
###
|
|
14
|
+
|
|
15
|
+
require 'open-uri'
|
|
16
|
+
require 'nokogiri'
|
|
17
|
+
|
|
18
|
+
class Descartes
|
|
19
|
+
class Hackernews
|
|
20
|
+
include Cinch::Plugin
|
|
21
|
+
|
|
22
|
+
match /(https?:\/\/news.ycombinator.com\/item\?id=[0-9]+)/, use_prefix: false
|
|
23
|
+
def execute(m, url)
|
|
24
|
+
begin
|
|
25
|
+
page = Nokogiri::HTML open(url).read, nil, 'utf-8'
|
|
26
|
+
|
|
27
|
+
title = page.at_xpath('//td[@class="title"]/a').text.to_s
|
|
28
|
+
info = page.at_xpath('//td[@class="subtext"]').text.to_s.strip.gsub(" | past | web ", "")
|
|
29
|
+
|
|
30
|
+
m.reply "[HN] #{title} | #{info}"
|
|
31
|
+
rescue; end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -145,7 +145,7 @@ class Descartes
|
|
|
145
145
|
else
|
|
146
146
|
staff << 'Already released. '
|
|
147
147
|
end
|
|
148
|
-
staff << "#{'Download'.colorize}: #{ep.download}"
|
|
148
|
+
staff << "#{'Download'.colorize}: #{ep.download}" unless ep.download.strip.empty?
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
elsif n_ep.to_i > show.tot_episodes
|
|
@@ -198,28 +198,24 @@ class Descartes
|
|
|
198
198
|
if login['status'] == 'error'
|
|
199
199
|
m.reply login['message']
|
|
200
200
|
else
|
|
201
|
-
ep = assonnato.episode.add show, episode.to_i
|
|
202
|
-
|
|
203
|
-
if
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
fails.each { |field, error| m.reply("#{field}: #{ep['message']}") }
|
|
215
|
-
else
|
|
216
|
-
m.reply "The episode has been edited."
|
|
217
|
-
end
|
|
201
|
+
ep = assonnato.episode.add show, episode.to_i
|
|
202
|
+
|
|
203
|
+
if !field || !status
|
|
204
|
+
fails = []
|
|
205
|
+
[ :translation, :editing, :checking, :timing, :typesetting, :encoding, :qchecking ].each do |f|
|
|
206
|
+
ep = assonnato.episode.edit show, episode.to_i, { f => :done }
|
|
207
|
+
fails << [f, ep['message']] if ep['status'] != 'success'
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
if fails.length == 7
|
|
211
|
+
m.reply "The episode has not been edited. Maybe it doesn't exist yet?"
|
|
212
|
+
elsif fails.any?
|
|
213
|
+
fails.each { |field, error| m.reply("#{field}: #{ep['message']}") }
|
|
218
214
|
else
|
|
219
|
-
|
|
220
|
-
m.reply ep['message']
|
|
215
|
+
m.reply "The episode has been edited."
|
|
221
216
|
end
|
|
222
217
|
else
|
|
218
|
+
ep = assonnato.episode.edit show, episode.to_i, { field.to_sym => status.to_sym }
|
|
223
219
|
m.reply ep['message']
|
|
224
220
|
end
|
|
225
221
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
##
|
|
2
|
+
## DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
3
|
+
## Version 2, December 2004
|
|
4
|
+
##
|
|
5
|
+
## Everyone is permitted to copy and distribute verbatim or modified
|
|
6
|
+
## copies of this license document, and changing it is allowed as long
|
|
7
|
+
## as the name is changed.
|
|
8
|
+
##
|
|
9
|
+
## DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
10
|
+
## TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
11
|
+
##
|
|
12
|
+
## 0. You just DO WHAT THE FUCK YOU WANT TO.
|
|
13
|
+
###
|
|
14
|
+
|
|
15
|
+
require 'open-uri'
|
|
16
|
+
require 'nokogiri'
|
|
17
|
+
|
|
18
|
+
class Descartes
|
|
19
|
+
class Tangorin
|
|
20
|
+
include Cinch::Plugin
|
|
21
|
+
|
|
22
|
+
match /!tangorin (.+)/, use_prefix: false
|
|
23
|
+
def execute(m, search)
|
|
24
|
+
begin
|
|
25
|
+
page = Nokogiri::HTML open(URI.escape("http://tangorin.com/general/#{search}")).read, nil, 'utf-8'
|
|
26
|
+
|
|
27
|
+
romaji = page.at_xpath('//rt').text.chop
|
|
28
|
+
kana = page.at_xpath('//rb').text
|
|
29
|
+
kanji = page.at_xpath('//span[@class="writing"]').text
|
|
30
|
+
meaning = page.at_xpath('//span[@class="eng"]').text
|
|
31
|
+
info = page.at_xpath('//i[@class="d-info"]').text.chop.downcase.tr("—","")
|
|
32
|
+
|
|
33
|
+
m.reply "[Tangorin] #{kanji} (#{kana} - #{romaji}): #{meaning} (#{info})"
|
|
34
|
+
rescue; end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
data/lib/descartes/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: descartes
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Giovanni Capuano
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-08-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: cinch
|
|
@@ -177,6 +177,7 @@ files:
|
|
|
177
177
|
- lib/descartes/modules/files/replies.txt
|
|
178
178
|
- lib/descartes/modules/files/sindaco.txt
|
|
179
179
|
- lib/descartes/modules/google.rb
|
|
180
|
+
- lib/descartes/modules/hackernews.rb
|
|
180
181
|
- lib/descartes/modules/lastfm.rb
|
|
181
182
|
- lib/descartes/modules/musicthoughts.rb
|
|
182
183
|
- lib/descartes/modules/pigro.rb
|
|
@@ -187,6 +188,7 @@ files:
|
|
|
187
188
|
- lib/descartes/modules/seen.rb
|
|
188
189
|
- lib/descartes/modules/shinbo.rb
|
|
189
190
|
- lib/descartes/modules/sindaco.rb
|
|
191
|
+
- lib/descartes/modules/tangorin.rb
|
|
190
192
|
- lib/descartes/modules/treccani.rb
|
|
191
193
|
- lib/descartes/modules/url.rb
|
|
192
194
|
- lib/descartes/utils.rb
|