mikeplayer 1.0.2 → 1.0.3

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: 44e5e59f36ed8b6c41f8d2c36e65bb1b997b920a2dd3ad59eba2fff0c2dc5141
4
- data.tar.gz: 59efb825846abc56475a6b5a562a3a897ea68f4b985ae4bb880c968492160bec
3
+ metadata.gz: 129df9ce63171d9efbe8bd1e581fdbfdf33fdadf127936089db72149ebd76a54
4
+ data.tar.gz: 25f8be729ae785873137a34e291c63983fcb9a5ff71ccb035e6160bbb3448007
5
5
  SHA512:
6
- metadata.gz: ddf8ec65bf9ba7486cf48cc4e27c4507d55fbc233aa2c3c9bb4afc74a6d0778a77a6817bc66070ab7adaa90248bed5ced766b4bf203e9afd905789800fc546a8
7
- data.tar.gz: e3655f5176eb292128264151db69987dcd3b3fd3fcc6379c6c80028198e1b0da9833591ddd798cfb53d9395ee30a04bd77d9c6911eabd19608a13784c3614687
6
+ metadata.gz: b1ec4ae4f8a765ffeed9fb96d7097f97392a27db66211a4bfc4bb14f7a1636b876ec40ecd84458a8ce8a53050cc160d36769a18088fa99533ce927e8ac5185c8
7
+ data.tar.gz: eebd1b3afce640dd29ba8e639122f56b64c7b7e0878a1b50e0f7e72cc78a4b258708e50ef8cde1e5fc1f43916b39b42444339b339ad488cdada53a387692ac6e
@@ -55,7 +55,9 @@ module MikePlayer
55
55
  end
56
56
 
57
57
  def previous
58
- @song_i -= 1 unless @song_i <= 0
58
+ @song_i -= 1
59
+
60
+ @song_i = 0 if @song_i < 0
59
61
 
60
62
  return self.current
61
63
  end
@@ -87,7 +89,7 @@ module MikePlayer
87
89
  end
88
90
 
89
91
  def finished?
90
- return @song_i == @songs.size
92
+ return @song_i >= @songs.size
91
93
  end
92
94
 
93
95
  private
@@ -1,3 +1,3 @@
1
1
  module MikePlayer
2
- VERSION = '1.0.2'.freeze
2
+ VERSION = '1.0.3'.freeze
3
3
  end
data/lib/mikeplayer.rb CHANGED
@@ -75,7 +75,7 @@ module MikePlayer
75
75
  pause_if_over_time_limit
76
76
 
77
77
  if (true == playing?)
78
- indicator = "#{'>' * (playing_time % 4)}"
78
+ indicator = "#{'>' * (playing_time % 4)}".ljust(4)
79
79
  info_changed = true
80
80
  elsif (true == paused?) && (PAUSE_INDICATOR != indicator)
81
81
  indicator = PAUSE_INDICATOR
@@ -89,12 +89,14 @@ module MikePlayer
89
89
  mindicator = "(#{minutes_remaining}↓) "
90
90
  end
91
91
 
92
- info = "#{info_prefix} #{song.length_str(playing_time)} #{mindicator}#{indicator}".ljust(display_width)
92
+ print("\r" << ' '.ljust(display_width))
93
93
 
94
- display_width = info.size
94
+ info = "#{info_prefix} #{song.length_str(playing_time)} #{mindicator}#{indicator}"
95
95
 
96
96
  print(info)
97
97
 
98
+ display_width = info.size
99
+
98
100
  info_changed = false
99
101
  $stdout.flush
100
102
  end
@@ -108,17 +110,18 @@ module MikePlayer
108
110
  @pid = nil
109
111
 
110
112
  if (true == playing?)
111
- next_song
113
+ next_song unless @pid.nil?
112
114
  end
113
115
  end
114
116
 
115
117
  @pid = nil
118
+ print("\r\n")
116
119
  exit
117
120
  end
118
121
 
119
122
  wait_on_user
120
123
 
121
- puts ""
124
+ print("\r\n")
122
125
  end
123
126
 
124
127
  def cmd_exist?(cmd)
@@ -208,6 +211,7 @@ module MikePlayer
208
211
  end
209
212
 
210
213
  @state = STOPPED
214
+ @pid = nil
211
215
  end
212
216
 
213
217
  def pid_alive?(pid = @pid)
@@ -227,7 +231,9 @@ module MikePlayer
227
231
  def previous_song
228
232
  stop_song
229
233
 
230
- @playlist.previous
234
+ if (playing_time < 10)
235
+ @playlist.previous
236
+ end
231
237
  end
232
238
 
233
239
  def kill(signal)
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.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Crockett
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-28 00:00:00.000000000 Z
11
+ date: 2019-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json