hearken 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +14 -0
  3. data/.tool-versions +1 -0
  4. data/Gemfile +7 -1
  5. data/Gemfile.lock +95 -0
  6. data/{README.rdoc → README.md} +12 -50
  7. data/bin/console +15 -0
  8. data/bin/setup +8 -0
  9. data/exe/hearken +9 -0
  10. data/exe/hearken_index +13 -0
  11. data/hearken.gemspec +35 -35
  12. data/lib/hearken/colour.rb +3 -1
  13. data/lib/hearken/command/enqueue.rb +35 -10
  14. data/lib/hearken/command/reload.rb +18 -6
  15. data/lib/hearken/command/search.rb +31 -20
  16. data/lib/hearken/console.rb +11 -27
  17. data/lib/hearken/debug.rb +6 -6
  18. data/lib/hearken/indexing/ffmpeg_file.rb +7 -0
  19. data/lib/hearken/indexing/file.rb +3 -1
  20. data/lib/hearken/indexing/indexer.rb +32 -24
  21. data/lib/hearken/library.rb +49 -41
  22. data/lib/hearken/monkey_violence.rb +9 -7
  23. data/lib/hearken/paths.rb +13 -19
  24. data/lib/hearken/range_expander.rb +18 -13
  25. data/lib/hearken/tagged.rb +15 -11
  26. data/lib/hearken/track.rb +53 -39
  27. data/lib/hearken.rb +2 -2
  28. metadata +52 -141
  29. data/.gitignore +0 -5
  30. data/HISTORY.rdoc +0 -38
  31. data/MIT-LICENSE +0 -20
  32. data/bin/hearken +0 -7
  33. data/bin/hearken_index +0 -12
  34. data/lib/hearken/command/list.rb +0 -32
  35. data/lib/hearken/command/love.rb +0 -7
  36. data/lib/hearken/command/profile.rb +0 -7
  37. data/lib/hearken/command/recent.rb +0 -38
  38. data/lib/hearken/command/remove.rb +0 -15
  39. data/lib/hearken/command/restart.rb +0 -7
  40. data/lib/hearken/command/scrobbling.rb +0 -14
  41. data/lib/hearken/command/setup_scrobbling.rb +0 -7
  42. data/lib/hearken/command/shuffle.rb +0 -13
  43. data/lib/hearken/command/start.rb +0 -7
  44. data/lib/hearken/command/status.rb +0 -7
  45. data/lib/hearken/command/stop.rb +0 -7
  46. data/lib/hearken/command.rb +0 -35
  47. data/lib/hearken/notification/growl_notifier.rb +0 -15
  48. data/lib/hearken/player.rb +0 -126
  49. data/lib/hearken/preferences.rb +0 -30
  50. data/lib/hearken/queue.rb +0 -33
  51. data/lib/hearken/scrobbler.rb +0 -77
  52. data/lib/hearken/simple_scrobbler.rb +0 -94
  53. data/media/ice_cream.png +0 -0
  54. data/spec/hearken/command/enqueue_spec.rb +0 -24
  55. data/spec/hearken/command/list_spec.rb +0 -31
  56. data/spec/hearken/command/reload_spec.rb +0 -20
  57. data/spec/hearken/command/shuffle_spec.rb +0 -31
  58. data/spec/hearken/player_spec.rb +0 -38
  59. data/spec/hearken/range_expander_spec.rb +0 -28
  60. data/spec/spec_helper.rb +0 -5
@@ -1,24 +0,0 @@
1
- require_relative '../../spec_helper'
2
- require 'hearken/command/enqueue'
3
-
4
- describe Hearken::Command::Enqueue do
5
- extend ShellShock::CommandSpec
6
-
7
- with_usage '*<id>'
8
- with_help 'enqueues the list of songs with the specified ids'
9
-
10
- before do
11
- @player = stub('player')
12
- @command = Hearken::Command::Enqueue.new @player
13
- end
14
-
15
- it 'should enqueue whatever is returned from the expander' do
16
- expander = stub('expander')
17
- Hearken::RangeExpander.should_receive(:new).and_return(expander)
18
- expander.should_receive(:expand).with('some text').and_return([1,2,3])
19
-
20
- [1,2,3].each {|id| @player.should_receive(:enqueue).with id}
21
-
22
- @command.execute "some text"
23
- end
24
- end
@@ -1,31 +0,0 @@
1
- require_relative '../../spec_helper'
2
- require 'hearken/command/list'
3
-
4
- describe Hearken::Command::List do
5
- extend ShellShock::CommandSpec
6
-
7
- with_help <<EOF
8
- lists the contents of the track queue
9
- these results can optionally be filtered by specified words
10
- when playing, approximate times for each track will be displayed
11
- EOF
12
-
13
- before do
14
- @player = stub('player')
15
- @command = Hearken::Command::List.new @player
16
- end
17
-
18
- it 'should display nothing when there is no current track and nothing enqueued' do
19
- @player.stub!(:current).and_return nil
20
- @player.stub! :each
21
- @command.execute ''
22
- end
23
-
24
- it 'should display queue contents with no times when there is no current track' do
25
- track = stub 'track'
26
- @player.stub!(:current).and_return nil
27
- @player.stub!(:each).and_yield track
28
- @command.should_receive(:puts).with track
29
- @command.execute ''
30
- end
31
- end
@@ -1,20 +0,0 @@
1
- require_relative '../../spec_helper'
2
- require 'hearken/command/reload'
3
-
4
- describe Hearken::Command::Reload do
5
- extend ShellShock::CommandSpec
6
-
7
- with_usage ''
8
- with_help 'reloads the contents of the music library for fast searching'
9
-
10
- before do
11
- @library = stub('library')
12
- @player = stub('player', :library => @library)
13
- @command = Hearken::Command::Reload.new @player
14
- end
15
-
16
- it 'should reload the library' do
17
- @library.should_receive(:reload)
18
- @command.execute '123'
19
- end
20
- end
@@ -1,31 +0,0 @@
1
- require_relative '../../spec_helper'
2
- require 'hearken/command/shuffle'
3
-
4
- describe Hearken::Command::Shuffle do
5
- extend ShellShock::CommandSpec
6
-
7
- with_usage ''
8
- with_help 'shuffles the current queue'
9
-
10
- before do
11
- @player = stub 'player'
12
- @command = Hearken::Command::Shuffle.new @player
13
- end
14
-
15
- it 'should dequeue all tracks, shuffle then enqueue them' do
16
- track = stub 'track'
17
- track.should_receive(:id).and_return 1
18
- track.should_receive(:id).and_return 2
19
- track.should_receive(:id).and_return 3
20
- @player.should_receive(:dequeue).and_return track
21
- @player.should_receive(:dequeue).and_return track
22
- @player.should_receive(:dequeue).and_return track
23
- @player.should_receive(:dequeue).and_return nil
24
-
25
- @player.should_receive(:enqueue).with 3
26
- @player.should_receive(:enqueue).with 2
27
- @player.should_receive(:enqueue).with 1
28
-
29
- @command.execute
30
- end
31
- end
@@ -1,38 +0,0 @@
1
- require_relative '../spec_helper'
2
- require 'hearken/player'
3
-
4
- describe Hearken::Player do
5
- let(:preferences) { {} }
6
- let(:player) { Hearken::Player.new preferences }
7
-
8
- before do
9
- scrobbler = mock 'scrobbler'
10
- library = mock 'library'
11
- Hearken::Scrobbler.stub!(:new).and_return scrobbler
12
- Hearken::Library.stub!(:new).and_return library
13
- library.stub! :reload
14
- scrobbler.stub! :enabled=
15
- end
16
-
17
- describe '#current' do
18
- it 'should return current_track when player has pid and file is present' do
19
- player.instance_eval { @pid = 1 }
20
- hash = stub 'hash'
21
- File.stub!(:exist?).with('current_song').and_return true
22
- YAML.stub!(:load_file).with('current_song').and_return hash
23
- player.current.should == hash
24
- end
25
-
26
- it 'should return nil when player has no pid and file is present' do
27
- player.instance_eval { @pid = nil }
28
- File.stub!(:exist?).with('current_song').and_return true
29
- player.current.should == nil
30
- end
31
-
32
- it 'should return nil when has pid and file is not present' do
33
- player.instance_eval { @pid = 1 }
34
- File.stub!(:exist?).with('current_song').and_return false
35
- player.current.should == nil
36
- end
37
- end
38
- end
@@ -1,28 +0,0 @@
1
- require_relative '../spec_helper'
2
- require 'hearken/range_expander'
3
-
4
- describe Hearken::RangeExpander do
5
- before do
6
- @expander = Hearken::RangeExpander.new
7
- end
8
-
9
- it 'should expand single values' do
10
- @expander.expand('123').should == [1371]
11
- end
12
-
13
- it 'should expand multiple values separated by any non digit' do
14
- @expander.expand("123 \t 456 , 789 ").should == [1371, 5370, 9369]
15
- end
16
-
17
- it 'should expand a fully specified range' do
18
- @expander.expand(" 456-45i ").should == (5370..5382).to_a
19
- end
20
-
21
- it 'should expand an abbreviated range' do
22
- @expander.expand(" 456-i ").should == (5370..5382).to_a
23
- end
24
-
25
- it 'should expand ids for a range' do
26
- @expander.expand_to_ids(" s-z ").should == %w{s t u v w x y z}
27
- end
28
- end
data/spec/spec_helper.rb DELETED
@@ -1,5 +0,0 @@
1
- $: << File.expand_path('../../lib', __FILE__)
2
-
3
- require 'bundler/setup'
4
- require 'rspec'
5
- require 'shell_shock/command_spec'