cmus 2.0.4.3 → 2.0.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -55,6 +55,18 @@ class Status
55
55
  when :set
56
56
  name, data = data.split ' ', 2
57
57
 
58
+ data = if data == 'false'
59
+ false
60
+ elsif data == 'true'
61
+ true
62
+ elsif (Integer(data) rescue false)
63
+ data.to_i
64
+ elsif (Float(data) rescue false)
65
+ data.to_f
66
+ else
67
+ data
68
+ end
69
+
58
70
  @settings.send "#{name}=", data
59
71
  end
60
72
  }
@@ -17,19 +17,63 @@ class Toggle
17
17
  @controller = controller
18
18
  end
19
19
 
20
+ def toggle (name)
21
+ controller.puts "toggle #{name}"
22
+
23
+ self
24
+ end
25
+
26
+ def on (name)
27
+ unless controller.status.settings.send(name)
28
+ controller.puts "toggle #{name}"
29
+ end
30
+
31
+ self
32
+ end
33
+
34
+ def off (name)
35
+ if controller.status.settings.send(name)
36
+ controller.puts "toggle #{name}"
37
+ end
38
+
39
+ self
40
+ end
41
+
20
42
  # toggle the repeat status
21
43
  def repeat
22
- controller.puts 'toggle repeat'
44
+ toggle :Repeat
45
+ end
46
+
47
+ # enable repeat
48
+ def repeat!
49
+ on :Repeat
50
+ end
51
+
52
+ # disable repeat
53
+ def no_repeat!
54
+ off :Repeat
23
55
  end
24
56
 
25
57
  # toggle the shuffle status
26
58
  def shuffle
27
- controller.puts 'toggle shuffle'
59
+ toggle :Shuffle
60
+ end
61
+
62
+ # enable shuffle
63
+ def shuffle!
64
+ on :Shuffle
65
+ end
66
+
67
+ # disable shuffle
68
+ def no_shuffle!
69
+ off :Shuffle
28
70
  end
29
71
 
30
72
  # toggle the pause status
31
73
  def pause
32
74
  controller.puts 'player-pause'
75
+
76
+ self
33
77
  end
34
78
  end
35
79
 
@@ -10,6 +10,6 @@
10
10
 
11
11
  module Cmus
12
12
  def self.version
13
- '2.0.4.3'
13
+ '2.0.4.4'
14
14
  end
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cmus
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4.3
4
+ version: 2.0.4.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: