mikeplayer 1.0.3 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/MikePlayer.rb +1 -0
- data/lib/mikeplayer.rb +72 -133
- data/lib/mikeplayer/display.rb +49 -0
- data/lib/mikeplayer/play_thread.rb +113 -5
- data/lib/mikeplayer/playlist.rb +9 -24
- data/lib/mikeplayer/settings.rb +5 -0
- data/lib/mikeplayer/song.rb +1 -1
- data/lib/mikeplayer/version.rb +1 -1
- data/mikeplayer.gemspec +23 -20
- metadata +10 -17
- data/.gitignore +0 -51
- data/test/mikeplayer/settings_test.rb +0 -17
- data/test/mikeplayer_test.rb +0 -9
- data/test/test_helper.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98d73ca7a4c48fc9468996b9aa27ca592d544c8a2637161295625acd6fd849b2
|
4
|
+
data.tar.gz: 44288a081ec5d6f8e3090613b220fe63828ff239f69209a77f951edc680c8776
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc0bea67f1ba47fcfe6f63bf7008981ac69ff4247d21e413444bbc641d02a1d245737cfba1f495f9b049562ac409e55deba85bd1a8b87d51f77f8f64eeb81708
|
7
|
+
data.tar.gz: 0ced60fdb31a438d80597f0bb7c4118f8662db0133fd235ea318a4ad591393e2bc85e9b8093a973dc7c5ed522874e74d1a883fb176287eac85ac3f6c44154213
|
data/bin/MikePlayer.rb
CHANGED
@@ -21,6 +21,7 @@ OptionParser.new do |opt|
|
|
21
21
|
opt.on('-l', '--list', 'List songs in playlist.') { |o| options[:list] = true; }
|
22
22
|
opt.on('-d', '--directory name', 'Directory to find mp3s.') { |o| options[:directory] = o }
|
23
23
|
opt.on('-t', '--time minutes', 'Limit time to number of minutes.') { |o| options[:minutes] = o }
|
24
|
+
opt.on('-x', '--debug', 'Turn on debug.') { |o| options[:debug] = true }
|
24
25
|
end.parse!
|
25
26
|
|
26
27
|
MikePlayer::Player.new(options, ARGV).play
|
data/lib/mikeplayer.rb
CHANGED
@@ -4,28 +4,29 @@ require 'open3'
|
|
4
4
|
require 'io/console'
|
5
5
|
require 'mp3info'
|
6
6
|
require 'mikeplayer/version'
|
7
|
-
require 'mikeplayer/
|
7
|
+
require 'mikeplayer/display'
|
8
8
|
require 'mikeplayer/playlist'
|
9
|
+
require 'mikeplayer/play_thread'
|
10
|
+
require 'mikeplayer/settings'
|
9
11
|
require 'mikeplayer/song'
|
10
12
|
|
11
13
|
module MikePlayer
|
12
14
|
class Player
|
13
|
-
|
14
|
-
|
15
|
+
PLAY_SLEEP = 0.5
|
16
|
+
PAUSE_SLEEP = 1.0
|
15
17
|
STOPPED = :stopped
|
16
18
|
PLAYING = :playing
|
17
19
|
PAUSED = :paused
|
20
|
+
SONG_CHANGE = :song_change
|
18
21
|
|
19
22
|
def initialize(options, *args)
|
20
23
|
@settings = Settings.new(options)
|
21
24
|
@playlist = Playlist.new(@settings.playlist)
|
22
25
|
@minutes = @settings.minutes
|
23
26
|
@command = ''
|
24
|
-
@
|
25
|
-
@timer_start = nil
|
27
|
+
@timer_start = Time.now if (@minutes > 0)
|
26
28
|
@state = STOPPED
|
27
|
-
|
28
|
-
check_system
|
29
|
+
@player = PlayThread.new(volume: @settings.volume)
|
29
30
|
|
30
31
|
if (true == @settings.list?)
|
31
32
|
@songs.map { |song| File.basename(song) }.sort.each {|song| puts "#{File.basename(song)}"}
|
@@ -50,71 +51,43 @@ module MikePlayer
|
|
50
51
|
puts "Mike Player v#{MikePlayer::VERSION}"
|
51
52
|
puts "Playlist #{@playlist.info}\n"
|
52
53
|
|
53
|
-
if @playlist.
|
54
|
+
if (0 == @playlist.size)
|
54
55
|
puts "No songs in playlist."
|
55
56
|
|
56
57
|
exit 1
|
57
58
|
end
|
58
59
|
|
59
60
|
@thread = Thread.new do
|
60
|
-
|
61
|
+
@display = Display.new
|
62
|
+
@song_i = 0
|
61
63
|
|
62
|
-
while (
|
63
|
-
|
64
|
-
@song_start = Time.now
|
65
|
-
info_prefix = "\r#{@playlist.current_song_info}".freeze
|
64
|
+
while (@song_i < @playlist.size)
|
65
|
+
@display.song_info = @playlist.song_info(@song_i)
|
66
66
|
|
67
|
-
|
67
|
+
@player.play(song.filename)
|
68
68
|
|
69
69
|
@state = PLAYING
|
70
|
-
@pid = thread_info.pid
|
71
|
-
indicator = ''
|
72
|
-
info_changed = false
|
73
70
|
|
74
|
-
while
|
71
|
+
while @player.playing?
|
75
72
|
pause_if_over_time_limit
|
76
73
|
|
77
|
-
|
78
|
-
indicator = "#{'>' * (playing_time % 4)}".ljust(4)
|
79
|
-
info_changed = true
|
80
|
-
elsif (true == paused?) && (PAUSE_INDICATOR != indicator)
|
81
|
-
indicator = PAUSE_INDICATOR
|
82
|
-
info_changed = true
|
83
|
-
end
|
84
|
-
|
85
|
-
if (true == info_changed)
|
86
|
-
mindicator = ""
|
87
|
-
|
88
|
-
if (0 < minutes_remaining)
|
89
|
-
mindicator = "(#{minutes_remaining}↓) "
|
90
|
-
end
|
91
|
-
|
92
|
-
print("\r" << ' '.ljust(display_width))
|
93
|
-
|
94
|
-
info = "#{info_prefix} #{song.length_str(playing_time)} #{mindicator}#{indicator}"
|
74
|
+
@display.elapsed = @player.elapsed if playing?
|
95
75
|
|
96
|
-
|
76
|
+
@display.display!(song.length_str(@player.elapsed), minutes_remaining)
|
97
77
|
|
98
|
-
|
99
|
-
|
100
|
-
info_changed = false
|
101
|
-
$stdout.flush
|
102
|
-
end
|
103
|
-
|
104
|
-
sleep SLEEP_SETTING
|
78
|
+
sleep(sleep_time)
|
105
79
|
end
|
106
80
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
next_song unless @pid.nil?
|
81
|
+
if playing? && @player.stopped?
|
82
|
+
next_song
|
83
|
+
elsif paused?
|
84
|
+
while paused?
|
85
|
+
sleep(sleep_time)
|
86
|
+
end
|
114
87
|
end
|
115
88
|
end
|
116
89
|
|
117
|
-
@
|
90
|
+
@player.stop
|
118
91
|
print("\r\n")
|
119
92
|
exit
|
120
93
|
end
|
@@ -124,30 +97,8 @@ module MikePlayer
|
|
124
97
|
print("\r\n")
|
125
98
|
end
|
126
99
|
|
127
|
-
def cmd_exist?(cmd)
|
128
|
-
if (true != system('command'))
|
129
|
-
raise "Missing 'command' command, which is used to test compatibility."
|
130
|
-
end
|
131
|
-
|
132
|
-
if (true != system("command -v #{cmd} >/dev/null 2>&1"))
|
133
|
-
return false
|
134
|
-
end
|
135
|
-
|
136
|
-
return true
|
137
|
-
end
|
138
|
-
|
139
100
|
private
|
140
101
|
|
141
|
-
def check_system
|
142
|
-
%w(play).each do |cmd|
|
143
|
-
if (false == cmd_exist?(cmd))
|
144
|
-
raise "#{cmd} failed, do you have sox installed?"
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
return nil
|
149
|
-
end
|
150
|
-
|
151
102
|
def wait_on_user
|
152
103
|
while ('q' != @command)
|
153
104
|
@command = STDIN.getch
|
@@ -158,9 +109,8 @@ module MikePlayer
|
|
158
109
|
next_song
|
159
110
|
elsif ('z' == @command)
|
160
111
|
previous_song
|
161
|
-
elsif ('q' == @command)
|
162
|
-
|
163
|
-
@thread.kill
|
112
|
+
elsif ('q' == @command)
|
113
|
+
press_stop
|
164
114
|
elsif ('t' == @command)
|
165
115
|
@timer_start = Time.now
|
166
116
|
elsif (false == @timer_start.nil?) && ("#{@command.to_i}" == @command)
|
@@ -182,69 +132,58 @@ module MikePlayer
|
|
182
132
|
return (PAUSED == @state)
|
183
133
|
end
|
184
134
|
|
135
|
+
def changing?
|
136
|
+
return (SONG_CHANGE == @state)
|
137
|
+
end
|
138
|
+
|
139
|
+
def press_stop
|
140
|
+
@player.stop
|
141
|
+
@state = STOPPED
|
142
|
+
end
|
143
|
+
|
185
144
|
def press_pause
|
186
|
-
|
187
|
-
|
188
|
-
|
145
|
+
debug('|')
|
146
|
+
|
147
|
+
if playing?
|
148
|
+
debug('>')
|
189
149
|
@state = PAUSED
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
150
|
+
@display.paused
|
151
|
+
@player.pause
|
152
|
+
elsif paused?
|
153
|
+
debug('|')
|
194
154
|
@state = PLAYING
|
195
155
|
else
|
196
156
|
print("Confused state #{@state}.")
|
197
157
|
end
|
198
158
|
end
|
199
159
|
|
200
|
-
def
|
201
|
-
|
202
|
-
kill("CONT")
|
203
|
-
end
|
204
|
-
|
205
|
-
kill("INT")
|
206
|
-
|
207
|
-
sleep 0.2
|
208
|
-
|
209
|
-
if (true == pid_alive?)
|
210
|
-
kill("KILL")
|
211
|
-
end
|
212
|
-
|
213
|
-
@state = STOPPED
|
214
|
-
@pid = nil
|
215
|
-
end
|
216
|
-
|
217
|
-
def pid_alive?(pid = @pid)
|
218
|
-
if (false == pid.nil?)
|
219
|
-
return system("ps -p #{pid} > /dev/null")
|
220
|
-
end
|
160
|
+
def next_song
|
161
|
+
debug('n')
|
221
162
|
|
222
|
-
|
223
|
-
end
|
163
|
+
@state = SONG_CHANGE
|
224
164
|
|
225
|
-
|
226
|
-
stop_song
|
165
|
+
@player.stop
|
227
166
|
|
228
|
-
@
|
167
|
+
@song_i += 1
|
229
168
|
end
|
230
169
|
|
231
170
|
def previous_song
|
232
|
-
|
171
|
+
debug('p')
|
233
172
|
|
234
|
-
|
235
|
-
@playlist.previous
|
236
|
-
end
|
237
|
-
end
|
173
|
+
@state = SONG_CHANGE
|
238
174
|
|
239
|
-
|
240
|
-
|
241
|
-
|
175
|
+
if (@player.elapsed < 10)
|
176
|
+
@song_i -= 1 if @song_i.positive?
|
177
|
+
else
|
178
|
+
debug('x')
|
242
179
|
end
|
180
|
+
|
181
|
+
@player.stop
|
243
182
|
end
|
244
183
|
|
245
184
|
def pause_if_over_time_limit
|
246
185
|
if (false == @timer_start.nil?) && (0 < @minutes) && (true == playing?)
|
247
|
-
if (0
|
186
|
+
if (minutes_remaining && 0 >= minutes_remaining)
|
248
187
|
press_pause
|
249
188
|
@timer_start = nil
|
250
189
|
@minutes = 0
|
@@ -252,24 +191,24 @@ module MikePlayer
|
|
252
191
|
end
|
253
192
|
end
|
254
193
|
|
255
|
-
def
|
256
|
-
return (
|
194
|
+
def minutes_remaining
|
195
|
+
return if ((0 == @minutes) || (@timer_start.nil?))
|
196
|
+
|
197
|
+
(@minutes - ((Time.now - @timer_start).to_i / 60).to_i)
|
257
198
|
end
|
258
199
|
|
259
|
-
def
|
260
|
-
if
|
261
|
-
|
262
|
-
|
263
|
-
return (Time.now - @pause_time).to_i
|
264
|
-
end
|
200
|
+
def sleep_time
|
201
|
+
return PLAY_SLEEP if playing?
|
202
|
+
|
203
|
+
PAUSE_SLEEP
|
265
204
|
end
|
266
205
|
|
267
|
-
def
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
206
|
+
def song
|
207
|
+
@playlist.get(@song_i)
|
208
|
+
end
|
209
|
+
|
210
|
+
def debug(str)
|
211
|
+
print(str) if @settings.debug?
|
273
212
|
end
|
274
213
|
end
|
275
214
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module MikePlayer
|
2
|
+
class Display
|
3
|
+
PAUSE_INDICATOR = '||'.freeze
|
4
|
+
INDICATOR_SIZE = 4
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@width = 0
|
8
|
+
@indicator = ''
|
9
|
+
@changed = false
|
10
|
+
end
|
11
|
+
|
12
|
+
def song_info=(v)
|
13
|
+
@info_prefix = "\r#{v}".freeze
|
14
|
+
end
|
15
|
+
|
16
|
+
def elapsed=(v)
|
17
|
+
@indicator = "#{'>' * (v % INDICATOR_SIZE)}".ljust(INDICATOR_SIZE)
|
18
|
+
@changed = true
|
19
|
+
end
|
20
|
+
|
21
|
+
def paused
|
22
|
+
if (false == @indicator.include?(PAUSE_INDICATOR))
|
23
|
+
@indicator = PAUSE_INDICATOR.ljust(INDICATOR_SIZE)
|
24
|
+
@changed = true
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def display!(elapsed_info, countdown = nil)
|
29
|
+
return unless changed?
|
30
|
+
|
31
|
+
mindicator = "(#{countdown}↓) " if countdown
|
32
|
+
|
33
|
+
print("\r" << ' '.ljust(@width))
|
34
|
+
|
35
|
+
info = "#{@info_prefix} #{elapsed_info} #{mindicator}#{@indicator}"
|
36
|
+
|
37
|
+
print(info)
|
38
|
+
|
39
|
+
@width = info.size
|
40
|
+
@changed = false
|
41
|
+
|
42
|
+
$stdout.flush
|
43
|
+
end
|
44
|
+
|
45
|
+
def changed?
|
46
|
+
true == @changed
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -1,13 +1,121 @@
|
|
1
1
|
module MikePlayer
|
2
2
|
class PlayThread
|
3
|
-
def
|
3
|
+
def initialize(volume: 1.0)
|
4
|
+
check_system
|
5
|
+
|
6
|
+
@pid = nil
|
7
|
+
@volume = volume
|
8
|
+
@start_t = 0
|
9
|
+
@elapsed = 0
|
10
|
+
@paused = false
|
11
|
+
end
|
12
|
+
|
13
|
+
def play(file)
|
14
|
+
start_position = 0
|
15
|
+
|
16
|
+
if paused?
|
17
|
+
start_position = @elapsed
|
18
|
+
else
|
19
|
+
@elapsed = 0
|
20
|
+
end
|
21
|
+
|
22
|
+
start_thread(file: file, start_position: start_position)
|
23
|
+
|
24
|
+
@start_t = Time.now.to_i
|
25
|
+
end
|
26
|
+
|
27
|
+
def stop
|
28
|
+
pause
|
29
|
+
|
30
|
+
@elapsed = 0
|
31
|
+
@start_t = 0
|
32
|
+
@paused = false
|
33
|
+
end
|
34
|
+
|
35
|
+
def pause
|
36
|
+
kill('INT')
|
37
|
+
|
38
|
+
@elapsed += Time.now.to_i - @start_t
|
39
|
+
@start_t = 0
|
40
|
+
|
41
|
+
sleep 0.2
|
42
|
+
|
43
|
+
kill('KILL')
|
44
|
+
|
45
|
+
@paused = true
|
46
|
+
end
|
47
|
+
|
48
|
+
def kill(signal)
|
49
|
+
Process.kill(signal, @pid) if alive?
|
50
|
+
end
|
51
|
+
|
52
|
+
def alive?
|
53
|
+
MikePlayer::PlayThread.alive?(@pid)
|
54
|
+
end
|
55
|
+
|
56
|
+
def stopped?
|
57
|
+
false == alive?
|
58
|
+
end
|
59
|
+
|
60
|
+
def paused?
|
61
|
+
@paused && stopped?
|
62
|
+
end
|
63
|
+
|
64
|
+
def playing?
|
65
|
+
alive?
|
66
|
+
end
|
67
|
+
|
68
|
+
def elapsed
|
69
|
+
return (@elapsed + (Time.now.to_i - @start_t)) if @start_t.positive?
|
70
|
+
|
71
|
+
@elapsed
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.alive?(pid)
|
75
|
+
return system("ps -p #{pid} > /dev/null") unless pid.nil?
|
76
|
+
|
77
|
+
false
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.cmd_exist?(cmd)
|
81
|
+
if (true != system('command'))
|
82
|
+
raise "Missing 'command' command, which is used to test compatibility."
|
83
|
+
end
|
84
|
+
|
85
|
+
if (true != system("command -v #{cmd} >/dev/null 2>&1"))
|
86
|
+
return false
|
87
|
+
end
|
88
|
+
|
89
|
+
return true
|
90
|
+
end
|
91
|
+
|
92
|
+
private
|
93
|
+
def start_thread(file:, start_position: )
|
4
94
|
args = [
|
5
|
-
|
95
|
+
'play',
|
6
96
|
'--no-show-progress',
|
7
|
-
'--volume', volume,
|
8
|
-
|
97
|
+
'--volume', @volume.to_s,
|
98
|
+
file,
|
99
|
+
'trim', start_position.to_s,
|
9
100
|
]
|
10
|
-
|
101
|
+
|
102
|
+
stdin, stdother, thread_info = Open3.popen2e(*args)
|
103
|
+
|
104
|
+
@pid = thread_info.pid
|
105
|
+
|
106
|
+
sleep 0.2
|
107
|
+
|
108
|
+
raise "Failed to play #{stdother.read}" unless alive?
|
109
|
+
|
110
|
+
stdin.close
|
111
|
+
stdother.close
|
112
|
+
|
113
|
+
self
|
114
|
+
end
|
115
|
+
|
116
|
+
def check_system
|
117
|
+
%w[play].each do |cmd|
|
118
|
+
raise "#{cmd} failed, do you have sox installed?" unless MikePlayer::PlayThread.cmd_exist?(cmd)
|
11
119
|
end
|
12
120
|
end
|
13
121
|
end
|
data/lib/mikeplayer/playlist.rb
CHANGED
@@ -5,12 +5,11 @@ module MikePlayer
|
|
5
5
|
def initialize(filename)
|
6
6
|
@filename = filename
|
7
7
|
@songs = []
|
8
|
-
@song_i = 0
|
9
8
|
@length = 0
|
10
9
|
|
11
10
|
load_songs
|
12
11
|
|
13
|
-
@loaded_song_count =
|
12
|
+
@loaded_song_count = self.size
|
14
13
|
end
|
15
14
|
|
16
15
|
def <<(song)
|
@@ -44,22 +43,8 @@ module MikePlayer
|
|
44
43
|
return self
|
45
44
|
end
|
46
45
|
|
47
|
-
def
|
48
|
-
return @songs[
|
49
|
-
end
|
50
|
-
|
51
|
-
def next
|
52
|
-
@song_i += 1
|
53
|
-
|
54
|
-
return self.current
|
55
|
-
end
|
56
|
-
|
57
|
-
def previous
|
58
|
-
@song_i -= 1
|
59
|
-
|
60
|
-
@song_i = 0 if @song_i < 0
|
61
|
-
|
62
|
-
return self.current
|
46
|
+
def get(i)
|
47
|
+
return @songs[i]
|
63
48
|
end
|
64
49
|
|
65
50
|
def shuffle!
|
@@ -79,17 +64,17 @@ module MikePlayer
|
|
79
64
|
end
|
80
65
|
|
81
66
|
def info
|
82
|
-
return "#{self.name} loaded #{@loaded_song_count} songs with length #{Song.as_duration_str(@length)}
|
67
|
+
return "#{self.name} loaded #{@loaded_song_count} and added #{self.size - @loaded_song_count} songs with length #{Song.as_duration_str(@length)}"
|
83
68
|
end
|
84
69
|
|
85
|
-
def
|
86
|
-
song_i_str = "#{
|
70
|
+
def song_info(i)
|
71
|
+
song_i_str = "#{i + 1}".rjust(self.size.to_s.size)
|
87
72
|
|
88
|
-
return "Playing (#{song_i_str}/#{
|
73
|
+
return "Playing (#{song_i_str}/#{self.size}): #{get(i).info}".freeze
|
89
74
|
end
|
90
75
|
|
91
|
-
def
|
92
|
-
return @
|
76
|
+
def size
|
77
|
+
return @songs.size
|
93
78
|
end
|
94
79
|
|
95
80
|
private
|
data/lib/mikeplayer/settings.rb
CHANGED
@@ -16,6 +16,7 @@ module MikePlayer
|
|
16
16
|
@music_dir = options[:directory] || File.join(@home, DEFAULT_DIRECTORY)
|
17
17
|
@settings_dir = options[:settings] || File.join(@home, SETTINGS_DIRECTORY)
|
18
18
|
@minutes = options[:minutes].to_i
|
19
|
+
@debug = options[:debug]
|
19
20
|
@random = options[:random].to_i
|
20
21
|
|
21
22
|
if (false == Dir.exist?(@settings_dir))
|
@@ -35,6 +36,10 @@ module MikePlayer
|
|
35
36
|
return 0 < @random
|
36
37
|
end
|
37
38
|
|
39
|
+
def debug?
|
40
|
+
return (true == @debug)
|
41
|
+
end
|
42
|
+
|
38
43
|
def overwrite?
|
39
44
|
return true == @overwrite
|
40
45
|
end
|
data/lib/mikeplayer/song.rb
CHANGED
data/lib/mikeplayer/version.rb
CHANGED
data/mikeplayer.gemspec
CHANGED
@@ -3,15 +3,15 @@ lib = File.expand_path('../lib', __FILE__)
|
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
require 'mikeplayer/version'
|
5
5
|
|
6
|
-
Gem::Specification.new do |
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
#{
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'mikeplayer'
|
8
|
+
spec.version = MikePlayer::VERSION
|
9
|
+
spec.authors = ['Mike Crockett']
|
10
|
+
spec.email = ['rubygems@mmcrockett.com']
|
11
|
+
spec.summary = 'Wraps Sox\'s `play` command, allowing playslists, find, random and time limit.'
|
12
|
+
spec.executables << 'MikePlayer.rb'
|
13
|
+
spec.description = <<-EOF.gsub(/^\s+/, '')
|
14
|
+
#{spec.summary}
|
15
15
|
|
16
16
|
Once a song is playing you can:
|
17
17
|
'x' to previous
|
@@ -20,17 +20,20 @@ Gem::Specification.new do |gem|
|
|
20
20
|
'q' to quit
|
21
21
|
't' n to set a timer that will pause the music after n minutes
|
22
22
|
EOF
|
23
|
-
|
23
|
+
spec.homepage = 'https://github.com/mmcrockett/mikeplayer'
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
gem.require_paths = ['lib']
|
29
|
-
gem.licenses = ['MIT']
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
f.match?(%r{^(test|spec|features|helpers|)/}) || f.match?(%r{^(\.[[:alnum:]]+)}) || f.match?(/console/)
|
27
|
+
end
|
30
28
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
29
|
+
spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
30
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
31
|
+
spec.require_paths = ['lib']
|
32
|
+
spec.licenses = ['MIT']
|
33
|
+
|
34
|
+
spec.add_dependency 'json', '~> 2.5'
|
35
|
+
spec.add_dependency 'ruby-mp3info', '~> 0.8'
|
36
|
+
spec.add_dependency 'minitest', '~> 5'
|
37
|
+
spec.add_development_dependency 'rake', '~> 12'
|
38
|
+
spec.add_development_dependency 'byebug', '~> 11'
|
36
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mikeplayer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Crockett
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.5'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ruby-mp3info
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,13 +95,13 @@ executables:
|
|
95
95
|
extensions: []
|
96
96
|
extra_rdoc_files: []
|
97
97
|
files:
|
98
|
-
- ".gitignore"
|
99
98
|
- Gemfile
|
100
99
|
- LICENSE
|
101
100
|
- README.md
|
102
101
|
- Rakefile
|
103
102
|
- bin/MikePlayer.rb
|
104
103
|
- lib/mikeplayer.rb
|
104
|
+
- lib/mikeplayer/display.rb
|
105
105
|
- lib/mikeplayer/executable.rb
|
106
106
|
- lib/mikeplayer/play_thread.rb
|
107
107
|
- lib/mikeplayer/playlist.rb
|
@@ -109,14 +109,11 @@ files:
|
|
109
109
|
- lib/mikeplayer/song.rb
|
110
110
|
- lib/mikeplayer/version.rb
|
111
111
|
- mikeplayer.gemspec
|
112
|
-
- test/mikeplayer/settings_test.rb
|
113
|
-
- test/mikeplayer_test.rb
|
114
|
-
- test/test_helper.rb
|
115
112
|
homepage: https://github.com/mmcrockett/mikeplayer
|
116
113
|
licenses:
|
117
114
|
- MIT
|
118
115
|
metadata: {}
|
119
|
-
post_install_message:
|
116
|
+
post_install_message:
|
120
117
|
rdoc_options: []
|
121
118
|
require_paths:
|
122
119
|
- lib
|
@@ -131,12 +128,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
128
|
- !ruby/object:Gem::Version
|
132
129
|
version: '0'
|
133
130
|
requirements: []
|
134
|
-
|
135
|
-
|
136
|
-
signing_key:
|
131
|
+
rubygems_version: 3.1.2
|
132
|
+
signing_key:
|
137
133
|
specification_version: 4
|
138
134
|
summary: Wraps Sox's `play` command, allowing playslists, find, random and time limit.
|
139
|
-
test_files:
|
140
|
-
- test/mikeplayer/settings_test.rb
|
141
|
-
- test/mikeplayer_test.rb
|
142
|
-
- test/test_helper.rb
|
135
|
+
test_files: []
|
data/.gitignore
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
*.gem
|
2
|
-
Gemfile.lock
|
3
|
-
*.rbc
|
4
|
-
/.config
|
5
|
-
/coverage/
|
6
|
-
/InstalledFiles
|
7
|
-
/pkg/
|
8
|
-
/spec/reports/
|
9
|
-
/spec/examples.txt
|
10
|
-
/test/tmp/
|
11
|
-
/test/version_tmp/
|
12
|
-
/tmp/
|
13
|
-
|
14
|
-
# Used by dotenv library to load environment variables.
|
15
|
-
# .env
|
16
|
-
|
17
|
-
## Specific to RubyMotion:
|
18
|
-
.dat*
|
19
|
-
.repl_history
|
20
|
-
build/
|
21
|
-
*.bridgesupport
|
22
|
-
build-iPhoneOS/
|
23
|
-
build-iPhoneSimulator/
|
24
|
-
|
25
|
-
## Specific to RubyMotion (use of CocoaPods):
|
26
|
-
#
|
27
|
-
# We recommend against adding the Pods directory to your .gitignore. However
|
28
|
-
# you should judge for yourself, the pros and cons are mentioned at:
|
29
|
-
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
30
|
-
#
|
31
|
-
# vendor/Pods/
|
32
|
-
|
33
|
-
## Documentation cache and generated files:
|
34
|
-
/.yardoc/
|
35
|
-
/_yardoc/
|
36
|
-
/doc/
|
37
|
-
/rdoc/
|
38
|
-
|
39
|
-
## Environment normalization:
|
40
|
-
/.bundle/
|
41
|
-
/vendor/bundle
|
42
|
-
/lib/bundler/man/
|
43
|
-
|
44
|
-
# for a library or gem, you might want to ignore these files since the code is
|
45
|
-
# intended to run in multiple environments; otherwise, check them in:
|
46
|
-
# Gemfile.lock
|
47
|
-
# .ruby-version
|
48
|
-
# .ruby-gemset
|
49
|
-
|
50
|
-
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
51
|
-
.rvmrc
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class SettingsTest < Minitest::Test
|
4
|
-
describe 'settings' do
|
5
|
-
let(:home) { File.join('', 'tmp') }
|
6
|
-
let(:sdir) { File.join(home, MikePlayer::Settings::SETTINGS_DIRECTORY) }
|
7
|
-
|
8
|
-
before do
|
9
|
-
Dir.delete(sdir) if Dir.exist?(sdir)
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'creates a settings directory' do
|
13
|
-
MikePlayer::Settings.new(home: home)
|
14
|
-
assert(Dir.exist?(sdir))
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/test/mikeplayer_test.rb
DELETED