use right var

This commit is contained in:
stryan 2022-05-01 16:49:39 -04:00
parent ee3f776aa5
commit 982275b69e

View File

@ -1,51 +1,51 @@
class MpcShim class MpcShim
def update() def update()
`mpc #{host_arg} update` `mpc #{@host_arg} update`
end end
def clear() def clear()
`mpc #{host_arg} clear` `mpc #{@host_arg} clear`
end end
def play() def play()
`mpc #{host_arg} play` `mpc #{@host_arg} play`
end end
def stop() def stop()
`mpc #{host_arg} stop` `mpc #{@host_arg} stop`
end end
def next() def next()
`mpc #{host_arg} next` `mpc #{@host_arg} next`
end end
def reset() def reset()
`mpc #{host_arg} clear` `mpc #{@host_arg} clear`
`mpc #{host_arg} add /` `mpc #{@host_arg} add /`
`mpc #{host_arg} shuffle` `mpc #{@host_arg} shuffle`
`mpc #{host_arg} repeat` `mpc #{@host_arg} repeat`
end end
def update() def update()
`mpc #{host_arg} update` `mpc #{@host_arg} update`
end end
def toggle() def toggle()
`mpc #{host_arg} toggle` `mpc #{@host_arg} toggle`
end end
def add(filename = nil) def add(filename = nil)
if filename == nil if filename == nil
`mpc #{host_arg} add /` `mpc #{@host_arg} add /`
else else
`mpc #{host_arg} add #{filename}` `mpc #{@host_arg} add #{filename}`
end end
return $?.success? return $?.success?
end end
def start() def start()
`systemctl start mpd` unless `ps aux | grep mpd` != "" `systemctl start mpd` unless `ps aux | grep mpd` != ""
`mpc ${host_arg} repeat` `mpc ${@host_arg} repeat`
end end
def running?() def running?()
@ -53,7 +53,7 @@ class MpcShim
end end
def nowplaying() def nowplaying()
return `mpc ${host_arg} | head -n 1` return `mpc ${@host_arg} | head -n 1`
end end
def initialize(hostname=:localhost) def initialize(hostname=:localhost)