walkman 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +29 -5
- data/lib/walkman/commands/controls.rb +11 -9
- data/lib/walkman/commands/information.rb +1 -3
- data/lib/walkman/commands/queueing.rb +2 -4
- data/spec/walkman/player_spec.rb +25 -19
- data/walkman.gemspec +1 -2
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e685425511a289c81c6f326fd90c6fcec1bd4df7
|
4
|
+
data.tar.gz: 84ae1ad218f87c9eb378f8190ad8475a33631456
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b935160543578f59fd985fcaca685fca1c5c06978faa9917c6feea21713ffa2af47177a43afca28b8097ef89a15c90d4578ebbeae1d2188c0fd5794447593210
|
7
|
+
data.tar.gz: 5f3c7e726bd5deb8afa29ee285430a8a3b3175c3c2bf5958708178d9efd2bb53f1b01244086323c7a00422d36f6a81f76da49b87f27d398047bd550c2f13982d
|
data/README.md
CHANGED
@@ -42,11 +42,35 @@ curl -F "api_key=<api_key>" -F "format=json" -F "type=general" -F "name=base_pro
|
|
42
42
|
Create a Walkman config file at `~/.walkman`:
|
43
43
|
|
44
44
|
```
|
45
|
+
log_level: debug # optional
|
46
|
+
server:
|
47
|
+
host: localhost # optional
|
48
|
+
port: 27001 # optional
|
45
49
|
echonest:
|
46
|
-
api_key:
|
47
|
-
consumer_key:
|
48
|
-
shared_secret:
|
49
|
-
catalog_id:
|
50
|
+
api_key: APIKEY
|
51
|
+
consumer_key: CONSUMERKEY
|
52
|
+
shared_secret: SHAREDSECRET
|
53
|
+
catalog_id: CATALOGID
|
50
54
|
rdio:
|
51
|
-
|
55
|
+
player_url: http://localhost:4567/rdio # optional
|
56
|
+
playback_token: PLAYBACKTOKEN
|
57
|
+
browser_path: /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --no-process-singleton-dialog # optional
|
58
|
+
```
|
59
|
+
|
60
|
+
## Usage
|
61
|
+
|
62
|
+
```
|
63
|
+
Commands:
|
64
|
+
walkman help [COMMAND] # Describe available commands or one specific command
|
65
|
+
walkman like # plays more music like the current song
|
66
|
+
walkman next # plays the next song in the current playlist
|
67
|
+
walkman now_playing # shows the song that's currently playing
|
68
|
+
walkman play # plays the current playlist
|
69
|
+
walkman play_artist ARTIST # plays songs from the given artist
|
70
|
+
walkman play_artist_radio ARTIST # plays music like the given artist
|
71
|
+
walkman shutdown # stops the walkman server
|
72
|
+
walkman skip COUNT # skips the given amount of songs
|
73
|
+
walkman start # starts the walkman server
|
74
|
+
walkman stop # stops playing music
|
75
|
+
walkman up_next # shows the next songs on the current playlist
|
52
76
|
```
|
@@ -3,16 +3,17 @@ module Walkman
|
|
3
3
|
module Controls
|
4
4
|
def self.play
|
5
5
|
Walkman.player.play
|
6
|
-
song = Walkman.player.current_song
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
if song = Walkman.player.current_song
|
8
|
+
"♫ Playing #{song.title} by #{song.artist}"
|
9
|
+
else
|
10
|
+
"♫ We're playing but the queue is empty!"
|
11
|
+
end
|
11
12
|
end
|
12
13
|
|
13
14
|
def self.stop
|
14
15
|
Walkman.player.stop
|
15
|
-
""
|
16
|
+
"Stopping walkman"
|
16
17
|
end
|
17
18
|
|
18
19
|
def self.next(count = 1)
|
@@ -21,11 +22,12 @@ module Walkman
|
|
21
22
|
end
|
22
23
|
|
23
24
|
Walkman.player.next(count)
|
24
|
-
song = Walkman.player.current_song
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
if song = Walkman.player.current_song
|
27
|
+
"♫ Skipping to #{song.title} by #{song.artist}"
|
28
|
+
else
|
29
|
+
"No more songs in the queue. Stopping walkman"
|
30
|
+
end
|
29
31
|
end
|
30
32
|
define_singleton_method(:skip) { |count| self.next(count) }
|
31
33
|
end
|
@@ -3,9 +3,7 @@ module Walkman
|
|
3
3
|
module Information
|
4
4
|
def self.now_playing
|
5
5
|
if song = Walkman.player.current_song
|
6
|
-
|
7
|
-
output << [song.title.bold, "by", song.artist.bold]
|
8
|
-
output.flatten.join(" ")
|
6
|
+
"♫ Now playing #{song.title} by #{song.artist}"
|
9
7
|
else
|
10
8
|
"No music is playing"
|
11
9
|
end
|
@@ -5,8 +5,7 @@ module Walkman
|
|
5
5
|
playlist = self.queue("artist", artist: artist)
|
6
6
|
|
7
7
|
if playlist.size > 0
|
8
|
-
|
9
|
-
output.flatten.join(" ")
|
8
|
+
"♫ Playing songs by #{artist.titleize}"
|
10
9
|
else
|
11
10
|
"That artist couldn't be queued"
|
12
11
|
end
|
@@ -16,8 +15,7 @@ module Walkman
|
|
16
15
|
playlist = self.queue("artist-radio", artist: artist)
|
17
16
|
|
18
17
|
if playlist.size > 0
|
19
|
-
|
20
|
-
output.flatten.join(" ")
|
18
|
+
"♫ Playing music like #{artist.titleize}"
|
21
19
|
else
|
22
20
|
"Music like that artist couldn't be queued"
|
23
21
|
end
|
data/spec/walkman/player_spec.rb
CHANGED
@@ -14,11 +14,6 @@ describe Walkman::Player do
|
|
14
14
|
|
15
15
|
player.playlist = nil
|
16
16
|
player.current_song = nil
|
17
|
-
player.startup
|
18
|
-
end
|
19
|
-
|
20
|
-
after do
|
21
|
-
player.shutdown
|
22
17
|
end
|
23
18
|
|
24
19
|
it "responds to #playlist" do
|
@@ -34,7 +29,6 @@ describe Walkman::Player do
|
|
34
29
|
describe "#startup" do
|
35
30
|
it "starts up all music services" do
|
36
31
|
Walkman::Player::SERVICES.each do |service|
|
37
|
-
service.any_instance.unstub(:startup)
|
38
32
|
expect_any_instance_of(service).to receive(:startup)
|
39
33
|
end
|
40
34
|
|
@@ -42,13 +36,26 @@ describe Walkman::Player do
|
|
42
36
|
end
|
43
37
|
|
44
38
|
describe "play loop" do
|
39
|
+
before do
|
40
|
+
player.services.each_with_index do |(k, service), i|
|
41
|
+
service.stub(:startup)
|
42
|
+
service.stub(:shutdown)
|
43
|
+
end
|
44
|
+
|
45
|
+
player.startup
|
46
|
+
end
|
47
|
+
|
48
|
+
after do
|
49
|
+
player.shutdown
|
50
|
+
end
|
51
|
+
|
45
52
|
it "calls #next if there is no current song" do
|
46
53
|
player.current_song = nil
|
47
54
|
|
48
55
|
expect(player).to receive(:next).at_least(1)
|
49
56
|
|
50
57
|
player.play
|
51
|
-
sleep 0.
|
58
|
+
sleep 0.2
|
52
59
|
end
|
53
60
|
|
54
61
|
it "calls #stop if the last loop song is different than the current loop song" do
|
@@ -56,21 +63,21 @@ describe Walkman::Player do
|
|
56
63
|
player.playlist = create(:playlist)
|
57
64
|
player.playlist.add(create(:song))
|
58
65
|
|
59
|
-
expect(player).to receive(:stop)
|
66
|
+
expect(player).to receive(:stop).at_least(1)
|
60
67
|
|
61
68
|
player.play
|
62
69
|
sleep 0.2
|
63
70
|
player.current_song = create(:song)
|
64
|
-
sleep 0.
|
71
|
+
sleep 0.2
|
65
72
|
end
|
66
73
|
|
67
74
|
it "calls #play_song if the last loop song is nil" do
|
68
75
|
player.current_song = create(:song)
|
69
76
|
|
70
|
-
expect(player).to receive(:play_song)
|
77
|
+
expect(player).to receive(:play_song).at_least(1)
|
71
78
|
|
72
79
|
player.play
|
73
|
-
sleep 0.
|
80
|
+
sleep 0.2
|
74
81
|
end
|
75
82
|
end
|
76
83
|
end
|
@@ -88,28 +95,29 @@ describe Walkman::Player do
|
|
88
95
|
|
89
96
|
describe "#play" do
|
90
97
|
it "plays a song from a specific music service" do
|
98
|
+
player.startup
|
99
|
+
|
91
100
|
Walkman::Player::SERVICES.each do |service|
|
92
101
|
service.any_instance.stub(:play)
|
93
|
-
player.current_song = create(:song, source_type: service.name)
|
94
102
|
expect_any_instance_of(service).to receive(:play)
|
103
|
+
player.current_song = create(:song, source_type: service.name)
|
95
104
|
end
|
96
105
|
|
97
106
|
player.play
|
98
|
-
sleep 0.
|
107
|
+
sleep 0.1
|
108
|
+
player.shutdown
|
99
109
|
end
|
100
110
|
end
|
101
111
|
|
102
112
|
describe "#stop" do
|
103
113
|
it "stops all music services" do
|
104
|
-
player.instance_variable_set("@play_loop", nil)
|
105
|
-
|
106
114
|
Walkman::Player::SERVICES.each do |service|
|
107
115
|
service.any_instance.stub(:stop)
|
108
116
|
expect_any_instance_of(service).to receive(:stop)
|
109
117
|
end
|
110
118
|
|
111
119
|
player.stop
|
112
|
-
sleep 0.2
|
120
|
+
sleep 0.2
|
113
121
|
end
|
114
122
|
end
|
115
123
|
|
@@ -118,12 +126,11 @@ describe Walkman::Player do
|
|
118
126
|
let!(:playlist) { create(:playlist) }
|
119
127
|
|
120
128
|
before do
|
121
|
-
player.startup
|
122
129
|
player.playlist = playlist
|
130
|
+
player.playlist.clear
|
123
131
|
end
|
124
132
|
|
125
133
|
it "plays the next song in the playlist" do
|
126
|
-
player.playlist.clear
|
127
134
|
player.playlist.add(song)
|
128
135
|
player.current_song = nil
|
129
136
|
|
@@ -135,7 +142,6 @@ describe Walkman::Player do
|
|
135
142
|
end
|
136
143
|
|
137
144
|
it "stops playing if there are no more songs in the playlist queue" do
|
138
|
-
player.playlist.clear
|
139
145
|
player.playing = true
|
140
146
|
player.current_song = song
|
141
147
|
|
data/walkman.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "walkman"
|
5
|
-
spec.version = "0.1.
|
5
|
+
spec.version = "0.1.3"
|
6
6
|
|
7
7
|
spec.author = "Tres Trantham"
|
8
8
|
spec.email = "tres@trestrantham.com"
|
@@ -20,7 +20,6 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_development_dependency "rake", "~> 10.1"
|
21
21
|
|
22
22
|
spec.add_dependency "activemodel", "~> 4.0.2"
|
23
|
-
spec.add_dependency "colorize", "~> 0.6.0"
|
24
23
|
spec.add_dependency "command", "~> 1.0"
|
25
24
|
spec.add_dependency "echowrap", "~> 0.1.0"
|
26
25
|
spec.add_dependency "sinatra", "~> 1.4.4"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: walkman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tres Trantham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 4.0.2
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: colorize
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.6.0
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 0.6.0
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: command
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|