cmus 2.0.4 → 2.0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -0
- data/lib/cmus/controller.rb +8 -0
- data/lib/cmus/controller/player.rb +14 -0
- data/lib/cmus/controller/toggle.rb +3 -0
- data/lib/cmus/version.rb +1 -1
- metadata +2 -1
data/README.md
ADDED
data/lib/cmus/controller.rb
CHANGED
@@ -16,6 +16,9 @@ require 'cmus/controller/status'
|
|
16
16
|
|
17
17
|
module Cmus
|
18
18
|
|
19
|
+
# This is the main class to manage cmus.
|
20
|
+
#
|
21
|
+
# The class also acts as a UNIXSocket if needed.
|
19
22
|
class Controller
|
20
23
|
attr_reader :path
|
21
24
|
|
@@ -32,24 +35,29 @@ class Controller
|
|
32
35
|
@socket.__send__ id, *args, &block
|
33
36
|
end
|
34
37
|
|
38
|
+
# clear the context
|
35
39
|
def clear (context = :playlist)
|
36
40
|
puts "clear -#{context.to_s[0]}"
|
37
41
|
end
|
38
42
|
|
43
|
+
# add a file to the context
|
39
44
|
def add (context = :playlist, *paths)
|
40
45
|
paths.flatten.compact.uniq.each {|path|
|
41
46
|
puts "clear -#{context.to_s[0]} #{path}"
|
42
47
|
}
|
43
48
|
end
|
44
49
|
|
50
|
+
# returns the toggle facilities
|
45
51
|
def toggle
|
46
52
|
Toggle.new(self)
|
47
53
|
end
|
48
54
|
|
55
|
+
# returns the player facilities
|
49
56
|
def player
|
50
57
|
Player.new(self)
|
51
58
|
end
|
52
59
|
|
60
|
+
# returns the status
|
53
61
|
def status
|
54
62
|
Status.new(self)
|
55
63
|
end
|
@@ -17,6 +17,7 @@ class Player
|
|
17
17
|
@controller = controller
|
18
18
|
end
|
19
19
|
|
20
|
+
# play the current selection or the passed file
|
20
21
|
def play (file = nil)
|
21
22
|
if file
|
22
23
|
controller.puts "player-play #{File.real_path(File.expand_path(file))}"
|
@@ -25,28 +26,41 @@ class Player
|
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
29
|
+
# pause the current song
|
28
30
|
def pause
|
29
31
|
return if controller.status == :paused
|
30
32
|
|
31
33
|
controller.puts 'player-pause'
|
32
34
|
end
|
33
35
|
|
36
|
+
# unpause the current song
|
37
|
+
def unpause
|
38
|
+
return unless controller.status == :paused
|
39
|
+
|
40
|
+
controller.puts 'player-pause'
|
41
|
+
end
|
42
|
+
|
43
|
+
# stop the current song
|
34
44
|
def stop
|
35
45
|
controller.puts 'player-stop'
|
36
46
|
end
|
37
47
|
|
48
|
+
# go to the next song in the playlist
|
38
49
|
def next
|
39
50
|
controller.puts 'player-next'
|
40
51
|
end
|
41
52
|
|
53
|
+
# go to the previous song in the playlist
|
42
54
|
def prev
|
43
55
|
controller.puts 'player-prev'
|
44
56
|
end
|
45
57
|
|
58
|
+
# change the volume
|
46
59
|
def volume (volume)
|
47
60
|
controller.puts "vol #{volume}"
|
48
61
|
end
|
49
62
|
|
63
|
+
# seek to the passed second
|
50
64
|
def seek (second)
|
51
65
|
controller.puts "seek #{second}"
|
52
66
|
end
|
@@ -17,14 +17,17 @@ class Toggle
|
|
17
17
|
@controller = controller
|
18
18
|
end
|
19
19
|
|
20
|
+
# toggle the repeat status
|
20
21
|
def repeat
|
21
22
|
controller.puts 'toggle repeat'
|
22
23
|
end
|
23
24
|
|
25
|
+
# toggle the shuffle status
|
24
26
|
def shuffle
|
25
27
|
controller.puts 'toggle shuffle'
|
26
28
|
end
|
27
29
|
|
30
|
+
# toggle the pause status
|
28
31
|
def pause
|
29
32
|
controller.puts 'player-pause'
|
30
33
|
end
|
data/lib/cmus/version.rb
CHANGED
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
|
4
|
+
version: 2.0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -18,6 +18,7 @@ executables:
|
|
18
18
|
extensions: []
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
|
+
- README.md
|
21
22
|
- bin/cmus-remote.rb
|
22
23
|
- cmus.gemspec
|
23
24
|
- lib/cmus.rb
|