ayadn 1.4.0 → 1.4.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 +14 -6
 - data/lib/ayadn/fileops.rb +2 -1
 - data/lib/ayadn/post.rb +1 -3
 - 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: 08a202fea9f47db0c64d1c9d0b1a12b809a25650
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: f620955c6f10034e69ee9969e51e1601d146275e
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 9790a6fdc3958a4329ac873d3aefeddbe86291215eca8e07cd8b863903673721062d166d2ff876703447b28902b1970c17c14679acc5e21ec780baa5209220b5
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: b167b9aae1d9f9535a380dd51d96823efd375356465ee055aeefe6b27c01d32a769e8755bc085875784864bfaf24aeb59293824468ddb41da26f9891b1a2ee07
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/lib/ayadn/action.rb
    CHANGED
    
    | 
         @@ -932,7 +932,11 @@ module Ayadn 
     | 
|
| 
       932 
932 
     | 
    
         
             
                    @view.show_posted(Post.new.send_nowplaying(dic))
         
     | 
| 
       933 
933 
     | 
    
         
             
                  rescue => e
         
     | 
| 
       934 
934 
     | 
    
         
             
                    puts Status.wtf
         
     | 
| 
       935 
     | 
    
         
            -
                     
     | 
| 
      
 935 
     | 
    
         
            +
                    if options['no_url']
         
     | 
| 
      
 936 
     | 
    
         
            +
                      Errors.global_error("action/nowplaying", itunes, e)
         
     | 
| 
      
 937 
     | 
    
         
            +
                    else
         
     | 
| 
      
 938 
     | 
    
         
            +
                      Errors.global_error("action/nowplaying", [itunes, store, options], e)
         
     | 
| 
      
 939 
     | 
    
         
            +
                    end
         
     | 
| 
       936 
940 
     | 
    
         
             
                  end
         
     | 
| 
       937 
941 
     | 
    
         
             
                end
         
     | 
| 
       938 
942 
     | 
    
         | 
| 
         @@ -972,11 +976,8 @@ module Ayadn 
     | 
|
| 
       972 
976 
     | 
    
         
             
                private
         
     | 
| 
       973 
977 
     | 
    
         | 
| 
       974 
978 
     | 
    
         
             
                def itunes_request itunes
         
     | 
| 
       975 
     | 
    
         
            -
                   
     | 
| 
       976 
     | 
    
         
            -
                   
     | 
| 
       977 
     | 
    
         
            -
                  store_track = itunes.track.gsub(regex_exotics, ' ').split(' ').join('+')
         
     | 
| 
       978 
     | 
    
         
            -
                  #store_album = itunes.album.gsub(regex_exotics, ' ').split(' ').join('+')
         
     | 
| 
       979 
     | 
    
         
            -
                  itunes_url = "https://itunes.apple.com/search?term=#{store_artist}&term=#{store_track}&media=music&entity=musicTrack"
         
     | 
| 
      
 979 
     | 
    
         
            +
                  infos = itunes_reg([itunes.artist, itunes.track, itunes.album])
         
     | 
| 
      
 980 
     | 
    
         
            +
                  itunes_url = "https://itunes.apple.com/search?term=#{infos[0]}&term=#{infos[1]}&term=#{infos[2]}&media=music&entity=musicTrack"
         
     | 
| 
       980 
981 
     | 
    
         
             
                  results = JSON.load(CNX.download(itunes_url))['results']
         
     | 
| 
       981 
982 
     | 
    
         
             
                  candidate = results[0]
         
     | 
| 
       982 
983 
     | 
    
         
             
                  {
         
     | 
| 
         @@ -989,6 +990,13 @@ module Ayadn 
     | 
|
| 
       989 
990 
     | 
    
         
             
                  }
         
     | 
| 
       990 
991 
     | 
    
         
             
                end
         
     | 
| 
       991 
992 
     | 
    
         | 
| 
      
 993 
     | 
    
         
            +
                def itunes_reg arr_of_itunes
         
     | 
| 
      
 994 
     | 
    
         
            +
                  regex_exotics = /[~:-;,?!\'&`^=+<>*%()\/"“”’°£$€.…]/
         
     | 
| 
      
 995 
     | 
    
         
            +
                  arr_of_itunes.map do |itune|
         
     | 
| 
      
 996 
     | 
    
         
            +
                    itune.gsub(regex_exotics, ' ').split(' ').join('+')
         
     | 
| 
      
 997 
     | 
    
         
            +
                  end
         
     | 
| 
      
 998 
     | 
    
         
            +
                end
         
     | 
| 
      
 999 
     | 
    
         
            +
             
     | 
| 
       992 
1000 
     | 
    
         
             
                def splitter_all words
         
     | 
| 
       993 
1001 
     | 
    
         
             
                  [words].collect {|w| w.split(' ')}
         
     | 
| 
       994 
1002 
     | 
    
         
             
                end
         
     | 
    
        data/lib/ayadn/fileops.rb
    CHANGED
    
    | 
         @@ -43,7 +43,8 @@ module Ayadn 
     | 
|
| 
       43 
43 
     | 
    
         | 
| 
       44 
44 
     | 
    
         
             
                def self.upload(path, token)
         
     | 
| 
       45 
45 
     | 
    
         
             
                  begin
         
     | 
| 
       46 
     | 
    
         
            -
                     
     | 
| 
      
 46 
     | 
    
         
            +
                    temp = Regexp.escape(path).gsub('\.', '.')
         
     | 
| 
      
 47 
     | 
    
         
            +
                    file = temp.gsub('\-', '-')
         
     | 
| 
       47 
48 
     | 
    
         
             
                    case File.extname(path).downcase
         
     | 
| 
       48 
49 
     | 
    
         
             
                    when ".png"
         
     | 
| 
       49 
50 
     | 
    
         
             
                      `curl -k -H 'Authorization: BEARER #{token}' https://api.app.net/files -F 'type=com.ayadn.files' -F "content=@#{file};type=image/png" -F 'public=true' -X POST`
         
     | 
    
        data/lib/ayadn/post.rb
    CHANGED
    
    | 
         @@ -42,9 +42,7 @@ module Ayadn 
     | 
|
| 
       42 
42 
     | 
    
         
             
                end
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
44 
     | 
    
         
             
                def send_pm_embedded_pictures dic
         
     | 
| 
       45 
     | 
    
         
            -
                   
     | 
| 
       46 
     | 
    
         
            -
                  url << "?include_annotations=1&access_token=#{Ayadn::Settings.user_token}"
         
     | 
| 
       47 
     | 
    
         
            -
                  send_content(url, payload_pm_embedded(dic))
         
     | 
| 
      
 45 
     | 
    
         
            +
                  send_content(Endpoints.new.pm_url, payload_pm_embedded(dic))
         
     | 
| 
       48 
46 
     | 
    
         
             
                end
         
     | 
| 
       49 
47 
     | 
    
         | 
| 
       50 
48 
     | 
    
         
             
                def send_nowplaying dic
         
     | 
    
        data/lib/ayadn/version.rb
    CHANGED