mirror of
https://github.com/danbee/mpd-client
synced 2025-03-04 08:39:09 +00:00
Add control class.
This commit is contained in:
parent
1d11190c21
commit
cc531cd87d
25
models/control.rb
Normal file
25
models/control.rb
Normal file
@ -0,0 +1,25 @@
|
||||
require './models/mpd_connection'
|
||||
|
||||
class Control
|
||||
class << self
|
||||
def play
|
||||
MPDConnection.mpd.play
|
||||
end
|
||||
|
||||
def stop
|
||||
MPDConnection.mpd.stop
|
||||
end
|
||||
|
||||
def next
|
||||
MPDConnection.mpd.next
|
||||
end
|
||||
|
||||
def previous
|
||||
MPDConnection.mpd.previous
|
||||
end
|
||||
|
||||
def pause
|
||||
MPDConnection.mpd.pause(!MPDConnection.mpd.paused?)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -5,6 +5,7 @@ Bundler.require(:default, ENV['RACK_ENV'])
|
||||
require 'json'
|
||||
require 'cgi'
|
||||
|
||||
require './models/control'
|
||||
require './models/album'
|
||||
require './models/artist'
|
||||
require './models/song'
|
||||
|
||||
4
spec/models/control_spec.rb
Normal file
4
spec/models/control_spec.rb
Normal file
@ -0,0 +1,4 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Control do
|
||||
end
|
||||
Loading…
Reference in New Issue
Block a user