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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4134931c94f4e92cc8e93b24e40613d00ceff68081fa70c60fdadf2843da4bcb
4
- data.tar.gz: 11c874e73e5e821162aea11db794d0c74f4e90e66a7903691674933d37a2d2a1
3
+ metadata.gz: 9c728cfd9eb2f597286887596e1e527806a58a8a0ee6bcaafdf3eaf4062c4352
4
+ data.tar.gz: e1e22cc887f2d762acf5148f088d2f183a936f9b01c03ddb85f4c861865142a5
5
5
  SHA512:
6
- metadata.gz: 5703e62a29788946d071dfcd2663501b054f0a3013bb12154f3df5baf56ad3051a77fde4729209730131f3047d33b29e7edb6d4f1e5295993ac89e49da24d5ca
7
- data.tar.gz: 58cd63e6f442ee1162c76ad12fb106daf10c0e51257a85f372718af53b54cfc70bbf1e168a85250f9d899bb65f29649405ef555aed96c3c2e8cbe5d5ecc9bad8
6
+ metadata.gz: f07c38e3dca4034f40bfcf7d6b0c4d5f9f378ed46bf15df6d1f627d6ae26755968c5b1b10074f528f7cd642f4b5bee312109980330a96e0ec45b830f612acfd6
7
+ data.tar.gz: 99d6ee3c7d5fd22db5de384fe7e578107cedfb424c6ee38800a9542bc83a2c327f008705c43e4ba4ecb80a841ddcffe788ddfe0cc664158c6653f438f07c98f5
@@ -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]
@@ -1,3 +1,3 @@
1
1
  module MikePlayer
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mikeplayer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Crockett