descartes 0.8.1 → 0.8.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7ca9b9e3baf55da5539912aa9ca2fe222c5d3e2
4
- data.tar.gz: 01554e38cb57e0fb662a29eb08f17dc991113878
3
+ metadata.gz: 9fde5d438495d6be05885ffca91155325cdfaaff
4
+ data.tar.gz: 5fa4dc848dc33e44cbdd3b303a5d270437bcc075
5
5
  SHA512:
6
- metadata.gz: e43a29174ba4f7140232908de99b1406dffa0784f8c56cb143a083ddbd5e4e713102a911330db49b48a706388a793cbee0915c6098e3ed852d9a482153064aa0
7
- data.tar.gz: b51620248ac7d14500ed38192f1ff661692870e44b31a5ea7d5300d1f03f475ff6dfc25d26ffa3284d51b28cd33b99c33f5d6b302a5b39f581209148a9d65f34
6
+ metadata.gz: bbd0dbaf5f17abe1ea0d79de76b28ff7ae5c173e3cafdc9622ea2d69a26cacc6d8b7082a1e08934e42741d681e5d1a148720db982dc44700e4fb622f2c2074de
7
+ data.tar.gz: 1f1f27d7f379be6862345b5988d69119c85e616cc00b201955b3bde9f94b427d4b7b2ef37ae5117fca7d00c8520a51ce5f38cbd3f9069cd86ec2da99f3e0d556
@@ -159,12 +159,37 @@ class Descartes
159
159
  end
160
160
  end
161
161
 
162
- match /pigro (.+) - (.+) - (.+) - (.+)/, method: :edit_episode
163
- def edit_episode(m, show, episode, field, status)
164
- user = get_user m.user.nick
162
+ match /pigro (.+)/, method: :edit_episode
163
+ def edit_episode(m, things)
164
+ if not m.user.authed?
165
+ m.reply 'You have to login first.'
166
+ return
167
+ end
168
+
169
+ things = things.split ' '
170
+ len = things.length
171
+ status = things.pop
172
+ field = things.pop
173
+ episode = things.pop
174
+ show = things.join ' '
175
+
176
+ if len < 4 || !episode.numeric?
177
+ m.reply 'usage: !pigro SHOW EPISODE FIELD STATUS'
178
+ return
179
+ end
180
+
165
181
  host = get_host
182
+ user = get_user m.user.nick
166
183
  assonnato = Assonnato.new host
167
184
 
185
+ series = assonnato.show.search show
186
+ if series.length != 1
187
+ m.reply 'You should refine your search.'
188
+ return
189
+ else
190
+ show = series.first.name
191
+ end
192
+
168
193
  if user
169
194
  login = assonnato.user.login user['username'], user['password']
170
195
  if login['status'] == 'error'
@@ -185,7 +210,9 @@ class Descartes
185
210
 
186
211
  if File.exists? file
187
212
  users = JSON.parse File.read(file)
188
- users.select { |user| user['nicknames'].first.values.include? nickname }.last
213
+ users.select { |user|
214
+ user['nicknames'].select { |n| n['nickname'] == nickname }
215
+ }.last
189
216
  else
190
217
  false
191
218
  end
@@ -14,6 +14,6 @@
14
14
 
15
15
  class Descartes
16
16
  def self.version
17
- '0.8.1'
17
+ '0.8.2'
18
18
  end
19
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: descartes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Capuano