mikeplayer 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mikeplayer/settings.rb +1 -1
- data/lib/mikeplayer/version.rb +1 -1
- data/lib/mikeplayer.rb +15 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c728cfd9eb2f597286887596e1e527806a58a8a0ee6bcaafdf3eaf4062c4352
|
4
|
+
data.tar.gz: e1e22cc887f2d762acf5148f088d2f183a936f9b01c03ddb85f4c861865142a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f07c38e3dca4034f40bfcf7d6b0c4d5f9f378ed46bf15df6d1f627d6ae26755968c5b1b10074f528f7cd642f4b5bee312109980330a96e0ec45b830f612acfd6
|
7
|
+
data.tar.gz: 99d6ee3c7d5fd22db5de384fe7e578107cedfb424c6ee38800a9542bc83a2c327f008705c43e4ba4ecb80a841ddcffe788ddfe0cc664158c6653f438f07c98f5
|
data/lib/mikeplayer/settings.rb
CHANGED
@@ -5,7 +5,7 @@ module MikePlayer
|
|
5
5
|
SETTINGS_DIRECTORY = '.mikeplayer'.freeze
|
6
6
|
PL_FILE_ENDING = '.mpl'.freeze
|
7
7
|
|
8
|
-
attr_reader :random, :music_dir, :playlist, :volume
|
8
|
+
attr_reader :random, :music_dir, :playlist, :volume, :minutes
|
9
9
|
|
10
10
|
def initialize(options)
|
11
11
|
@shuffle = options[:shuffle]
|
data/lib/mikeplayer/version.rb
CHANGED
data/lib/mikeplayer.rb
CHANGED
@@ -19,6 +19,7 @@ module MikePlayer
|
|
19
19
|
def initialize(options, *args)
|
20
20
|
@settings = Settings.new(options)
|
21
21
|
@playlist = Playlist.new(@settings.playlist)
|
22
|
+
@minutes = @settings.minutes
|
22
23
|
@command = ''
|
23
24
|
@pid = nil
|
24
25
|
@timer_start = nil
|
@@ -67,6 +68,7 @@ module MikePlayer
|
|
67
68
|
@state = PLAYING
|
68
69
|
@pid = thread_info.pid
|
69
70
|
indicator = ''
|
71
|
+
info_changed = false
|
70
72
|
|
71
73
|
while (true == pid_alive?)
|
72
74
|
pause_if_over_time_limit
|
@@ -92,6 +94,7 @@ module MikePlayer
|
|
92
94
|
|
93
95
|
print(info)
|
94
96
|
|
97
|
+
info_changed = false
|
95
98
|
$stdout.flush
|
96
99
|
end
|
97
100
|
|
@@ -178,9 +181,12 @@ module MikePlayer
|
|
178
181
|
def press_pause
|
179
182
|
if (true == playing?)
|
180
183
|
kill("STOP")
|
184
|
+
@pause_time = Time.now
|
181
185
|
@state = PAUSED
|
182
186
|
elsif (true == paused?)
|
183
187
|
kill("CONT")
|
188
|
+
@song_start += (Time.now - @pause_time)
|
189
|
+
@pause_time = nil
|
184
190
|
@state = PLAYING
|
185
191
|
else
|
186
192
|
print("Confused state #{@state}.")
|
@@ -240,7 +246,15 @@ module MikePlayer
|
|
240
246
|
end
|
241
247
|
|
242
248
|
def playing_time
|
243
|
-
return (Time.now - @song_start).to_i
|
249
|
+
return (Time.now - @song_start).to_i - pause_time
|
250
|
+
end
|
251
|
+
|
252
|
+
def pause_time
|
253
|
+
if (@pause_time.nil?)
|
254
|
+
return 0
|
255
|
+
else
|
256
|
+
return (Time.now - @pause_time).to_i
|
257
|
+
end
|
244
258
|
end
|
245
259
|
|
246
260
|
def minutes_remaining
|