somadic 0.0.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 +7 -0
- data/.gitignore +19 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/Guardfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +84 -0
- data/Rakefile +1 -0
- data/bin/somadic +424 -0
- data/lib/somadic.rb +12 -0
- data/lib/somadic/audio_addict.rb +26 -0
- data/lib/somadic/base_channel.rb +53 -0
- data/lib/somadic/channel/di.rb +83 -0
- data/lib/somadic/channel/soma.rb +91 -0
- data/lib/somadic/logger.rb +33 -0
- data/lib/somadic/mplayer.rb +84 -0
- data/lib/somadic/version.rb +3 -0
- data/presets/chill.yaml +6 -0
- data/presets/lounge.yaml +4 -0
- data/somadic.gemspec +31 -0
- data/spec/lib/somadic/audio_addict_spec.rb +12 -0
- data/spec/lib/somadic/base_channel_spec.rb +5 -0
- data/spec/lib/somadic/channel/di_spec.rb +34 -0
- data/spec/lib/somadic/channel/soma_spec.rb +27 -0
- data/spec/lib/somadic/logger_spec.rb +9 -0
- data/spec/lib/somadic/mplayer_spec.rb +26 -0
- data/spec/lib/somadic_spec.rb +5 -0
- data/spec/spec_helper.rb +20 -0
- metadata +220 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Somadic::Channel::DI do
|
4
|
+
it 'can play DI' do
|
5
|
+
if pidlist.empty?
|
6
|
+
di = Somadic::Channel::DI.new({ channel: 'breaks' })
|
7
|
+
expect(di.stopped?).to be true
|
8
|
+
di.start
|
9
|
+
sleep secs_to_wait # let it spin up
|
10
|
+
expect(pidlist.count).to be > 0
|
11
|
+
|
12
|
+
di.stop
|
13
|
+
sleep secs_to_wait / 2 # let it die
|
14
|
+
expect(pidlist.empty?).to be true
|
15
|
+
else
|
16
|
+
puts "\n!!! mplayer is already running, skipping DI test."
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'blows up with a bad channel'
|
21
|
+
|
22
|
+
it 'can load a channel list' do
|
23
|
+
di = Somadic::Channel::DI.new({ channel: 'breaks' })
|
24
|
+
expect(di.channels.count).to be > 10
|
25
|
+
expect(di.channels.include?({ id: '15', name: 'breaks' })).to be true
|
26
|
+
expect(di.channels.include?({:id=>"136", :name=>"cosmicdowntempo"})).to be true
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'can find a channel by name' do
|
30
|
+
di = Somadic::Channel::DI.new({ channel: 'breaks' })
|
31
|
+
c = di.find_channel('breaks')
|
32
|
+
expect(c[:id].to_i).to eql 15
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Somadic::Channel::Soma do
|
4
|
+
it 'can play Soma' do
|
5
|
+
if pidlist.empty?
|
6
|
+
soma = Somadic::Channel::Soma.new({ channel: 'secretagent130' })
|
7
|
+
soma.start
|
8
|
+
sleep secs_to_wait # let it spin up
|
9
|
+
expect(pidlist.count).to be > 0
|
10
|
+
|
11
|
+
soma.stop
|
12
|
+
sleep secs_to_wait / 2 # let it die
|
13
|
+
expect(pidlist.empty?).to be true
|
14
|
+
else
|
15
|
+
puts "\n!!! mplayer is already running, skipping Soma test."
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'blows up with a bad channel'
|
20
|
+
|
21
|
+
it 'can get a channel list' do
|
22
|
+
soma = Somadic::Channel::Soma.new({ channel: 'secretagent130' })
|
23
|
+
expect(soma.channels.count).to be > 0
|
24
|
+
expect(soma.channels.include?({ id: 0, name: 'secretagent' })).to be true
|
25
|
+
expect(soma.channels.include?({ id: 0, name: 'groovesalad' })).to be true
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Somadic::Mplayer do
|
4
|
+
it 'can start and stop mplayer' do
|
5
|
+
mp = Somadic::Mplayer.new({ url: 'http://listen.di.fm/public3/breaks.pls' })
|
6
|
+
expect(mp.cache).to be nil
|
7
|
+
expect(mp.cache_min).to be nil
|
8
|
+
if pidlist.empty?
|
9
|
+
mp.start
|
10
|
+
sleep secs_to_wait # let it spin up
|
11
|
+
expect(pidlist.count).to be > 0
|
12
|
+
|
13
|
+
mp.stop
|
14
|
+
sleep secs_to_wait / 2 # let it die
|
15
|
+
expect(pidlist.empty?).to be true
|
16
|
+
else
|
17
|
+
puts "\n!!! mplayer is already running, skipping test."
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'sets cache options correctly' do
|
22
|
+
mp = Somadic::Mplayer.new({ url: 'http://ghost.com', cache: 999, cache_min: 90 })
|
23
|
+
expect(mp.cache).to eql 999
|
24
|
+
expect(mp.cache_min).to eql 90
|
25
|
+
end
|
26
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'somadic'
|
2
|
+
|
3
|
+
# How many seconds to wait for things to happen.
|
4
|
+
def secs_to_wait
|
5
|
+
7
|
6
|
+
end
|
7
|
+
|
8
|
+
# Generates a list of mplayer PIDs.
|
9
|
+
def pidlist
|
10
|
+
processes = `ps -C mplayer -o pid,cmd | grep -v defunct`.split("\n")[1..-1]
|
11
|
+
processes.map { |p| p.split[0].to_i }
|
12
|
+
end
|
13
|
+
|
14
|
+
RSpec.configure do |config|
|
15
|
+
config.before(:suite) do
|
16
|
+
puts "!!!"
|
17
|
+
puts "!!! These tests should play music!"
|
18
|
+
puts "!!!"
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,220 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: somadic
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shane Thomas
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mono_logger
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: curses
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: progress_bar
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: api_cache
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.3'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: chronic
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.10'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.10'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: bundler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.5'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.5'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '10.3'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '10.3'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '3.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: guard-rspec
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '4.3'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '4.3'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: pry
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.10'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.10'
|
153
|
+
description: Somadic is a terminal-based player for somafm.com and DI.fm.
|
154
|
+
email:
|
155
|
+
- shane@devshane.com
|
156
|
+
executables:
|
157
|
+
- somadic
|
158
|
+
extensions: []
|
159
|
+
extra_rdoc_files: []
|
160
|
+
files:
|
161
|
+
- ".gitignore"
|
162
|
+
- ".rspec"
|
163
|
+
- Gemfile
|
164
|
+
- Guardfile
|
165
|
+
- LICENSE.txt
|
166
|
+
- README.md
|
167
|
+
- Rakefile
|
168
|
+
- bin/somadic
|
169
|
+
- lib/somadic.rb
|
170
|
+
- lib/somadic/audio_addict.rb
|
171
|
+
- lib/somadic/base_channel.rb
|
172
|
+
- lib/somadic/channel/di.rb
|
173
|
+
- lib/somadic/channel/soma.rb
|
174
|
+
- lib/somadic/logger.rb
|
175
|
+
- lib/somadic/mplayer.rb
|
176
|
+
- lib/somadic/version.rb
|
177
|
+
- presets/chill.yaml
|
178
|
+
- presets/lounge.yaml
|
179
|
+
- somadic.gemspec
|
180
|
+
- spec/lib/somadic/audio_addict_spec.rb
|
181
|
+
- spec/lib/somadic/base_channel_spec.rb
|
182
|
+
- spec/lib/somadic/channel/di_spec.rb
|
183
|
+
- spec/lib/somadic/channel/soma_spec.rb
|
184
|
+
- spec/lib/somadic/logger_spec.rb
|
185
|
+
- spec/lib/somadic/mplayer_spec.rb
|
186
|
+
- spec/lib/somadic_spec.rb
|
187
|
+
- spec/spec_helper.rb
|
188
|
+
homepage: https://github.com/devshane/somadic
|
189
|
+
licenses:
|
190
|
+
- MIT
|
191
|
+
metadata: {}
|
192
|
+
post_install_message:
|
193
|
+
rdoc_options: []
|
194
|
+
require_paths:
|
195
|
+
- lib
|
196
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '0'
|
201
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
202
|
+
requirements:
|
203
|
+
- - ">="
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: '0'
|
206
|
+
requirements: []
|
207
|
+
rubyforge_project:
|
208
|
+
rubygems_version: 2.2.2
|
209
|
+
signing_key:
|
210
|
+
specification_version: 4
|
211
|
+
summary: Somadic is a terminal-based player for somafm.com and DI.fm
|
212
|
+
test_files:
|
213
|
+
- spec/lib/somadic/audio_addict_spec.rb
|
214
|
+
- spec/lib/somadic/base_channel_spec.rb
|
215
|
+
- spec/lib/somadic/channel/di_spec.rb
|
216
|
+
- spec/lib/somadic/channel/soma_spec.rb
|
217
|
+
- spec/lib/somadic/logger_spec.rb
|
218
|
+
- spec/lib/somadic/mplayer_spec.rb
|
219
|
+
- spec/lib/somadic_spec.rb
|
220
|
+
- spec/spec_helper.rb
|