hearken 0.1.0 → 0.1.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.
- data/.cards/4d6da46f-8838-488f-997b-9ec873092d5d +2 -0
- data/.cards/68695ed3-ef6c-4c65-939e-48695a4511c8 +2 -0
- data/.cards/6ed72945-35a4-4372-97d8-13b357d8c7c0 +2 -0
- data/.cards/91de072e-4427-48dc-89ad-0b03756eb689 +2 -0
- data/.cards/9242c879-a66f-4144-8f24-b05f7c5a49f3 +2 -0
- data/.cards/94f23de2-4e0c-417a-aa82-3147908e2481 +2 -0
- data/.cards/a5be50c4-2117-4ecf-bc64-e9977f4d52c1 +2 -0
- data/.cards/f742a9f4-36af-43e5-a7cb-480049a43821 +2 -0
- data/HISTORY.rdoc +7 -0
- data/README.rdoc +6 -7
- data/hearken.gemspec +15 -1
- data/lib/hearken.rb +1 -1
- data/lib/hearken/command/search.rb +1 -1
- data/lib/hearken/indexing/audio_traverser.rb +1 -1
- data/lib/hearken/indexing/ffmpeg_file.rb +22 -13
- data/lib/hearken/indexing/indexer.rb +1 -2
- data/lib/hearken/monkey_violence.rb +5 -5
- data/lib/hearken/player.rb +16 -4
- data/lib/hearken/scrobbler.rb +2 -3
- metadata +53 -24
- data/.rvmrc +0 -1
data/HISTORY.rdoc
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
= 0.1.1
|
2
|
+
|
3
|
+
* added use of sox to play more audio file formats (now m4a and mp3 with afplay and sox for everything else)
|
4
|
+
* fixed some issues with the parsing of ffmpeg output to get correct tag information
|
5
|
+
* added logging of played tracks to history file
|
6
|
+
* removed splat dependency (because it is just silly)
|
7
|
+
|
1
8
|
= 0.1.0
|
2
9
|
|
3
10
|
* removed several dependencies - simple_scrobbler and thor
|
data/README.rdoc
CHANGED
@@ -4,7 +4,7 @@ This is a command line shell for queuing and playing music tracks.
|
|
4
4
|
|
5
5
|
It also extracts id3 tags from audio files for faster search.
|
6
6
|
|
7
|
-
This
|
7
|
+
This may may be platform independent but at this stage has only been used on mac os x
|
8
8
|
|
9
9
|
= Usage
|
10
10
|
|
@@ -20,6 +20,10 @@ Tags are currently extracted using ffmpeg. On mac os x, this can be installed e
|
|
20
20
|
|
21
21
|
brew install ffmpeg
|
22
22
|
|
23
|
+
Tracks are played using sox (afplay is preinstalled on a mac but does not support as many audio formats) which can also be installed with brew:
|
24
|
+
|
25
|
+
brew install sox
|
26
|
+
|
23
27
|
Growl notification (as new tracks are played) will work but only if 'growlnotify' is detected on the path.
|
24
28
|
|
25
29
|
== Indexing tracks
|
@@ -94,9 +98,4 @@ Turns scrobbling on (has no effect if scrobbling has not been configured)
|
|
94
98
|
|
95
99
|
scrobbling off
|
96
100
|
|
97
|
-
Turns scrobbling off
|
98
|
-
|
99
|
-
= Future plans for world domination
|
100
|
-
|
101
|
-
* Get working on linux
|
102
|
-
* Get working on windows
|
101
|
+
Turns scrobbling off
|
data/hearken.gemspec
CHANGED
@@ -17,6 +17,19 @@ This also extracts the tags from a collection of folders.
|
|
17
17
|
This replaces and combines the functionality from a couple of other gems (audio_library and songbirdsh).
|
18
18
|
EOF
|
19
19
|
|
20
|
+
s.post_install_message = <<EOF
|
21
|
+
Hey - thanks for installing hearken.
|
22
|
+
|
23
|
+
Before doing anything else, you should index your music collection by running:
|
24
|
+
|
25
|
+
hearken_index path_to_your_music_collection
|
26
|
+
|
27
|
+
This could take a while if you have a large collection - you should hear some applause when it's done
|
28
|
+
|
29
|
+
After that just run hearken to start playing, queueing and rocking out.
|
30
|
+
EOF
|
31
|
+
|
32
|
+
s.license = 'MIT'
|
20
33
|
s.rubyforge_project = "hearken"
|
21
34
|
|
22
35
|
s.files = `git ls-files`.split("\n")
|
@@ -24,7 +37,8 @@ EOF
|
|
24
37
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
25
38
|
s.require_paths = ["lib"]
|
26
39
|
|
27
|
-
s.
|
40
|
+
s.required_ruby_version = '>= 1.9.2'
|
41
|
+
|
28
42
|
s.add_dependency 'shell_shock', '~>0'
|
29
43
|
s.add_dependency 'rainbow', '~> 1'
|
30
44
|
s.add_dependency 'nokogiri', '~> 1'
|
data/lib/hearken.rb
CHANGED
@@ -18,25 +18,34 @@ class Hearken::Indexing::FfmpegFile
|
|
18
18
|
if state == :metadata
|
19
19
|
begin
|
20
20
|
m = / *: */.match l
|
21
|
-
|
21
|
+
add_meta m.pre_match.strip.downcase.to_sym, m.post_match.strip if m
|
22
22
|
rescue ArgumentError => e
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
@title =
|
29
|
-
@album =
|
30
|
-
@artist =
|
31
|
-
@albumartist =
|
32
|
-
@time = to_duration
|
33
|
-
@date =
|
34
|
-
@track =
|
35
|
-
@puid =
|
36
|
-
@mbartistid =
|
37
|
-
@mbalbumid =
|
38
|
-
@mbalbumartistid =
|
39
|
-
@asin =
|
28
|
+
@title = tag :title, :tit2
|
29
|
+
@album = tag :album, :talb
|
30
|
+
@artist = tag :artist, :tpe1, :tpe2
|
31
|
+
@albumartist = tag :album_artist, :tso2
|
32
|
+
@time = to_duration tag :duration
|
33
|
+
@date = tag :date, :tdrc, :tyer
|
34
|
+
@track = tag :track, :trck
|
35
|
+
@puid = tag :"musicip puid"
|
36
|
+
@mbartistid = tag :musicbrainz_artistid, :"musicbrainz artist id"
|
37
|
+
@mbalbumid = tag :musicbrainz_albumid,:"musicbrainz album id"
|
38
|
+
@mbalbumartistid = tag :musicbrainz_albumartistid, :"musicbrainz album artist id"
|
39
|
+
@asin = tag :asin
|
40
|
+
end
|
41
|
+
|
42
|
+
def add_meta key, value
|
43
|
+
@meta[key] ||= value
|
44
|
+
end
|
45
|
+
|
46
|
+
def tag *names
|
47
|
+
names.each { |name| return @meta[name] if @meta[name] }
|
48
|
+
nil
|
40
49
|
end
|
41
50
|
|
42
51
|
def method_missing method
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'splat'
|
2
1
|
require 'hearken/paths'
|
3
2
|
require 'hearken/indexing/persistant_traverser'
|
4
3
|
|
@@ -22,7 +21,7 @@ class Hearken::Indexing::Indexer
|
|
22
21
|
|
23
22
|
show_progress start, count
|
24
23
|
|
25
|
-
|
24
|
+
system "play -q #{File.dirname(__FILE__)}/../../../media/applause.mp3"
|
26
25
|
end
|
27
26
|
private
|
28
27
|
def show_progress start, count
|
@@ -4,18 +4,18 @@ class String
|
|
4
4
|
end
|
5
5
|
|
6
6
|
def escape char
|
7
|
-
gsub(char
|
7
|
+
gsub(char) { "\\#{char}" }
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
11
|
-
|
10
|
+
def escape_all chars
|
11
|
+
chars.inject(self) {|s,t| s.escape t }
|
12
12
|
end
|
13
13
|
|
14
14
|
def escape_for_sh
|
15
|
-
self.
|
15
|
+
self.escape_all " `';&!()$".scan(/./)
|
16
16
|
end
|
17
17
|
|
18
18
|
def escape_for_sh_quoted
|
19
|
-
self.
|
19
|
+
self.escape '`'
|
20
20
|
end
|
21
21
|
end
|
data/lib/hearken/player.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'splat'
|
2
1
|
require 'fileutils'
|
3
2
|
|
4
3
|
require 'hearken/queue'
|
@@ -52,6 +51,7 @@ module Hearken
|
|
52
51
|
track.started = Time.now.to_i
|
53
52
|
in_base_dir do
|
54
53
|
File.open('current_song', 'w') {|f| f.print track.to_yaml }
|
54
|
+
File.open('history', 'a') {|f| f.puts "#{track.started},#{track.path}"}
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -67,7 +67,7 @@ module Hearken
|
|
67
67
|
@scrobbler.enabled = tf
|
68
68
|
end
|
69
69
|
|
70
|
-
def random_track
|
70
|
+
def random_track
|
71
71
|
@library.row (rand * @library.count).to_i
|
72
72
|
end
|
73
73
|
|
@@ -93,16 +93,28 @@ module Hearken
|
|
93
93
|
end
|
94
94
|
notify_started track
|
95
95
|
register track
|
96
|
-
player_pid = track.path
|
96
|
+
player_pid = spawn play_command track.path
|
97
97
|
Process.wait player_pid
|
98
98
|
notify_finished track
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
+
def play_command path
|
104
|
+
if %w{m4a mp3}.include? path.split('.').last
|
105
|
+
"afplay \"#{path.escape("\`")}\""
|
106
|
+
else
|
107
|
+
"play -q \"#{path.escape("\`")}\""
|
108
|
+
end.tap do |command|
|
109
|
+
in_base_dir do
|
110
|
+
File.open('player', 'a') {|f| f.puts command }
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
103
115
|
def stop
|
104
116
|
return unless @pid
|
105
|
-
Process.kill 'TERM', @pid
|
117
|
+
Process.kill 'TERM', @pid
|
106
118
|
@pid = nil
|
107
119
|
end
|
108
120
|
|
data/lib/hearken/scrobbler.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'splat'
|
2
1
|
require 'hearken/simple_scrobbler'
|
3
2
|
require 'hearken/debug'
|
4
3
|
|
@@ -42,7 +41,7 @@ module Hearken
|
|
42
41
|
|
43
42
|
def profile
|
44
43
|
return unless @scrobbler
|
45
|
-
@scrobbler.with_profile_url {|url| url
|
44
|
+
@scrobbler.with_profile_url {|url| system "open #{url}" }
|
46
45
|
end
|
47
46
|
|
48
47
|
def ask question
|
@@ -55,7 +54,7 @@ module Hearken
|
|
55
54
|
preferences['user'] = ask 'What is your lastfm user name ? '
|
56
55
|
@scrobbler = SimpleScrobbler.new API_KEY, SECRET, preferences['user']
|
57
56
|
preferences['session_key'] = @scrobbler.fetch_session_key do |url|
|
58
|
-
url
|
57
|
+
system "open '#{url}'"
|
59
58
|
ask 'Please hit enter when you\'ve allowed this application access to your account'
|
60
59
|
end
|
61
60
|
@preferences['lastfm'] = preferences
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hearken
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-12-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement:
|
15
|
+
name: shell_shock
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,21 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: shell_shock
|
27
|
-
requirement: &70202662969820 !ruby/object:Gem::Requirement
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
25
|
none: false
|
29
26
|
requirements:
|
30
27
|
- - ~>
|
31
28
|
- !ruby/object:Gem::Version
|
32
29
|
version: '0'
|
33
|
-
type: :runtime
|
34
|
-
prerelease: false
|
35
|
-
version_requirements: *70202662969820
|
36
30
|
- !ruby/object:Gem::Dependency
|
37
31
|
name: rainbow
|
38
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
39
33
|
none: false
|
40
34
|
requirements:
|
41
35
|
- - ~>
|
@@ -43,10 +37,15 @@ dependencies:
|
|
43
37
|
version: '1'
|
44
38
|
type: :runtime
|
45
39
|
prerelease: false
|
46
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1'
|
47
46
|
- !ruby/object:Gem::Dependency
|
48
47
|
name: nokogiri
|
49
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
50
49
|
none: false
|
51
50
|
requirements:
|
52
51
|
- - ~>
|
@@ -54,10 +53,15 @@ dependencies:
|
|
54
53
|
version: '1'
|
55
54
|
type: :runtime
|
56
55
|
prerelease: false
|
57
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1'
|
58
62
|
- !ruby/object:Gem::Dependency
|
59
63
|
name: rake
|
60
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
61
65
|
none: false
|
62
66
|
requirements:
|
63
67
|
- - ~>
|
@@ -65,10 +69,15 @@ dependencies:
|
|
65
69
|
version: '0'
|
66
70
|
type: :development
|
67
71
|
prerelease: false
|
68
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
69
78
|
- !ruby/object:Gem::Dependency
|
70
79
|
name: rspec
|
71
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
72
81
|
none: false
|
73
82
|
requirements:
|
74
83
|
- - ~>
|
@@ -76,7 +85,12 @@ dependencies:
|
|
76
85
|
version: '2'
|
77
86
|
type: :development
|
78
87
|
prerelease: false
|
79
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '2'
|
80
94
|
description: ! 'A command line tool to enqueue and play music tracks.
|
81
95
|
|
82
96
|
|
@@ -95,8 +109,15 @@ executables:
|
|
95
109
|
extensions: []
|
96
110
|
extra_rdoc_files: []
|
97
111
|
files:
|
112
|
+
- .cards/4d6da46f-8838-488f-997b-9ec873092d5d
|
113
|
+
- .cards/68695ed3-ef6c-4c65-939e-48695a4511c8
|
114
|
+
- .cards/6ed72945-35a4-4372-97d8-13b357d8c7c0
|
115
|
+
- .cards/91de072e-4427-48dc-89ad-0b03756eb689
|
116
|
+
- .cards/9242c879-a66f-4144-8f24-b05f7c5a49f3
|
117
|
+
- .cards/94f23de2-4e0c-417a-aa82-3147908e2481
|
118
|
+
- .cards/a5be50c4-2117-4ecf-bc64-e9977f4d52c1
|
119
|
+
- .cards/f742a9f4-36af-43e5-a7cb-480049a43821
|
98
120
|
- .gitignore
|
99
|
-
- .rvmrc
|
100
121
|
- Gemfile
|
101
122
|
- HISTORY.rdoc
|
102
123
|
- MIT-LICENSE
|
@@ -156,8 +177,13 @@ files:
|
|
156
177
|
- spec/hearken/range_expander_spec.rb
|
157
178
|
- spec/spec_helper.rb
|
158
179
|
homepage: http://github.com/markryall/hearken
|
159
|
-
licenses:
|
160
|
-
|
180
|
+
licenses:
|
181
|
+
- MIT
|
182
|
+
post_install_message: ! "Hey - thanks for installing hearken.\n\nBefore doing anything
|
183
|
+
else, you should index your music collection by running:\n\n hearken_index path_to_your_music_collection\n\nThis
|
184
|
+
could take a while if you have a large collection - you should hear some applause
|
185
|
+
when it's done\n\nAfter that just run hearken to start playing, queueing and rocking
|
186
|
+
out.\n"
|
161
187
|
rdoc_options: []
|
162
188
|
require_paths:
|
163
189
|
- lib
|
@@ -166,16 +192,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
166
192
|
requirements:
|
167
193
|
- - ! '>='
|
168
194
|
- !ruby/object:Gem::Version
|
169
|
-
version:
|
195
|
+
version: 1.9.2
|
170
196
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
197
|
none: false
|
172
198
|
requirements:
|
173
199
|
- - ! '>='
|
174
200
|
- !ruby/object:Gem::Version
|
175
201
|
version: '0'
|
202
|
+
segments:
|
203
|
+
- 0
|
204
|
+
hash: 2801778265441540950
|
176
205
|
requirements: []
|
177
206
|
rubyforge_project: hearken
|
178
|
-
rubygems_version: 1.8.
|
207
|
+
rubygems_version: 1.8.23
|
179
208
|
signing_key:
|
180
209
|
specification_version: 3
|
181
210
|
summary: command line music player
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm use 1.9.2@hearken --create
|