descartes 0.7.6 → 0.7.7

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: a36a86990e396c36c4a52701705f388c0a249e91
4
- data.tar.gz: d31c1fd9bf0bbb647f567f415b264317db92060d
3
+ metadata.gz: aa24e3fe9b0658199bcda4a7b76ca63bb49b0c4a
4
+ data.tar.gz: b906bdb3f2fd49cc6a5f6d51a8c05a7e3d34dfc4
5
5
  SHA512:
6
- metadata.gz: 4fe92d70797c6473af7ce6c78334429a2927c3e7d9f09564ee392d186b057beb20f4d6ff93b253a81ed01c2781c5876e827595272a3c76230c592bfd0e0a7f1c
7
- data.tar.gz: 30957bb4538fd40c361e8597f6ab94b50ca77614ccd1356cd7428d1468ad960192bf65c380ec4bc429a921e11c0cd385fc08fff2dd0da1fe18a434a24fe776c7
6
+ metadata.gz: e21fc1ff1cde7b46c0c901296e4b910d192eb0dd2a32afa56a1d9346a34f3a7c3a9ef4677b572cfd33d15cae30e59d23a695cf5a8a56dc0cd5fb8285bdc2e234
7
+ data.tar.gz: d011db6dcb203e2d153415deedba3fdb9de9cd8252fb4821d291995134d51899134705e865c5c0a26eb3d09a53f234773265ad439c6edcaa9c69642c644ed39f
@@ -28,7 +28,7 @@ class Descartes
28
28
  m.reply "Gli anime di oggi su #{'Crunchyroll'.colorize}:"
29
29
 
30
30
  not_aired.each { |series|
31
- m.reply "#{series[:title].colorize} (tra #{series[:left].to_ita.colorize})."
31
+ m.reply "#{series[:title].colorize} (tra #{series[:left].to_ita.colorize})"
32
32
  }
33
33
 
34
34
  m.reply "Sono stati già trasmessi: #{already_aired}."
@@ -17,18 +17,17 @@ require 'assonnato'
17
17
  class Descartes
18
18
  class Pigro
19
19
  include Cinch::Plugin
20
- match /show (.+)/
21
- match /staff (.+)/, method: :by_staff
22
20
 
21
+ match /staff (.+)/, method: :by_staff
23
22
  def by_staff(m, user)
24
- user = user.split(' ')
23
+ user = user.split
25
24
  role = user.last.to_sym.downcase
26
25
 
27
26
  if [ :translator, :editor, :checker, :timer, :typesetter, :encoder, :qchecker ].include? role
28
27
  user.pop
29
- options = { user: user.join(' '), role: role }
28
+ options = { user: user.join, role: role }
30
29
  else
31
- options = { user: user.join(' ') }
30
+ options = { user: user.join }
32
31
  end
33
32
 
34
33
  host = get_host 'pigro.txt'
@@ -58,10 +57,11 @@ class Descartes
58
57
  }[0..-3]
59
58
  end
60
59
 
61
- def execute(m, keyword)
62
- s = keyword.split ' '
63
- n_ep = s.last.numeric? ? s.pop : nil
64
- keyword = s.join ' '
60
+ match /show (.+)/, method: :by_show
61
+ def by_show(m, keyword)
62
+ s = keyword.split
63
+ n_ep = (s.last == 'last' || s.last.numeric?) ? s.pop : nil
64
+ keyword = s.join
65
65
 
66
66
  host = get_host 'pigro.txt'
67
67
  shows = Assonnato::Show.new host
@@ -70,43 +70,40 @@ class Descartes
70
70
  series = shows.search! keyword
71
71
 
72
72
  if series.empty?
73
- m.reply 'Series not found'
74
- return
75
- end
76
-
77
- series.take(5).each { |s|
78
- show = shows.get!(s.name).first
79
-
80
- if n_ep.nil?
81
- a = show.status.downcase.start_with?(?o) ? 'an' : ?a
82
- m.reply "[#{show.fansub.colorize}] #{show.name.colorize} is #{a} #{show.status} series of #{show.tot_episodes.colorize} episodes."
83
- m.reply ''.tap { |staff|
84
- {
85
- :Translator => show.translator,
86
- :Editor => show.editor,
87
- :Checker => show.checker,
88
- :Timer => show.timer,
89
- :Typesetter => show.typesetter,
90
- :Encoder => show.encoder,
91
- :QC => show.qchecker
92
- }.each_pair { |key, val|
93
- staff << "#{key.to_s.colorize}: #{val} / " unless val.empty?
94
- }
95
- }[0..-4]
96
- else
97
- episodes = episodes.get! show.name, n_ep.to_i
73
+ m.reply 'Series not found.'
74
+ else
75
+ series.take(5).each { |s|
76
+ show = shows.get!(s.name).first
77
+
78
+ if n_ep.nil?
79
+ a = show.status.downcase.start_with?(?o) ? 'an' : ?a
80
+ m.reply "[#{show.fansub.colorize}] #{show.name.colorize} is #{a} #{show.status} series of #{show.tot_episodes.colorize} episodes."
81
+ m.reply ''.tap { |staff|
82
+ {
83
+ :Translator => show.translator,
84
+ :Editor => show.editor,
85
+ :Checker => show.checker,
86
+ :Timer => show.timer,
87
+ :Typesetter => show.typesetter,
88
+ :Encoder => show.encoder,
89
+ :QC => show.qchecker
90
+ }.each_pair { |key, val|
91
+ staff << "#{key.to_s.colorize}: #{val} / " unless val.empty?
92
+ }
93
+ }[0..-4]
94
+ elsif n_ep == 'last'
95
+ episode = episodes.last!(:ongoing).select { |ep| ep.show_name == s.name }.last
98
96
 
99
- if episodes.any?
100
- episodes.each { |ep|
101
- m.reply ("#{show.name.colorize} ##{ep.episode}".colorize + ' - ').tap { |staff|
97
+ if episode
98
+ m.reply ("#{show.name.colorize} ##{episode.episode}".colorize + ' - ').tap { |staff|
102
99
  activities = {
103
- :Translation => ep.translation,
104
- :Editing => ep.editing,
105
- :Check => ep.checking,
106
- :Timing => ep.timing,
107
- :Typesetting => ep.typesetting,
108
- :Encoding => ep.encoding,
109
- :QC => ep.qchecking
100
+ :Translation => episode.translation,
101
+ :Editing => episode.editing,
102
+ :Check => episode.checking,
103
+ :Timing => episode.timing,
104
+ :Typesetting => episode.typesetting,
105
+ :Encoding => episode.encoding,
106
+ :QC => episode.qchecking
110
107
  }
111
108
 
112
109
  if activities.select { |k, v| v != :done }.any?
@@ -118,16 +115,47 @@ class Descartes
118
115
  else
119
116
  staff << 'Already released. '
120
117
  end
121
- staff << "#{'Download'.colorize}: #{ep.download}" unless ep.download.strip.empty?
118
+ staff << "#{'Download'.colorize}: #{episode.download}" unless episode.download.strip.empty?
122
119
  }
123
- }
124
- elsif n_ep.to_i > show.tot_episodes
125
- m.reply "#{m.user.nick.colorize} pls go and http://just-believe.in."
120
+ else
121
+ m.reply "#{show.name.colorize} has no episodes yet."
122
+ end
126
123
  else
127
- m.reply "The episode #{n_ep.colorize} has not been added yet to #{show.name.colorize}."
124
+ episodes = episodes.get! show.name, n_ep.to_i
125
+
126
+ if episodes.any?
127
+ episodes.each { |ep|
128
+ m.reply ("#{show.name.colorize} ##{ep.episode}".colorize + ' - ').tap { |staff|
129
+ activities = {
130
+ :Translation => ep.translation,
131
+ :Editing => ep.editing,
132
+ :Check => ep.checking,
133
+ :Timing => ep.timing,
134
+ :Typesetting => ep.typesetting,
135
+ :Encoding => ep.encoding,
136
+ :QC => ep.qchecking
137
+ }
138
+
139
+ if activities.select { |k, v| v != :done }.any?
140
+ staff << ''.tap { |s|
141
+ activities.each_pair { |key, val|
142
+ s << "#{key.to_s.colorize}: #{val} / "
143
+ }
144
+ }[0..-3]
145
+ else
146
+ staff << 'Already released. '
147
+ end
148
+ staff << "#{'Download'.colorize}: #{ep.download}" unless ep.download.strip.empty?
149
+ }
150
+ }
151
+ elsif n_ep.to_i > show.tot_episodes
152
+ m.reply "#{m.user.nick.colorize} pls go and http://just-believe.in."
153
+ else
154
+ m.reply "The episode #{n_ep.colorize} has not been added yet to #{show.name.colorize}."
155
+ end
128
156
  end
129
- end
130
- }
157
+ }
158
+ end
131
159
  end
132
160
 
133
161
  def get_host(f)
@@ -14,6 +14,6 @@
14
14
 
15
15
  class Descartes
16
16
  def self.version
17
- '0.7.6'
17
+ '0.7.7'
18
18
  end
19
19
  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.7.6
4
+ version: 0.7.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Capuano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-20 00:00:00.000000000 Z
11
+ date: 2014-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cinch