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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/ayadn/action.rb +7 -4
- data/lib/ayadn/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: c27895d681609f9415e70476330ed879ab1e9593
         | 
| 4 | 
            +
              data.tar.gz: bbf4d6af209533db1571875e09a879a275f27547
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 5148331842c2bae97ebc53a6294f9395a970640c9900729ba4b6f68cd7cbb28683dcbec22477556cf924645e2418d3f407461ce16890c44318e24a4cafadeb95
         | 
| 7 | 
            +
              data.tar.gz: 829b10f92d7e55c02fdf8c125b212c635ed75a7b8846df2fdb1b0cc1cf570e75020ea0e77259aab8cbefda8e483b149b00577c212c6bcf956e424607c4edf3a2
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        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 | 
            -
             | 
| 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