From: Ben Beltran Date: Sat, 6 Oct 2012 16:56:32 +0000 (-0500) Subject: Fixes stuff for ruby 1.8 support X-Git-Url: https://git.r.bdr.sh/rbdr/lyricli.rb/commitdiff_plain/178ffe1377a571b7ce0a73186c03b5e296ac8922?ds=sidebyside Fixes stuff for ruby 1.8 support NOTE: Rdio doesn't work in 1.8 :( --- diff --git a/lib/lyricli.rb b/lib/lyricli.rb index 8287144..31571c8 100755 --- a/lib/lyricli.rb +++ b/lib/lyricli.rb @@ -1,4 +1,5 @@ require 'uri' +require 'cgi' require 'net/http' require 'multi_json' require 'nokogiri' diff --git a/lib/lyricli/sources/arguments.rb b/lib/lyricli/sources/arguments.rb index 150c70a..e35aaec 100644 --- a/lib/lyricli/sources/arguments.rb +++ b/lib/lyricli/sources/arguments.rb @@ -27,7 +27,7 @@ module Lyricli def current_track artist = ARGV[0] song = ARGV[1] - {artist: artist, song: song} + {:artist => artist, :song => song} end # The reset method resets any configurations it may have diff --git a/lib/lyricli/sources/itunes.rb b/lib/lyricli/sources/itunes.rb index 2bfe471..e9a3f49 100644 --- a/lib/lyricli/sources/itunes.rb +++ b/lib/lyricli/sources/itunes.rb @@ -29,7 +29,7 @@ module Lyricli path = File.join(path_root, @script) current = `osascript #{path}` current = current.split("<-SEP->") - {artist: current[0], song: current[1]} + {:artist => current[0], :song => current[1]} end # The reset method resets any configurations it may have diff --git a/lib/lyricli/sources/rdio.rb b/lib/lyricli/sources/rdio.rb index d34795f..76d0ed1 100644 --- a/lib/lyricli/sources/rdio.rb +++ b/lib/lyricli/sources/rdio.rb @@ -40,7 +40,7 @@ module Lyricli response = @rdio.call('currentUser', {'extras' => 'lastSongPlayed'}) artist = response["result"]["lastSongPlayed"]["artist"] song = response["result"]["lastSongPlayed"]["name"] - {artist: artist, song: song} + {:artist => artist, :song => song} end # The reset method resets any configurations it may have diff --git a/lib/lyricli/util.rb b/lib/lyricli/util.rb index e7320d0..b8b0186 100644 --- a/lib/lyricli/util.rb +++ b/lib/lyricli/util.rb @@ -30,7 +30,7 @@ module Lyricli # @param [String] p the parameter to be sanitized # @return [String] the sanitized parameter def sanitize_param(p) - URI.encode_www_form_component(p.gsub(/ /, "+")).gsub("%2B", "+") + CGI.escape(p.gsub(/ /, "+")).gsub("%2B", "+") end end end diff --git a/lyricli-0.0.1.gem b/lyricli-0.0.1.gem index f37ca37..3dc9459 100644 Binary files a/lyricli-0.0.1.gem and b/lyricli-0.0.1.gem differ