ayadn 1.5.0 → 1.5.1

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: 6f4900ba881aee8b2b3ce277facfb6e86f7972b7
4
- data.tar.gz: 4a52cad511fce5df653f55b54f4684d9e85071d8
3
+ metadata.gz: c27895d681609f9415e70476330ed879ab1e9593
4
+ data.tar.gz: bbf4d6af209533db1571875e09a879a275f27547
5
5
  SHA512:
6
- metadata.gz: 782007aa8e67ef39f173ac53ddd3d65c5ab2b3bca03b5b7dc9978da8a3ced9fa09f1865ae4bd20a15e0c553379a58c91cb3fc79dd1abb9bc24af4eb7bea3e795
7
- data.tar.gz: 397da912926f39f5ebfeb238ee2e3b920eabf8706b0bb86353a88e3c3dd15e6173d073654a2943fd5ca63b3036111e7b42417cf4323dfa19be9e9b43e6554350
6
+ metadata.gz: 5148331842c2bae97ebc53a6294f9395a970640c9900729ba4b6f68cd7cbb28683dcbec22477556cf924645e2418d3f407461ce16890c44318e24a4cafadeb95
7
+ data.tar.gz: 829b10f92d7e55c02fdf8c125b212c635ed75a7b8846df2fdb1b0cc1cf570e75020ea0e77259aab8cbefda8e483b149b00577c212c6bcf956e424607c4edf3a2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.5.1 - 'Holograms'
2
+
3
+ - Improved accuracy of iTunes Store requests for NowPlaying
4
+
1
5
  # 1.5.0 - 'Nozomi'
2
6
 
3
7
  - In 'convo', both the post id you've requested and the post it replies to are marked with arrows
data/lib/ayadn/action.rb CHANGED
@@ -969,19 +969,22 @@ module Ayadn
969
969
  def itunes_istore_request itunes
970
970
  infos = itunes_reg([itunes.artist, itunes.track, itunes.album])
971
971
  itunes_url = "https://itunes.apple.com/search?term=#{infos[0]}&term=#{infos[1]}&term=#{infos[2]}&media=music&entity=musicTrack"
972
- get_itunes_store(itunes_url)
972
+ get_itunes_store(itunes_url, itunes.artist, itunes.track)
973
973
  end
974
974
 
975
975
  def lastfm_istore_request artist, track
976
976
  infos = itunes_reg([artist, track])
977
977
  itunes_url = "https://itunes.apple.com/search?term=#{infos[0]}&term=#{infos[1]}&media=music&entity=musicTrack"
978
- get_itunes_store(itunes_url)
978
+ get_itunes_store(itunes_url, artist, track)
979
979
  end
980
980
 
981
- def get_itunes_store url
981
+ def get_itunes_store url, artist, track
982
982
  results = JSON.load(CNX.download(URI.escape(url)))['results']
983
983
  unless results.empty? || results.nil?
984
- candidate = results[0]
984
+
985
+ resp = results.select {|obj| obj['artistName'] == artist && obj['trackName'] == track}
986
+ candidate = resp[0] || results[0]
987
+
985
988
  return {
986
989
  'code' => 200,
987
990
  'artist' => candidate['artistName'],
data/lib/ayadn/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Ayadn
3
- VERSION = "1.5.0"
3
+ VERSION = "1.5.1"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ayadn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Dejonckheere