playa 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +6 -6
- data/bin/playa +5 -7
- data/lib/playa/controller.rb +6 -19
- data/lib/playa/track.rb +2 -2
- data/lib/playa/track_collection.rb +1 -1
- data/playa.gemspec +8 -8
- data/test/lib/playa/track_collection_test.rb +3 -6
- data/test/lib/playa/track_test.rb +16 -18
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4878ba1ffdd6bac5e65efca51700fb2c4eb04c78
|
4
|
+
data.tar.gz: 857acc9d3e9d1b0d9467626887a1ce6925628ddc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a38780c433bb4ab05fa20b7abd5439876ba05d953b6f2f6c3e5ea2a7b4370d7001649bb20cf81f7c2e12ed39ad24ceb0e5fd40424835a59e2b380481e6dc8d4
|
7
|
+
data.tar.gz: 6a0dda0911e38eaec891fc39582d869705408cf5b6ff7437b740741e1b09f4810a2078100751fb338af3255f4214d8f88f3d13818b14bb3cc4bece1919f1d928
|
data/Rakefile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rake/testtask'
|
3
3
|
|
4
|
-
task :
|
4
|
+
task default: :test
|
5
5
|
|
6
6
|
Rake::TestTask.new do |t|
|
7
|
-
t.libs.push
|
8
|
-
t.libs.push
|
9
|
-
t.pattern =
|
7
|
+
t.libs.push 'lib'
|
8
|
+
t.libs.push 'test'
|
9
|
+
t.pattern = 'test/**/*_test.rb'
|
10
10
|
end
|
data/bin/playa
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
unless $LOAD_PATH.include?(File.dirname(__FILE__) + '/../lib')
|
3
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
|
4
|
+
end
|
3
5
|
|
4
6
|
-> { its -> { a } }
|
5
7
|
trap('INT') { exit! }
|
@@ -8,10 +10,6 @@ require 'playa'
|
|
8
10
|
|
9
11
|
args = ARGV.dup
|
10
12
|
|
11
|
-
play_directory =
|
12
|
-
Dir.pwd
|
13
|
-
else
|
14
|
-
args
|
15
|
-
end
|
13
|
+
play_directory = args.empty? || args.nil? ? Dir.pwd : args
|
16
14
|
|
17
|
-
Playa::Application.start(
|
15
|
+
Playa::Application.start(play_directory)
|
data/lib/playa/controller.rb
CHANGED
@@ -20,28 +20,15 @@ module Playa
|
|
20
20
|
|
21
21
|
event :key do |key|
|
22
22
|
case key
|
23
|
-
when :left
|
24
|
-
|
25
|
-
|
26
|
-
when :
|
27
|
-
|
28
|
-
|
29
|
-
when :space
|
30
|
-
player.toggle
|
31
|
-
|
23
|
+
when :left then player.rewind
|
24
|
+
when :right then player.forward
|
25
|
+
when :space then player.toggle
|
26
|
+
when :up then trigger(:menu_prev)
|
27
|
+
when :down then trigger(:menu_next)
|
28
|
+
when 'q' then trigger(:_exit_)
|
32
29
|
when :enter
|
33
30
|
trigger(:menu_select)
|
34
31
|
trigger(:select, menu.current_item)
|
35
|
-
|
36
|
-
when :up
|
37
|
-
trigger(:menu_prev)
|
38
|
-
|
39
|
-
when :down
|
40
|
-
trigger(:menu_next)
|
41
|
-
|
42
|
-
when 'q'
|
43
|
-
trigger(:_exit_)
|
44
|
-
|
45
32
|
end
|
46
33
|
trigger(:update)
|
47
34
|
end
|
data/lib/playa/track.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'mp3info'
|
2
2
|
|
3
3
|
module Playa
|
4
|
-
|
4
|
+
class Track
|
5
5
|
def initialize(file)
|
6
6
|
@file = file
|
7
7
|
end
|
@@ -14,7 +14,7 @@ module Playa
|
|
14
14
|
album: album,
|
15
15
|
track_number: track_number,
|
16
16
|
duration: duration,
|
17
|
-
bitrate: bitrate
|
17
|
+
bitrate: bitrate
|
18
18
|
}
|
19
19
|
end
|
20
20
|
|
data/playa.gemspec
CHANGED
@@ -4,17 +4,17 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'playa'
|
7
|
-
spec.version = '0.0.
|
7
|
+
spec.version = '0.0.4'
|
8
8
|
spec.authors = ['Gavin Laking']
|
9
9
|
spec.email = ['gavinlaking@gmail.com']
|
10
|
-
spec.summary =
|
11
|
-
spec.description =
|
10
|
+
spec.summary = 'Plays mp3s from a directory.'
|
11
|
+
spec.description = 'An example app using Vedeu.'
|
12
12
|
spec.homepage = 'https://github.com/gavinlaking/playa'
|
13
13
|
spec.license = 'MIT'
|
14
14
|
|
15
15
|
spec.files = `git ls-files -z`.split("\x0")
|
16
|
-
spec.executables = spec.files.grep(
|
17
|
-
spec.test_files = spec.files.grep(
|
16
|
+
spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
|
20
20
|
spec.add_development_dependency 'bundler', '~> 1.6'
|
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_development_dependency 'rake', '10.3.2'
|
27
27
|
spec.add_development_dependency 'simplecov', '0.9.0'
|
28
28
|
|
29
|
-
spec.
|
30
|
-
spec.
|
31
|
-
spec.
|
29
|
+
spec.add_dependency 'audite', '0.3.0'
|
30
|
+
spec.add_dependency 'ruby-mp3info', '0.8.4'
|
31
|
+
spec.add_dependency 'vedeu', '0.0.41'
|
32
32
|
end
|
@@ -5,9 +5,6 @@ module Playa
|
|
5
5
|
describe TrackCollection do
|
6
6
|
describe '#tracks' do
|
7
7
|
it 'returns a collection of Track objects' do
|
8
|
-
files = [
|
9
|
-
"/some/path/dance.mp3"
|
10
|
-
]
|
11
8
|
collection = TrackCollection.new
|
12
9
|
collection.tracks.must_be_instance_of(Array)
|
13
10
|
collection.tracks.first.must_be_instance_of(Track)
|
@@ -17,9 +14,9 @@ module Playa
|
|
17
14
|
describe '#files' do
|
18
15
|
it 'returns a list of files for the specified directory' do
|
19
16
|
files = [
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
'/some/path/dance.mp3',
|
18
|
+
'/some/path/electro.mp3',
|
19
|
+
'/some/path/dubstep.mp3'
|
23
20
|
]
|
24
21
|
collection = TrackCollection.new
|
25
22
|
|
@@ -4,37 +4,35 @@ require 'ostruct'
|
|
4
4
|
module Playa
|
5
5
|
describe Track do
|
6
6
|
let(:file) { '/some/path/electro.mp3' }
|
7
|
-
let(:tag)
|
8
|
-
OpenStruct.new(
|
7
|
+
let(:tag) do
|
8
|
+
OpenStruct.new(
|
9
9
|
title: 'eee-lectro',
|
10
10
|
artist: 'Gavin Laking + Various',
|
11
11
|
album: 'That night at Sankeys',
|
12
|
-
tracknum: 3
|
13
|
-
|
14
|
-
|
15
|
-
let(:mp3info)
|
16
|
-
OpenStruct.new(
|
12
|
+
tracknum: 3
|
13
|
+
)
|
14
|
+
end
|
15
|
+
let(:mp3info) do
|
16
|
+
OpenStruct.new(
|
17
17
|
filename: '/some/path/electro.mp3',
|
18
18
|
tag: tag,
|
19
19
|
length: 3623.0270625,
|
20
20
|
bitrate: 320
|
21
|
-
|
22
|
-
|
21
|
+
)
|
22
|
+
end
|
23
23
|
let(:track) { Track.new(file) }
|
24
24
|
|
25
25
|
describe '#attributes' do
|
26
26
|
it 'returns a collection of attributes' do
|
27
27
|
Mp3Info.stub(:open, mp3info) do
|
28
28
|
track.attributes.must_equal(
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
bitrate: 320
|
37
|
-
}
|
29
|
+
filename: '/some/path/electro.mp3',
|
30
|
+
title: 'eee-lectro',
|
31
|
+
artist: 'Gavin Laking + Various',
|
32
|
+
album: 'That night at Sankeys',
|
33
|
+
track_number: 3,
|
34
|
+
duration: 3623.0270625,
|
35
|
+
bitrate: 320
|
38
36
|
)
|
39
37
|
end
|
40
38
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin Laking
|
@@ -129,7 +129,7 @@ dependencies:
|
|
129
129
|
- - '='
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: 0.3.0
|
132
|
-
type: :
|
132
|
+
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
@@ -143,7 +143,7 @@ dependencies:
|
|
143
143
|
- - '='
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: 0.8.4
|
146
|
-
type: :
|
146
|
+
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
@@ -157,7 +157,7 @@ dependencies:
|
|
157
157
|
- - '='
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: 0.0.41
|
160
|
-
type: :
|
160
|
+
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|