songbirdsh 0.0.1 → 0.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.
data/HISTORY.rdoc ADDED
@@ -0,0 +1,13 @@
1
+ = 0.0.2
2
+
3
+ Enhanced search
4
+
5
+ * Improved search (breaks string into terms and returns tracks with all terms)
6
+ * Adds search results to clipboard to make it fast and easy to enqueue
7
+
8
+ = 0.0.1
9
+
10
+ Initial release
11
+
12
+ * Plays tracks
13
+ * Searches database (pretty unusable - searches by substring of 'artist album track')
data/gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'songbirdsh'
3
- spec.version = '0.0.1'
3
+ spec.version = '0.0.2'
4
4
  spec.summary = 'command line jukebox music player'
5
5
  spec.description = <<-EOF
6
6
  A command line jukebox music player that uses your songbird music player database
@@ -8,7 +8,7 @@ EOF
8
8
  spec.authors << 'Mark Ryall'
9
9
  spec.email = 'mark@ryall.name'
10
10
  spec.homepage = 'http://github.com/markryall/songbirdsh'
11
- spec.files = Dir['lib/**/*'] + Dir['bin/*'] + ['README.rdoc', 'MIT-LICENSE', 'gemspec']
11
+ spec.files = Dir['lib/**/*'] + Dir['bin/*'] + ['README.rdoc', 'HISTORY.rdoc','MIT-LICENSE', 'gemspec']
12
12
  spec.executables << 'songbirdsh'
13
13
 
14
14
  spec.add_dependency 'splat', '~>0.1'
@@ -19,4 +19,4 @@ EOF
19
19
 
20
20
  spec.add_development_dependency 'rake', '~>0.8.7'
21
21
  spec.add_development_dependency 'gemesis', '~>0.0.4'
22
- end
22
+ end
@@ -18,15 +18,15 @@ class Songbirdsh::Cli
18
18
  library = Songbirdsh::Library.new
19
19
  player = Songbirdsh::Player.new library
20
20
  at_exit { player.stop }
21
- @prompt_text = "sbsh > "
21
+ @prompt = "songbirdsh > "
22
22
  @commands = {
23
23
  'show' => Songbirdsh::Command::ShowProperties.new(library),
24
- '+' => Songbirdsh::Command::Enqueue.new(library),
25
- 'start' => Songbirdsh::Command::Start.new(player),
26
- 'stop' => Songbirdsh::Command::Stop.new(player),
27
24
  'next' => Songbirdsh::Command::Restart.new(player),
28
25
  'reload' => Songbirdsh::Command::Reload.new(library),
29
- 'search' => Songbirdsh::Command::Search.new(library)
26
+ 'search' => Songbirdsh::Command::Search.new(library),
27
+ '+' => Songbirdsh::Command::Enqueue.new(player),
28
+ 'start' => Songbirdsh::Command::Start.new(player),
29
+ 'stop' => Songbirdsh::Command::Stop.new(player)
30
30
  }
31
31
  end
32
32
  end
@@ -1,16 +1,11 @@
1
1
  require 'yaml'
2
2
 
3
3
  class Songbirdsh::Command::Enqueue
4
- def initialize library
5
- @library = library
4
+ def initialize player
5
+ @player = player
6
6
  end
7
7
 
8
8
  def execute text
9
- ids = text.split(/\W/)
10
- @library.with_db do |db|
11
- ids.each do |id|
12
- File.open("#{Time.now.to_i}-#{(rand*1000).to_i}.song", 'w') {|f| f.print db[:media_items][:media_item_id=>id].to_yaml }
13
- end
14
- end
9
+ text.split(/\W/).each {|id| @player.enqueue id }
15
10
  end
16
11
  end
@@ -4,8 +4,16 @@ class Songbirdsh::Command::Search
4
4
  end
5
5
 
6
6
  def execute text
7
+ terms = text.split(/\W/)
8
+ matches = []
9
+ @library.reload unless @library.tracks
7
10
  @library.tracks.each do |track|
8
- puts track[:display] if track[:search_string].include? text
11
+ if terms.all? {|term| track[:search_string].include? term }
12
+ puts track[:display]
13
+ matches << track[:id]
14
+ end
9
15
  end
16
+ puts "Found #{matches.size} matches (ids have been placed on clipboard)"
17
+ matches.join(' ').to_clipboard
10
18
  end
11
19
  end
@@ -1,7 +1,7 @@
1
1
  module Songbirdsh::Queue
2
2
  def enqueue id
3
- with_db do |db|
4
- File.open("#{Time.now.to_i}-#{(rand*1000).to_i}.song", 'w') {|f| f.print db[:media_items][:media_item_id=>id].to_yaml }
3
+ @library.with_db do |db|
4
+ File.open("#{Time.now.to_i}-#{id}.song", 'w') {|f| f.print db[:media_items][:media_item_id=>id].to_yaml }
5
5
  end
6
6
  end
7
7
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mark Ryall
@@ -141,6 +141,7 @@ files:
141
141
  - lib/songbirdsh.rb
142
142
  - bin/songbirdsh
143
143
  - README.rdoc
144
+ - HISTORY.rdoc
144
145
  - MIT-LICENSE
145
146
  - gemspec
146
147
  has_rdoc: true