cultome_player 2.0.0 → 2.0.2
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 +4 -4
- data/README.md +24 -79
- data/Rakefile +38 -4
- data/bin/cultome_player +16 -4
- data/config/environment.yml +4 -0
- data/cultome_player.gemspec +8 -1
- data/lib/cultome_player.rb +45 -19
- data/lib/cultome_player/command/language.rb +3 -4
- data/lib/cultome_player/command/processor.rb +9 -7
- data/lib/cultome_player/command/reader.rb +11 -2
- data/lib/cultome_player/environment.rb +21 -13
- data/lib/cultome_player/events.rb +7 -7
- data/lib/cultome_player/objects/album.rb +9 -2
- data/lib/cultome_player/objects/artist.rb +9 -2
- data/lib/cultome_player/objects/command.rb +10 -1
- data/lib/cultome_player/objects/drive.rb +4 -1
- data/lib/cultome_player/objects/genre.rb +4 -1
- data/lib/cultome_player/objects/parameter.rb +21 -1
- data/lib/cultome_player/objects/response.rb +5 -1
- data/lib/cultome_player/objects/song.rb +9 -4
- data/lib/cultome_player/player/adapter/mpg123.rb +3 -4
- data/lib/cultome_player/player/interactive.rb +67 -11
- data/lib/cultome_player/player/interface/basic.rb +13 -9
- data/lib/cultome_player/player/interface/extended.rb +26 -12
- data/lib/cultome_player/player/interface/helper.rb +73 -9
- data/lib/cultome_player/plugins.rb +44 -18
- data/lib/cultome_player/plugins/alias.rb +85 -0
- data/lib/cultome_player/plugins/gestures.rb +90 -0
- data/lib/cultome_player/plugins/help.rb +4 -4
- data/lib/cultome_player/plugins/keyboard_special_keys.rb +22 -0
- data/lib/cultome_player/plugins/points.rb +51 -0
- data/lib/cultome_player/utils.rb +117 -7
- data/lib/cultome_player/version.rb +1 -1
- data/xbindkeys/xbindkeysrc +12 -0
- metadata +37 -89
- data/.coveralls.yml +0 -1
- data/.gitignore +0 -24
- data/.rspec +0 -2
- data/.travis.yml +0 -7
- data/db/001_create_schema.rb +0 -58
- data/spec/config.yml +0 -0
- data/spec/cultome_player/command/processor_spec.rb +0 -168
- data/spec/cultome_player/command/reader_spec.rb +0 -45
- data/spec/cultome_player/cultome_player_spec.rb +0 -17
- data/spec/cultome_player/environment_spec.rb +0 -65
- data/spec/cultome_player/events_spec.rb +0 -22
- data/spec/cultome_player/media_spec.rb +0 -41
- data/spec/cultome_player/player/adapter/mpg123_spec.rb +0 -82
- data/spec/cultome_player/player/interface/basic_spec.rb +0 -168
- data/spec/cultome_player/player/interface/extended/connect_spec.rb +0 -117
- data/spec/cultome_player/player/interface/extended/search_spec.rb +0 -90
- data/spec/cultome_player/player/interface/extended/show_spec.rb +0 -36
- data/spec/cultome_player/player/interface/extended/shuffle_spec.rb +0 -26
- data/spec/cultome_player/player/interface/extended_spec.rb +0 -136
- data/spec/cultome_player/player/interface/helper_spec.rb +0 -63
- data/spec/cultome_player/player/interface_spec.rb +0 -17
- data/spec/cultome_player/player/playlist_spec.rb +0 -301
- data/spec/cultome_player/plugins/help_spec.rb +0 -21
- data/spec/cultome_player/plugins_spec.rb +0 -19
- data/spec/cultome_player/utils_spec.rb +0 -15
- data/spec/spec_helper.rb +0 -108
- data/spec/test/uno/dos/dos.mp3 +0 -0
- data/spec/test/uno/dos/tres/tres.mp3 +0 -0
- data/spec/test/uno/uno.mp3 +0 -0
- data/tasks/console.rake +0 -19
- data/tasks/db.rake +0 -19
- data/tasks/run.rake +0 -7
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
class TestPlugin
|
4
|
-
include CultomePlayer::Plugins::Help
|
5
|
-
end
|
6
|
-
|
7
|
-
describe CultomePlayer::Plugins::Help do
|
8
|
-
let(:p){ TestPlugin.new }
|
9
|
-
|
10
|
-
it 'respond to command_help' do
|
11
|
-
p.should respond_to(:command_help)
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'respond to usage_help' do
|
15
|
-
p.should respond_to(:usage_help)
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'respond to description_help' do
|
19
|
-
p.should respond_to(:description_help)
|
20
|
-
end
|
21
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe CultomePlayer::Plugins do
|
4
|
-
let(:p){
|
5
|
-
class TestPlugin
|
6
|
-
include CultomePlayer::Plugins
|
7
|
-
end
|
8
|
-
|
9
|
-
TestPlugin.new
|
10
|
-
}
|
11
|
-
it 'check if plugins respond to a given command' do
|
12
|
-
p.plugins_respond_to?("help").should be_true
|
13
|
-
p.plugins_respond_to?("nonexistent").should_not be_true
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'return the format for a command' do
|
17
|
-
p.plugin_command_sintaxis("help").should be_instance_of Regexp
|
18
|
-
end
|
19
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe CultomePlayer::Utils do
|
4
|
-
let(:t){ TestClass.new(:rspec) }
|
5
|
-
|
6
|
-
describe 'arrange information in columns' do
|
7
|
-
it 'everything fits in a row' do
|
8
|
-
t.arrange_in_columns(["12345", "1234567890"], [5, 10], 2).should eq "12345 1234567890"
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'data bigger than column span into another row' do
|
12
|
-
t.arrange_in_columns(["12345", "123456789012345"], [5, 10], 2).should eq "12345 1234567890\n 12345"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,108 +0,0 @@
|
|
1
|
-
require 'coveralls'
|
2
|
-
require 'database_cleaner'
|
3
|
-
require 'cultome_player'
|
4
|
-
|
5
|
-
Coveralls.wear!
|
6
|
-
|
7
|
-
include CultomePlayer::Environment
|
8
|
-
include CultomePlayer::Utils
|
9
|
-
include CultomePlayer::Objects
|
10
|
-
|
11
|
-
RSpec.configure do |config|
|
12
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
13
|
-
config.run_all_when_everything_filtered = true
|
14
|
-
config.filter_run :focus
|
15
|
-
config.filter_run_excluding :mplayer
|
16
|
-
config.order = 'random'
|
17
|
-
|
18
|
-
config.before(:suite) do
|
19
|
-
prepare_environment(:rspec)
|
20
|
-
with_connection do
|
21
|
-
DatabaseCleaner.strategy = :transaction
|
22
|
-
DatabaseCleaner.clean_with(:truncation)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
config.before(:each) do
|
27
|
-
with_connection { DatabaseCleaner.start }
|
28
|
-
end
|
29
|
-
|
30
|
-
config.after(:each) do
|
31
|
-
with_connection { DatabaseCleaner.clean }
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
module FakeStatus
|
36
|
-
def current_artist
|
37
|
-
Artist.new(name: 'artist_uno')
|
38
|
-
end
|
39
|
-
|
40
|
-
def current_album
|
41
|
-
Album.new(name: 'album_tres')
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
module FakeExtractor
|
46
|
-
def extract_from_txt(filepath, opc)
|
47
|
-
filename = filepath[filepath.rindex("/")+1, filepath.length]
|
48
|
-
extension = filename[filename.rindex(".")+1, filename.length]
|
49
|
-
|
50
|
-
file_info = { filename: filename, path: filepath, extension: extension }
|
51
|
-
|
52
|
-
file_info[:relative_path] = filepath.gsub(/#{opc[:root_path]}\//, '') if opc.has_key?(:root_path)
|
53
|
-
|
54
|
-
return file_info
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
module MockPlayer
|
59
|
-
def send_to_player(cmd)
|
60
|
-
if cmd == 'pause'
|
61
|
-
if @paused
|
62
|
-
@paused = @stopped = false
|
63
|
-
@playing = true
|
64
|
-
else
|
65
|
-
@paused = true
|
66
|
-
@stopped = @playing = false
|
67
|
-
end
|
68
|
-
elsif cmd.start_with?('load')
|
69
|
-
@is_player_running = @playing = true
|
70
|
-
elsif cmd.start_with?('stop')
|
71
|
-
@is_player_running = @paused = @playing = false
|
72
|
-
@stopped = true
|
73
|
-
elsif cmd.start_with?('jump')
|
74
|
-
# do nothing
|
75
|
-
else
|
76
|
-
puts "ERROR: #{cmd} !!!!!!!"
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
def control_pipe
|
81
|
-
STDOUT
|
82
|
-
end
|
83
|
-
|
84
|
-
def start_player
|
85
|
-
@play_in_player = true
|
86
|
-
@playing = true
|
87
|
-
@paused = @stopped = false
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
class TestClass
|
92
|
-
include CultomePlayer
|
93
|
-
include FakeStatus
|
94
|
-
include FakeExtractor
|
95
|
-
include MockPlayer
|
96
|
-
|
97
|
-
def initialize(env=:rspec)
|
98
|
-
prepare_environment(env) unless env.nil?
|
99
|
-
playlists.register(:current)
|
100
|
-
playlists.register(:history)
|
101
|
-
playlists.register(:queue)
|
102
|
-
playlists.register(:focus)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def test_folder
|
107
|
-
File.join(File.dirname(File.expand_path(__FILE__)), 'test')
|
108
|
-
end
|
data/spec/test/uno/dos/dos.mp3
DELETED
Binary file
|
Binary file
|
data/spec/test/uno/uno.mp3
DELETED
Binary file
|
data/tasks/console.rake
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'cultome_player'
|
2
|
-
require 'pry'
|
3
|
-
|
4
|
-
include CultomePlayer::Environment
|
5
|
-
|
6
|
-
desc "Start a interactive session in the player"
|
7
|
-
task :console do
|
8
|
-
include CultomePlayer::Objects
|
9
|
-
|
10
|
-
p = CultomePlayer.get_player
|
11
|
-
|
12
|
-
ActiveRecord::Base.establish_connection(
|
13
|
-
adapter: db_adapter,
|
14
|
-
database: db_file
|
15
|
-
)
|
16
|
-
ActiveRecord::Base.logger = Logger.new(File.open(db_log_file, 'a'))
|
17
|
-
|
18
|
-
binding.pry
|
19
|
-
end
|
data/tasks/db.rake
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'cultome_player'
|
2
|
-
|
3
|
-
include CultomePlayer::Environment
|
4
|
-
include CultomePlayer::Utils
|
5
|
-
include CultomePlayer::Objects
|
6
|
-
|
7
|
-
namespace :db do
|
8
|
-
desc "Create database schema"
|
9
|
-
task :create, :env do |t, args|
|
10
|
-
migrations_path= File.join(File.dirname(File.expand_path(__FILE__)), "../db")
|
11
|
-
env = args[:env] || :user
|
12
|
-
prepare_environment(env, false)
|
13
|
-
with_connection do
|
14
|
-
ActiveRecord::Migrator.migrate(migrations_path)
|
15
|
-
Album.find_or_create_by(id: 0, name: 'Unknown')
|
16
|
-
Artist.find_or_create_by(id: 0, name: 'Unknown')
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
data/tasks/run.rake
DELETED