descartes 0.8.12 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8bd496d45169b4c524932428682e9a356eabd19
4
- data.tar.gz: 3df27e83b837f97e804495436d596563a9c0a76a
3
+ metadata.gz: b53f5914cc8574d238cdbd31d4d5c12bb1757ec8
4
+ data.tar.gz: bdcb269a87fa6f09a5b669441dd9c069d1bc0858
5
5
  SHA512:
6
- metadata.gz: 7e92f300f91aec951f1d8846fcaadd5dd0270f079a848b396aed4423f717cf1792f44a65b227b9caf4bf82eb37cb0cd10de00154327d99e88917b5842b394eba
7
- data.tar.gz: 3dd4987142b918a84fb561055793e1fff7901104601eede1fb0de380db3a5142d5c23eb3bf5a12beeb07ddbb095af6c87b144caa11221e864feac6caf3e121db
6
+ metadata.gz: 75704cf163bce87fa66e7773987616a4a1d1ace92b7d07c1116247f5550272f56296003fe3a68f37e9cedc9e19a0c3040546fabdc16183c04483c2b49ce7eb50
7
+ data.tar.gz: b48b0158b62789d4c88ecc1d7161f369835db2c084fc82be21e3d89cb39095e0d4a3a9f4786fdfdf3cf8dc6aed47d029e11bfc90928874c71d019b48515d8a9d
@@ -64,3 +64,4 @@ Non di rado mi chiedo quale sia il mio ruolo in questo postaccio.
64
64
  Va bene, ma sii cauto.
65
65
  Non ora, ti prego, sto dando sfogo alla mia arte.
66
66
  È tutto così semplice qui, solo 0 e 1.
67
+ Le tue scempiaggini persistono oltremodo nell'aere.
@@ -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}" if ep.download && !ep.download.strip.empty?
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 ep['status'] == 'error' # already exists
204
- if !field || !status
205
- fails = []
206
- [ :translation, :editing, :checking, :timing, :typesetting, :encoding, :qchecking ].each do |f|
207
- ep = assonnato.episode.edit show, episode.to_i, { f => :done }
208
- fails << [f, ep['message']] if ep['status'] != 'success'
209
- end
210
-
211
- if fails.length == 7
212
- m.reply "The episode has not been edited. Maybe it doesn't exist yet?"
213
- elsif fails.any?
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
- ep = assonnato.episode.edit show, episode.to_i, { field.to_sym => status.to_sym }
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
@@ -13,5 +13,5 @@
13
13
  ##
14
14
 
15
15
  class Descartes
16
- VERSION ||= '0.8.12'
16
+ VERSION ||= '0.9.0'
17
17
  end
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.8.12
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-03-12 00:00:00.000000000 Z
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