descartes 0.5.1 → 0.6
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/bin/descartes +41 -10
- data/lib/descartes/descartes.rb +3 -1
- data/lib/descartes/modules/files/pigro.txt +1 -1
- data/lib/descartes/modules/files/sindaco.txt +2 -1
- data/lib/descartes/modules/lastfm.rb +8 -8
- data/lib/descartes/modules/pigro.rb +48 -32
- data/lib/descartes/modules/reply.rb +1 -1
- data/lib/descartes/modules/sindaco.rb +1 -1
- data/lib/descartes/utils.rb +4 -0
- data/lib/descartes/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2e04a1ec3c104c6178834d8bad31f6ec3541c597
|
|
4
|
+
data.tar.gz: 9bdddb1230425c304deccef0b14d110da7668242
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0a295fdbfba13164bb72c8293af021768bba17fbd141b78209077d8f05d29b06429edea339e5aed711fef3301263c298e051dc9bc9baf7bdfcf5cea394c6053b
|
|
7
|
+
data.tar.gz: 0e91e0ec5413b90a72b5abafb30b256e0795656d6f2c6d99b5dfc8139654307637e5392661704d254b2c88e5cc0d9d80d8cb1088c4c8a8497ad59782fa15cc20
|
data/bin/descartes
CHANGED
|
@@ -15,22 +15,54 @@
|
|
|
15
15
|
##
|
|
16
16
|
|
|
17
17
|
require 'descartes'
|
|
18
|
+
require 'optparse'
|
|
19
|
+
require 'fileutils'
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
options = {
|
|
22
|
+
:nickname => 'Descartes',
|
|
23
|
+
:server => 'irc.rizon.net',
|
|
24
|
+
:channels => ['#aggvistnurummor'],
|
|
25
|
+
:dotfiles => File.join(ENV['HOME'], '.descartes'),
|
|
26
|
+
:password => 'dat_password'
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
OptionParser.new { |o|
|
|
30
|
+
o.on '-n', '--nickname NICKNAME', 'bot\'s nickname' do |nickname|
|
|
31
|
+
options[:nickname] = nickname
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
o.on '-s', '--server SERVER', 'target IRC server' do |server|
|
|
35
|
+
options[:server] = server
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
o.on '-c', '--channel #chan1,#chan2,#chan3', 'target channels' do |channels|
|
|
39
|
+
options[:channels] = channels.split(?,).map { |s| s.strip }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
o.on '-d', '--dotfiles PATH', 'folder where store config files' do |dotfiles|
|
|
43
|
+
options[:dotfiles] = dotfiles
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
o.on '-p', '--password password', 'target channel\'s password' do |password|
|
|
47
|
+
options[:password] = password
|
|
48
|
+
end
|
|
49
|
+
}.parse!
|
|
50
|
+
|
|
51
|
+
unless File.directory? options[:dotfiles]
|
|
52
|
+
files = File.join File.dirname(__FILE__), '../lib/descartes/modules/files'
|
|
53
|
+
FileUtils.cp_r files, options[:dotfiles]
|
|
54
|
+
end
|
|
23
55
|
|
|
24
56
|
Cinch::Bot.new {
|
|
25
57
|
configure do |c|
|
|
26
|
-
c.nick = nickname
|
|
58
|
+
c.nick = options[:nickname]
|
|
27
59
|
c.realname = 'Descartes'
|
|
28
60
|
c.user = 'Descartes'
|
|
29
|
-
c.server = server
|
|
30
|
-
c.channels = channels
|
|
61
|
+
c.server = options[:server]
|
|
62
|
+
c.channels = options[:channels]
|
|
31
63
|
|
|
32
|
-
c.plugins.plugins = [Cinch::Plugins::Login] +
|
|
33
|
-
c.plugins.options[Cinch::Plugins::Login] = { :password =>
|
|
64
|
+
c.plugins.plugins = [Cinch::Plugins::Login] + Descartes.load(options)
|
|
65
|
+
c.plugins.options[Cinch::Plugins::Login] = { :password => options[:password] }
|
|
34
66
|
end
|
|
35
67
|
|
|
36
68
|
on :message, '!help' do |m|
|
|
@@ -77,5 +109,4 @@ Cinch::Bot.new {
|
|
|
77
109
|
on :message, '!version' do |m|
|
|
78
110
|
m.reply Descartes.version
|
|
79
111
|
end
|
|
80
|
-
|
|
81
112
|
}.start
|
data/lib/descartes/descartes.rb
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
http://
|
|
1
|
+
http://pigro.omnivium.it:4567
|
|
@@ -13,4 +13,5 @@ http://i47.tinypic.com/fjj3gx.jpg
|
|
|
13
13
|
Io dico solo che il Detective Conan è il motivo per cui il Giappone si meriterebbe un'altra bomba atomica.
|
|
14
14
|
Ti farò lezioni di encode quando tua madre sarà in oncologia.
|
|
15
15
|
Il Sindaco è comunista quanto Hitler / Si, forse un pochino di più / Nel senso che ha la passione in comune per il genocidio? / No, per le loli.
|
|
16
|
-
La Ninna Nanna del Sindaco: Dormi dormi / bella bambina / che c'è il sindaco che s'avvicina. / Il letto traballa / e l'orsetto se la squaglia. / La mammina resta in cucina / e col babbo fa melina. / Basta solo che dal corridoio / non vedan la pelata di quell'avvoltoio.
|
|
16
|
+
La Ninna Nanna del Sindaco: Dormi dormi / bella bambina / che c'è il sindaco che s'avvicina. / Il letto traballa / e l'orsetto se la squaglia. / La mammina resta in cucina / e col babbo fa melina. / Basta solo che dal corridoio / non vedan la pelata di quell'avvoltoio.
|
|
17
|
+
Il fansub italiano è ostaggio di un manipolo di lanzichenecchi.
|
|
@@ -21,12 +21,12 @@ class Descartes
|
|
|
21
21
|
include Cinch::Plugin
|
|
22
22
|
|
|
23
23
|
def authenticate!
|
|
24
|
-
file = File.join
|
|
24
|
+
file = File.join $options[:dotfiles], 'lastfm_api.yml'
|
|
25
25
|
Rockstar.lastfm = YAML.load_file file
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def get_lastfm_nicks_archive
|
|
29
|
-
file = File.join
|
|
29
|
+
file = File.join $options[:dotfiles], 'lastfm_nicks.yml'
|
|
30
30
|
FileUtils.touch file unless File.exists? file
|
|
31
31
|
YAML.load_file(file) || {}
|
|
32
32
|
end
|
|
@@ -37,16 +37,16 @@ class Descartes
|
|
|
37
37
|
|
|
38
38
|
usernick = m.user.nick
|
|
39
39
|
lastfmnick = get_lastfm_nicks_archive[usernick]
|
|
40
|
-
m.reply "Hey #{usernick}, I don't know your Last.fm nick. add it using '!lastfmuser add <lastfmnick>'." unless lastfmnick
|
|
40
|
+
m.reply "Hey #{usernick.colorize}, I don't know your Last.fm nick. add it using '!lastfmuser add <lastfmnick>'." unless lastfmnick
|
|
41
41
|
|
|
42
42
|
user = Rockstar::User.new lastfmnick
|
|
43
43
|
track = user.recent_tracks.first
|
|
44
44
|
|
|
45
|
-
album = track.album.empty? ? "in #{track.album}"
|
|
45
|
+
album = track.album.empty? ? 'in no known album' : "in #{track.album.colorize}"
|
|
46
46
|
if track.now_playing?
|
|
47
|
-
m.reply "#{lastfmnick} is listening to #{track.name} by #{track.artist} (#{album}) right now!"
|
|
47
|
+
m.reply "#{lastfmnick.colorize} is listening to #{track.name.colorize} by #{track.artist.colorize} (#{album}) right now!"
|
|
48
48
|
else
|
|
49
|
-
m.reply "The last song #{lastfmnick} listened to is #{track.name} by #{track.artist} (#{album})."
|
|
49
|
+
m.reply "The last song #{lastfmnick.colorize} listened to is #{track.name.colorize} by #{track.artist.colorize} (#{album})."
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
|
@@ -55,7 +55,7 @@ class Descartes
|
|
|
55
55
|
nicks = get_lastfm_nicks_archive
|
|
56
56
|
nicks[m.user.nick] = lastfmnick
|
|
57
57
|
|
|
58
|
-
file = File.join
|
|
58
|
+
file = File.join $options[:dotfiles], 'lastfm_nicks.yml'
|
|
59
59
|
File.open(file, ?w) { |f| f.write YAML.dump(nicks) }
|
|
60
60
|
|
|
61
61
|
m.reply "Ok, added user #{lastfmnick}."
|
|
@@ -66,7 +66,7 @@ class Descartes
|
|
|
66
66
|
nicks = get_lastfm_nicks_archive
|
|
67
67
|
nicks.delete lastfmnick
|
|
68
68
|
|
|
69
|
-
file = File.join
|
|
69
|
+
file = File.join $options[:dotfiles], 'lastfm_nicks.yml'
|
|
70
70
|
File.open(file, ?w) { |f| f.write YAML.dump(nicks) }
|
|
71
71
|
|
|
72
72
|
m.reply "Ok, removed user #{lastfmnick}."
|
|
@@ -17,57 +17,73 @@ require 'assonnato'
|
|
|
17
17
|
class Descartes
|
|
18
18
|
class Pigro
|
|
19
19
|
include Cinch::Plugin
|
|
20
|
-
match /
|
|
20
|
+
match /show (.+)/
|
|
21
|
+
|
|
22
|
+
def execute(m, keyword)
|
|
23
|
+
s = keyword.split
|
|
24
|
+
n_ep = s.last.numeric? ? s.pop : nil
|
|
25
|
+
keyword = s.join
|
|
21
26
|
|
|
22
|
-
def execute(m, keyword, n_ep)
|
|
23
27
|
host = get_host 'pigro.txt'
|
|
24
|
-
|
|
28
|
+
shows = Assonnato::Show.new host
|
|
25
29
|
episodes = Assonnato::Episode.new host
|
|
26
30
|
|
|
31
|
+
series = shows.search! keyword
|
|
32
|
+
|
|
27
33
|
if series.empty?
|
|
28
34
|
m.reply 'Series not found'
|
|
29
35
|
return
|
|
30
36
|
end
|
|
31
37
|
|
|
32
38
|
series.each { |s|
|
|
33
|
-
|
|
34
|
-
m.reply ''.tap { |staff|
|
|
35
|
-
{
|
|
36
|
-
:Translator => s.translator,
|
|
37
|
-
:Editor => s.editor,
|
|
38
|
-
:Checker => s.checker,
|
|
39
|
-
:Timer => s.timer,
|
|
40
|
-
:Typesetter => s.typesetter,
|
|
41
|
-
:Encoder => s.encoder,
|
|
42
|
-
:QC => s.qchecker
|
|
43
|
-
}.each_pair { |key, val|
|
|
44
|
-
staff << "#{key.to_s.colorize}: #{val} / " unless val.empty?
|
|
45
|
-
}
|
|
46
|
-
}[0..-4]
|
|
39
|
+
show = shows.get!(s.name).first
|
|
47
40
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
m.reply
|
|
41
|
+
if n_ep.nil?
|
|
42
|
+
m.reply "#{show.name.colorize} (#{show.status} series of #{show.tot_episodes} episodes airing #{show.airing})"
|
|
43
|
+
m.reply ''.tap { |staff|
|
|
51
44
|
{
|
|
52
|
-
:
|
|
53
|
-
:
|
|
54
|
-
:
|
|
55
|
-
:
|
|
56
|
-
:
|
|
57
|
-
:
|
|
58
|
-
:QC
|
|
45
|
+
:Translator => show.translator,
|
|
46
|
+
:Editor => show.editor,
|
|
47
|
+
:Checker => show.checker,
|
|
48
|
+
:Timer => show.timer,
|
|
49
|
+
:Typesetter => show.typesetter,
|
|
50
|
+
:Encoder => show.encoder,
|
|
51
|
+
:QC => show.qchecker
|
|
59
52
|
}.each_pair { |key, val|
|
|
60
|
-
staff << "#{key.to_s.colorize}: #{val
|
|
53
|
+
staff << "#{key.to_s.colorize}: #{val} / " unless val.empty?
|
|
61
54
|
}
|
|
62
|
-
staff << 'Download'.colorize + ": #{ep.download}" if ep.download
|
|
63
55
|
}[0..-4]
|
|
64
|
-
|
|
56
|
+
else
|
|
57
|
+
eps = episodes.get! show.name, n_ep.to_i
|
|
58
|
+
eps.each { |ep|
|
|
59
|
+
m.reply "Episode #{ep.episode} - ".colorize.tap { |staff|
|
|
60
|
+
{
|
|
61
|
+
:Translation => ep.translation,
|
|
62
|
+
:Editing => ep.editing,
|
|
63
|
+
:Check => ep.checking,
|
|
64
|
+
:Timing => ep.timing,
|
|
65
|
+
:Typesetting => ep.typesetting,
|
|
66
|
+
:Encoding => ep.encoding,
|
|
67
|
+
:QC => ep.qchecking
|
|
68
|
+
}.each_pair { |key, val|
|
|
69
|
+
staff << "#{key.to_s.colorize}: #{val ? 'gg' : 'nope'} / "
|
|
70
|
+
}
|
|
71
|
+
staff << 'Download'.colorize + ": #{ep.download}" unless ep.download.strip.empty?
|
|
72
|
+
}[0..-4]
|
|
73
|
+
}
|
|
74
|
+
end
|
|
65
75
|
}
|
|
66
76
|
end
|
|
67
77
|
|
|
68
78
|
def get_host(f)
|
|
69
|
-
file = File.join
|
|
70
|
-
|
|
79
|
+
file = File.join $options[:dotfiles], f
|
|
80
|
+
|
|
81
|
+
if File.exists? file
|
|
82
|
+
url = File.read(file).strip
|
|
83
|
+
return url unless url.empty?
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
'http://pigro.omnivium.it:4567'
|
|
71
87
|
end
|
|
72
88
|
end
|
|
73
89
|
end
|
|
@@ -19,7 +19,7 @@ class Descartes
|
|
|
19
19
|
match /.*\?/, :prefix => lambda { |m| m.bot.nick }
|
|
20
20
|
|
|
21
21
|
def execute(m)
|
|
22
|
-
file
|
|
22
|
+
file = File.join $options[:dotfiles], 'replies.txt'
|
|
23
23
|
m.reply [].tap { |ary|
|
|
24
24
|
File.read(file).each_line { |line| ary << line unless line.strip.empty? }
|
|
25
25
|
}.sample
|
|
@@ -19,7 +19,7 @@ class Descartes
|
|
|
19
19
|
match 'Sindaco'
|
|
20
20
|
|
|
21
21
|
def execute(m)
|
|
22
|
-
file = File.
|
|
22
|
+
file = File.join $options[:dotfiles], 'sindaco.txt'
|
|
23
23
|
m.reply [].tap { |ary|
|
|
24
24
|
File.read(file).each_line { |line| ary << line unless line.strip.empty? }
|
|
25
25
|
}.sample
|
data/lib/descartes/utils.rb
CHANGED
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.6'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Giovanni Capuano
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2014-01-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: cinch
|