ayadn 2.0.3 → 2.0.4

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: 1b19a3dc1aa12adf7b39f48f5d49556057c486b9
4
- data.tar.gz: 80c36b97acf3d121c3eb47a155cf151ebb330567
3
+ metadata.gz: 8b5f20d344841d76ea6958dcb51032bfed8992ec
4
+ data.tar.gz: 5ab42f2b2eb18f2713ed4b8ce191d5a833f3da96
5
5
  SHA512:
6
- metadata.gz: 85f82405d3fa6d68e3fc7596b7744c02cd4006217ed75229c7ead7eb2705ec8d75b572854f4dbd97e148ffaf4aa946f086f0ef96647ca696fd499cc99dd79a1c
7
- data.tar.gz: 7f79f25d7bd8425eae96214416c0b5e414a454e41d262c84bb5a0d337f5779c1cc8e908dd71d4fc6f75b6b3d292578730364ea0edf745828fe5ff112e8cfa73f
6
+ metadata.gz: ad72ea71606ddee934d7d6c1a6ac9508bfe2f0c88a893a7a86462fa43409081626270d0241d302b393d679e0fef3a43ec7d6365e7f4379655dd9ea2874f5bbe5
7
+ data.tar.gz: dfd9d769dcd06f22ba4a68309308aa7a9133d2d2d6882485fc99c7f5b5ae873595ea4ee1a528aef0ce943435d4685a225b123ce5c89b5505c920bda6f6cfac13
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 2.0.4 - 2014-11-30 - 'The Penguin'
2
+
3
+ - Fix: nowplaying iTunes Store requests
4
+ - Fix: unread messages displayed from oldest to newest
5
+
1
6
  ## 2.0.3 - 2014-11-18 - 'Dexter'
2
7
 
3
8
  - Fix: title of a pinned post
data/lib/ayadn/action.rb CHANGED
@@ -569,7 +569,7 @@ module Ayadn
569
569
  exit
570
570
  end
571
571
  unread_messages = {}
572
- unread_channels.each do |id|
572
+ unread_channels.reverse.each do |id|
573
573
  @thor.say_status :downloading, "messages from channel #{id}"
574
574
  since = Databases.find_last_id_from("channel:#{id}")
575
575
  unless since.nil?
@@ -179,40 +179,9 @@ module Ayadn
179
179
 
180
180
  def get_itunes_store url, artist, track
181
181
  results = JSON.load(CNX.download(URI.escape(url)))['results']
182
- # puts results.inspect
183
- unless results.empty? || results.nil?
184
- # results.each {|obj| puts obj['trackName']}
185
- # puts "-"
186
- # puts track
187
- one = results.select do |obj|
188
- next if obj['trackName'].nil?
189
- obj['trackName'].downcase == track.downcase
190
- end
191
- # puts one.inspect
192
- if one.empty?
193
- by_artist = results.select do |obj|
194
- next if obj['artistName'].nil?
195
- obj['artistName'].downcase == artist.downcase
196
- end
197
- # puts by_artist
198
- by_exact_track = by_artist.select do |obj|
199
- next if obj['trackName'].nil?
200
- obj['trackName'].downcase == track.downcase
201
- end
202
- # puts by_exact_track
203
- if by_exact_track.empty?
204
- splitted = track.split(" ").first.downcase
205
- results = by_artist.select do |obj|
206
- next if obj['trackName'].nil?
207
- obj['trackName'].split(" ").first.downcase == splitted
208
- end
209
- else
210
- results = by_exact_track
211
- end
212
182
 
213
- else
214
- results = one
215
- end
183
+ # puts results.inspect
184
+ unless results.nil?
216
185
 
217
186
  if results.empty?
218
187
  return {
@@ -221,7 +190,19 @@ module Ayadn
221
190
  }
222
191
  end
223
192
 
224
- candidate = results[0]
193
+ candidates = []
194
+ candidates_track = results.map { |e| e if e['trackName'].downcase == track.downcase }.compact
195
+ candidates_track.each do |e|
196
+ next if e['artistName'].nil?
197
+ candidates << e if e['artistName'].downcase == artist.downcase
198
+ end
199
+ # require "pp";pp candidates; exit
200
+
201
+ candidate = if candidates.empty?
202
+ results[0]
203
+ else
204
+ candidates[0]
205
+ end
225
206
 
226
207
  return {
227
208
  'code' => 200,
data/lib/ayadn/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Ayadn
3
- VERSION = "2.0.3"
3
+ VERSION = "2.0.4"
4
4
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ayadn
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Dejonckheere
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-22 00:00:00.000000000 Z
11
+ date: 2014-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor