rdio-cli 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CONTRIBUTING.md +2 -2
- data/bin/rdio +23 -1
- data/lib/rdio.rb +28 -2
- data/lib/rdio/version.rb +1 -1
- metadata +3 -3
data/CONTRIBUTING.md
CHANGED
@@ -6,9 +6,9 @@ improve this project.
|
|
6
6
|
1. [Fork the repository.][fork]
|
7
7
|
2. [Create a topic branch.][branch]
|
8
8
|
3. Add specs for your unimplemented feature or bug fix.
|
9
|
-
4. Run `
|
9
|
+
4. Run `script/test`. If your specs pass, return to step 3.
|
10
10
|
5. Implement your feature or bug fix.
|
11
|
-
6. Run `
|
11
|
+
6. Run `script/test`. If your specs fail, return to step 5.
|
12
12
|
7. Add, commit, and push your changes.
|
13
13
|
8. [Submit a pull request.][pr]
|
14
14
|
|
data/bin/rdio
CHANGED
@@ -1,4 +1,26 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'rdio'
|
3
3
|
|
4
|
-
|
4
|
+
trap "SIGINT" do
|
5
|
+
exit 0
|
6
|
+
end
|
7
|
+
|
8
|
+
trap "INT" do
|
9
|
+
exit 0
|
10
|
+
end
|
11
|
+
|
12
|
+
if ARGV[0] == 'console'
|
13
|
+
loop do
|
14
|
+
print '> '
|
15
|
+
input = $stdin.gets.chomp
|
16
|
+
|
17
|
+
if input == 'exit'
|
18
|
+
exit
|
19
|
+
else
|
20
|
+
args = input.split(' ')
|
21
|
+
Rdio.run(args)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
else
|
25
|
+
Rdio.run(ARGV)
|
26
|
+
end
|
data/lib/rdio.rb
CHANGED
@@ -21,7 +21,7 @@ module Rdio
|
|
21
21
|
|
22
22
|
def self.api
|
23
23
|
token = @access_token ? [@access_token, @access_secret] : nil
|
24
|
-
@api
|
24
|
+
@api ||= Api.new \
|
25
25
|
[@consumer_key, @consumer_secret],
|
26
26
|
token
|
27
27
|
end
|
@@ -40,7 +40,7 @@ module Rdio
|
|
40
40
|
|
41
41
|
def self.lyrics_for(artist, title)
|
42
42
|
uri = URI('http://makeitpersonal.co/lyrics')
|
43
|
-
params = { :artist => artist, :title => title }
|
43
|
+
params = { :artist => artist.gsub(/[<>]/, ' '), :title => title.gsub(/[<>]/, ' ') }
|
44
44
|
uri.query = URI.encode_www_form(params)
|
45
45
|
|
46
46
|
res = Net::HTTP.get_response(uri)
|
@@ -126,6 +126,22 @@ module Rdio
|
|
126
126
|
api.call 'addToCollection', { :keys => tracks.join(',') }
|
127
127
|
end
|
128
128
|
|
129
|
+
def self.add_friend(vanity_or_email)
|
130
|
+
if vanity_or_email.include? "@"
|
131
|
+
data = api.call 'findUser', { :email => vanity_or_email }
|
132
|
+
else
|
133
|
+
data = api.call 'findUser', { :vanityName => vanity_or_email }
|
134
|
+
end
|
135
|
+
|
136
|
+
unless data['result']
|
137
|
+
return "Could not find user #{vanity_or_email}."
|
138
|
+
end
|
139
|
+
|
140
|
+
data = api.call 'addFriend', :user => data['result']['key']
|
141
|
+
data['result'] ? "You are now friends with #{vanity_or_email}." :
|
142
|
+
"Rdio said you were unable to become friends with #{vanity_or_email}."
|
143
|
+
end
|
144
|
+
|
129
145
|
config_file '.rdio'
|
130
146
|
|
131
147
|
desc 'Rdio API consumer key'
|
@@ -304,6 +320,16 @@ module Rdio
|
|
304
320
|
end
|
305
321
|
end
|
306
322
|
|
323
|
+
desc 'Manage your friends'
|
324
|
+
command :friends do |c|
|
325
|
+
c.desc 'Add a friend'
|
326
|
+
c.command :add do |add|
|
327
|
+
add.action do |global_options,options,args|
|
328
|
+
say add_friend args.first
|
329
|
+
end
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
307
333
|
pre do |global,command,options,args|
|
308
334
|
# Pre logic here
|
309
335
|
# Return true to proceed; false to abourt and not call the
|
data/lib/rdio/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdio-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-09-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: highline
|
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
105
|
rubyforge_project:
|
106
|
-
rubygems_version: 1.8.
|
106
|
+
rubygems_version: 1.8.29
|
107
107
|
signing_key:
|
108
108
|
specification_version: 3
|
109
109
|
summary: CLI for Rdio for Mac
|