use right var
This commit is contained in:
parent
ee3f776aa5
commit
982275b69e
30
mpc_shim.rb
30
mpc_shim.rb
@ -1,51 +1,51 @@
|
||||
class MpcShim
|
||||
def update()
|
||||
`mpc #{host_arg} update`
|
||||
`mpc #{@host_arg} update`
|
||||
end
|
||||
|
||||
def clear()
|
||||
`mpc #{host_arg} clear`
|
||||
`mpc #{@host_arg} clear`
|
||||
end
|
||||
|
||||
def play()
|
||||
`mpc #{host_arg} play`
|
||||
`mpc #{@host_arg} play`
|
||||
end
|
||||
|
||||
def stop()
|
||||
`mpc #{host_arg} stop`
|
||||
`mpc #{@host_arg} stop`
|
||||
end
|
||||
|
||||
def next()
|
||||
`mpc #{host_arg} next`
|
||||
`mpc #{@host_arg} next`
|
||||
end
|
||||
|
||||
def reset()
|
||||
`mpc #{host_arg} clear`
|
||||
`mpc #{host_arg} add /`
|
||||
`mpc #{host_arg} shuffle`
|
||||
`mpc #{host_arg} repeat`
|
||||
`mpc #{@host_arg} clear`
|
||||
`mpc #{@host_arg} add /`
|
||||
`mpc #{@host_arg} shuffle`
|
||||
`mpc #{@host_arg} repeat`
|
||||
end
|
||||
|
||||
def update()
|
||||
`mpc #{host_arg} update`
|
||||
`mpc #{@host_arg} update`
|
||||
end
|
||||
|
||||
def toggle()
|
||||
`mpc #{host_arg} toggle`
|
||||
`mpc #{@host_arg} toggle`
|
||||
end
|
||||
|
||||
def add(filename = nil)
|
||||
if filename == nil
|
||||
`mpc #{host_arg} add /`
|
||||
`mpc #{@host_arg} add /`
|
||||
else
|
||||
`mpc #{host_arg} add #{filename}`
|
||||
`mpc #{@host_arg} add #{filename}`
|
||||
end
|
||||
return $?.success?
|
||||
end
|
||||
|
||||
def start()
|
||||
`systemctl start mpd` unless `ps aux | grep mpd` != ""
|
||||
`mpc ${host_arg} repeat`
|
||||
`mpc ${@host_arg} repeat`
|
||||
end
|
||||
|
||||
def running?()
|
||||
@ -53,7 +53,7 @@ class MpcShim
|
||||
end
|
||||
|
||||
def nowplaying()
|
||||
return `mpc ${host_arg} | head -n 1`
|
||||
return `mpc ${@host_arg} | head -n 1`
|
||||
end
|
||||
|
||||
def initialize(hostname=:localhost)
|
||||
|
Loading…
Reference in New Issue
Block a user