dhun 0.7.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +68 -53
- data/TODO.md +0 -2
- data/dhun.gemspec +3 -2
- data/lib/dhun.rb +1 -1
- data/lib/dhun/handler.rb +1 -1
- data/lib/dhun/player.rb +16 -0
- data/lib/dhun/runner.rb +20 -7
- metadata +22 -2
data/README.md
CHANGED
@@ -19,7 +19,15 @@ put the binaries in the right place. You will need to have XCode installed for
|
|
19
19
|
the `gem` command to compile the native extensions.
|
20
20
|
|
21
21
|
$ gem sources -a http://gemcutter.org
|
22
|
-
$ gem install dhun
|
22
|
+
$ gem install dhun
|
23
|
+
|
24
|
+
Or to install the bleeding edge, git pull from the repository and run:
|
25
|
+
|
26
|
+
$ sudo rake gem install
|
27
|
+
|
28
|
+
For notifications, you will need [Growl](http://growl.info) installed along
|
29
|
+
with the [growlnotify](http://growl.info/documentation/growlnotify.php) tool
|
30
|
+
that comes with Growl (but needs to be installed separately).
|
23
31
|
|
24
32
|
### Starting Dhun
|
25
33
|
|
@@ -44,25 +52,23 @@ You can also query the Spotlight database before playing the files, with the
|
|
44
52
|
|
45
53
|
$ dhun query deadmau5
|
46
54
|
|
47
|
-
Querying: deadmau5 |
|
48
|
-
1 : /Volumes/Storage/Music/Grand.Theft.Auto.IV-Radio.Station.Rips-AiTB/Electro-Choc/
|
49
|
-
2 : /Volumes/Storage/Music/Deadmau5 -
|
50
|
-
3 :
|
51
|
-
4 :
|
52
|
-
5 :
|
53
|
-
|
54
|
-
|
55
|
+
Querying: deadmau5 | 6 Results
|
56
|
+
1 : /Volumes/Storage/Music/Grand.Theft.Auto.IV-Radio.Station.Rips-AiTB/Electro-Choc/03 One + One - No Pressure (Deadmau5 Remix).mp3
|
57
|
+
2 : /Volumes/Storage/Music/Grand.Theft.Auto.IV-Radio.Station.Rips-AiTB/Electro-Choc/09 Chris Lake vs. Deadmau5 - I Thought Inside Out (Original Mix).mp3
|
58
|
+
3 : Deadmau5 - Alone With You
|
59
|
+
4 : Deadmau5 - Arguru (EDX's 5un5hine Remix)
|
60
|
+
5 : Deadmau5 - Bye Friend
|
61
|
+
6 : Deadmau5 - Clockwork
|
55
62
|
|
56
63
|
you can query based on certain filters such as artist,albums, title, genre and file.
|
57
64
|
|
58
65
|
$ dhun query --artist="Paul van Dyk" --genre=trance --file 'Paul' --title in
|
59
66
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
67
|
+
Querying: [nil] | artist:Paul van Dyk title:in genre:trance file:Paul
|
68
|
+
3 Results
|
69
|
+
1 : Paul van Dyk - Talk In Grey
|
70
|
+
2 : Paul van Dyk - In Circles
|
71
|
+
3 : Paul van Dyk - In Between
|
66
72
|
|
67
73
|
YOu can mix filters with regular queries as well.
|
68
74
|
|
@@ -70,20 +76,26 @@ YOu can mix filters with regular queries as well.
|
|
70
76
|
|
71
77
|
Querying: paul | title:haunted
|
72
78
|
1 Results
|
73
|
-
1 :
|
79
|
+
1 : Paul van Dyk - Haunted
|
74
80
|
|
75
81
|
You can also pass in multiple regular expressions too. they just need to be seperated by commas (,)
|
76
82
|
|
77
83
|
$ dhun query paul,trance
|
78
84
|
|
79
|
-
Querying: paul,trance |
|
80
|
-
1 :
|
81
|
-
2 :
|
82
|
-
3 :
|
83
|
-
4 :
|
84
|
-
5 :
|
85
|
-
6 :
|
86
|
-
|
85
|
+
Querying: paul,trance | 13 Results
|
86
|
+
1 : Paul van Dyk - Volume (Productions)
|
87
|
+
2 : Paul van Dyk - Volume (Remixes Part 1)
|
88
|
+
3 : Paul van Dyk - Volume (Remixes Part 2)
|
89
|
+
4 : Paul van Dyk - Complicated (Feat. Ashley Tomberlin)
|
90
|
+
5 : Paul van Dyk - Haunted
|
91
|
+
6 : Paul van Dyk - White Lies (Feat. Jessica Sutta)
|
92
|
+
7 : Paul van Dyk - Sabotage
|
93
|
+
8 : Paul van Dyk - Get Back (Feat. Ashley Tomberlin)
|
94
|
+
9 : Paul van Dyk - Far Away
|
95
|
+
10 : Paul van Dyk - Another Sunday
|
96
|
+
11 : Paul van Dyk - Talk In Grey
|
97
|
+
12 : Paul van Dyk - In Circles
|
98
|
+
13 : Paul van Dyk - In Between
|
87
99
|
|
88
100
|
Now lets put it all together and go crazy.
|
89
101
|
|
@@ -91,8 +103,7 @@ Now lets put it all together and go crazy.
|
|
91
103
|
|
92
104
|
Querying: paul van,dyk | title:haunted genre:trance
|
93
105
|
1 Results
|
94
|
-
1 :
|
95
|
-
|
106
|
+
1 : Paul van Dyk - Haunted
|
96
107
|
|
97
108
|
### Playing Files
|
98
109
|
|
@@ -104,13 +115,20 @@ this can also be done by
|
|
104
115
|
|
105
116
|
$ dhun enqueue paul,trance
|
106
117
|
|
107
|
-
Querying: paul,trance |
|
108
|
-
1 :
|
109
|
-
2 :
|
110
|
-
3 :
|
111
|
-
4 :
|
112
|
-
5 :
|
113
|
-
6 :
|
118
|
+
Querying: paul,trance | 13 Results
|
119
|
+
1 : Paul van Dyk - Volume (Productions)
|
120
|
+
2 : Paul van Dyk - Volume (Remixes Part 1)
|
121
|
+
3 : Paul van Dyk - Volume (Remixes Part 2)
|
122
|
+
4 : Paul van Dyk - Complicated (Feat. Ashley Tomberlin)
|
123
|
+
5 : Paul van Dyk - Haunted
|
124
|
+
6 : Paul van Dyk - White Lies (Feat. Jessica Sutta)
|
125
|
+
7 : Paul van Dyk - Sabotage
|
126
|
+
8 : Paul van Dyk - Get Back (Feat. Ashley Tomberlin)
|
127
|
+
9 : Paul van Dyk - Far Away
|
128
|
+
10 : Paul van Dyk - Another Sunday
|
129
|
+
11 : Paul van Dyk - Talk In Grey
|
130
|
+
12 : Paul van Dyk - In Circles
|
131
|
+
13 : Paul van Dyk - In Between
|
114
132
|
Enter index to queue:
|
115
133
|
|
116
134
|
It will prompt you to enter the index of the songs you want queued.(numbers on the left side)
|
@@ -119,16 +137,14 @@ If you leave the prompt blank and enter, it will queue ALL the resulting songs.
|
|
119
137
|
|
120
138
|
Enter index to queue 4 5
|
121
139
|
selected:
|
122
|
-
1 :
|
123
|
-
2 :
|
140
|
+
1 : Paul van Dyk - Complicated (Feat. Ashley Tomberlin)
|
141
|
+
2 : Paul van Dyk - Haunted
|
124
142
|
2 files queued
|
125
143
|
|
126
|
-
|
127
144
|
Once queued, the songs will begin playing. You can continue to enqueue more songs using `enqueue` command.
|
128
145
|
|
129
146
|
### Controlling Playback
|
130
147
|
|
131
|
-
|
132
148
|
Starting Playback(needs to have songs in queue)
|
133
149
|
|
134
150
|
$ dhun play
|
@@ -169,9 +185,12 @@ Shuffling the queue
|
|
169
185
|
|
170
186
|
$ dhun shuffle
|
171
187
|
Queue is shuffled
|
172
|
-
|
173
|
-
|
174
|
-
|
188
|
+
Queue:
|
189
|
+
1 : Deadmau5 - I Remember (Vocal Mix)
|
190
|
+
2 : Paul van Dyk - Haunted
|
191
|
+
3 : Above & Beyond - I Am What I Am
|
192
|
+
4 : Above & Beyond - Sirens Of The Sea
|
193
|
+
5 : Paul van Dyk - Haunted
|
175
194
|
|
176
195
|
### Other commands
|
177
196
|
|
@@ -180,22 +199,23 @@ Status
|
|
180
199
|
$ dhun status
|
181
200
|
Dhun is running
|
182
201
|
Currently Playing:
|
183
|
-
|
202
|
+
Deadmau5 - I Remember (Vocal Mix)
|
184
203
|
Queue:
|
185
|
-
1 :
|
186
|
-
2 :
|
204
|
+
1 : Paul van Dyk - Haunted
|
205
|
+
2 : Above & Beyond - I Am What I Am
|
206
|
+
3 : Above & Beyond - Sirens Of The Sea
|
187
207
|
|
188
208
|
History
|
189
209
|
|
190
210
|
$ dhun history
|
191
211
|
1 files in history
|
192
212
|
History:
|
193
|
-
|
213
|
+
1 : Deadmau5 - I Remember Feat Kaskade (Instrumental Mix)
|
194
214
|
|
195
215
|
Saving Playlist
|
196
216
|
|
197
217
|
$ dhun save_playlist /tmp/playlist.pls
|
198
|
-
created /tmp/playlist
|
218
|
+
created /tmp/playlist.plsg
|
199
219
|
|
200
220
|
Loading Playlist
|
201
221
|
|
@@ -210,18 +230,13 @@ This will exit the dhun server.
|
|
210
230
|
|
211
231
|
$ dhun stop_server
|
212
232
|
|
213
|
-
##
|
214
|
-
|
215
|
-
There are some features planned in the short run. Please file an issue with a
|
216
|
-
feature request, if you have one.
|
233
|
+
## New Features
|
217
234
|
|
218
|
-
|
219
|
-
* Growl Notifications using `growlnotify`
|
235
|
+
Please file an issue with a feature request, if you have one.
|
220
236
|
|
221
|
-
|
237
|
+
These things are planned someday:
|
222
238
|
|
223
239
|
* iTunes integration
|
224
|
-
* Displaying IDv3 information instead of just file names
|
225
240
|
|
226
241
|
## Feedback
|
227
242
|
|
data/TODO.md
CHANGED
data/dhun.gemspec
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'dhun'
|
3
|
-
s.version = '0.
|
3
|
+
s.version = '0.8.1'
|
4
4
|
s.summary = "Minimalist music player for OS X"
|
5
|
-
s.date = '2010-01-24'
|
6
5
|
s.email = 'deepak.jois@gmail.com'
|
7
6
|
s.homepage = 'http://github.com/deepakjois/dhun'
|
8
7
|
s.has_rdoc = false
|
@@ -12,6 +11,8 @@ Gem::Specification.new do |s|
|
|
12
11
|
s.add_dependency('json_pure', '>=1.2.0')
|
13
12
|
s.add_dependency('daemons', '>=1.0.10')
|
14
13
|
s.add_dependency('thor', '>=0.12.0')
|
14
|
+
s.add_dependency('ruby-mp3info','>=0.6.13')
|
15
|
+
s.add_dependency('visionmedia-growl','>=1.0.3')
|
15
16
|
s.authors = ["Deepak Jois"]
|
16
17
|
# = MANIFEST =
|
17
18
|
s.files = %w[
|
data/lib/dhun.rb
CHANGED
data/lib/dhun/handler.rb
CHANGED
@@ -90,7 +90,7 @@ module Dhun
|
|
90
90
|
#next and previous method
|
91
91
|
def next_prev(action,message,skip_length)
|
92
92
|
track = @player.send(action,skip_length)
|
93
|
-
return [:success,
|
93
|
+
return [:success, track] if track
|
94
94
|
return [:error, "Not enough tracks in #{message}"]
|
95
95
|
end
|
96
96
|
|
data/lib/dhun/player.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
require 'singleton'
|
2
2
|
require 'dhun_ext'
|
3
|
+
require 'growl'
|
4
|
+
require 'mp3info'
|
3
5
|
module Dhun
|
4
6
|
class Player
|
5
7
|
include Singleton
|
8
|
+
include Growl
|
6
9
|
|
7
10
|
attr_accessor :queue,:history,:status,:current
|
8
11
|
|
@@ -51,6 +54,7 @@ module Dhun
|
|
51
54
|
if @status == :paused
|
52
55
|
@status = :playing
|
53
56
|
DhunExt.resume
|
57
|
+
notify mp3_tag(@current),:sticky => false
|
54
58
|
return true
|
55
59
|
end
|
56
60
|
return false
|
@@ -115,11 +119,23 @@ module Dhun
|
|
115
119
|
|
116
120
|
private
|
117
121
|
|
122
|
+
# returns song in Artist - Title format
|
123
|
+
# if no tags or non-existent, return its input
|
124
|
+
# TODO
|
125
|
+
def mp3_tag(song)
|
126
|
+
return song unless File.exists?(song)
|
127
|
+
Mp3Info.open(song) do |mp3|
|
128
|
+
artist = mp3.tag.artist ; title = mp3.tag.title
|
129
|
+
(artist and title) ? "#{artist} - #{title}" : song
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
118
133
|
# play method's player thread
|
119
134
|
def play_thread
|
120
135
|
Thread.new do
|
121
136
|
while @status == :playing and !@queue.empty?
|
122
137
|
@current = @queue.shift
|
138
|
+
notify mp3_tag(@current),:sticky => false
|
123
139
|
DhunExt.play_file @current
|
124
140
|
@history.unshift @current
|
125
141
|
end
|
data/lib/dhun/runner.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'thor'
|
2
2
|
require 'json'
|
3
|
+
require 'mp3info'
|
3
4
|
|
4
5
|
module Dhun
|
5
6
|
|
@@ -116,7 +117,7 @@ module Dhun
|
|
116
117
|
response = return_response(:status,[:current,:queue])
|
117
118
|
return false unless response
|
118
119
|
say "Currently Playing:",:magenta
|
119
|
-
say response[:current],:white
|
120
|
+
say mp3_tag(response[:current]),:white
|
120
121
|
say "Queue:",:cyan
|
121
122
|
say_list response[:queue]
|
122
123
|
end
|
@@ -160,7 +161,7 @@ module Dhun
|
|
160
161
|
end
|
161
162
|
create_file path, playlist_save
|
162
163
|
end
|
163
|
-
|
164
|
+
|
164
165
|
desc "load_playlist PATH", "loads the playlist"
|
165
166
|
def load_playlist(path=nil)
|
166
167
|
unless File.exists?(path) or path.nil?
|
@@ -173,24 +174,24 @@ module Dhun
|
|
173
174
|
|
174
175
|
no_tasks do
|
175
176
|
|
176
|
-
# Writes the queue to the playlist.
|
177
|
+
# Writes the queue to the playlist.
|
177
178
|
# This will be overloaded by other playlist modules
|
178
179
|
def playlist_save
|
179
180
|
return_response(:status,[:queue])[:queue].collect { |song| song }.join("\n")
|
180
181
|
end
|
181
|
-
|
182
|
+
|
182
183
|
# Loads the playlist to the queue.
|
183
184
|
# This will be overloaded by other playlist modules.
|
184
185
|
def playlist_load(path)
|
185
186
|
File.read(path).split("\n")
|
186
187
|
end
|
187
|
-
|
188
|
+
|
188
189
|
# send out the command to server and see what it has to say.
|
189
190
|
def return_response(action,keys,argument=[])
|
190
191
|
response = get_response(action,argument)
|
191
192
|
if response
|
192
193
|
color = response.success? ? :green : :red
|
193
|
-
say response[:message], color
|
194
|
+
say mp3_tag(response[:message]), color
|
194
195
|
if keys
|
195
196
|
return keys.inject({}) {|base,key| base[key.to_sym] = response[key.to_sym] ; base}
|
196
197
|
end
|
@@ -243,9 +244,21 @@ module Dhun
|
|
243
244
|
# prints out list with each index value
|
244
245
|
# in pretty format! (contrasting colors)
|
245
246
|
def say_list(list)
|
247
|
+
return "empty" if (list.nil? or list.empty?)
|
246
248
|
list.each_with_index do |item,index|
|
247
249
|
color = index.even? ? :white : :cyan
|
248
|
-
say("#{index+1} : #{item}",color)
|
250
|
+
say("#{index+1} : #{mp3_tag(item)}",color)
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
# returns song in Artist - Title format
|
255
|
+
# if no tags or non-existent, return its input
|
256
|
+
def mp3_tag(song)
|
257
|
+
return "" if song.nil?
|
258
|
+
return song unless File.exists?(song)
|
259
|
+
Mp3Info.open(song) do |mp3|
|
260
|
+
artist = mp3.tag.artist ; title = mp3.tag.title
|
261
|
+
(artist and title) ? "#{artist} - #{title}" : song
|
249
262
|
end
|
250
263
|
end
|
251
264
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dhun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Deepak Jois
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-26 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -72,6 +72,26 @@ dependencies:
|
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: 0.12.0
|
74
74
|
version:
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: ruby-mp3info
|
77
|
+
type: :runtime
|
78
|
+
version_requirement:
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 0.6.13
|
84
|
+
version:
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: visionmedia-growl
|
87
|
+
type: :runtime
|
88
|
+
version_requirement:
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 1.0.3
|
94
|
+
version:
|
75
95
|
description:
|
76
96
|
email: deepak.jois@gmail.com
|
77
97
|
executables:
|