support nonlocal

This commit is contained in:
stryan 2021-12-22 14:48:31 -05:00
parent 416093b089
commit f8dde5672b
2 changed files with 18 additions and 14 deletions

View File

@ -1,3 +1,4 @@
#!/usr/bin/ruby
require 'discordrb' require 'discordrb'
require 'video_info' require 'video_info'
require 'uri' require 'uri'

View File

@ -1,49 +1,52 @@
class MpcShim class MpcShim
def update() def update()
`mpc update` `mpc #{host_arg} update`
end end
def clear() def clear()
`mpc clear` `mpc #{host_arg} clear`
end end
def play() def play()
`mpc play` `mpc #{host_arg} play`
end end
def stop() def stop()
`mpc stop` `mpc #{host_arg} stop`
end end
def next() def next()
`mpc next` `mpc #{host_arg} next`
end end
def reset() def reset()
`mpc clear` `mpc #{host_arg} clear`
`mpc add /` `mpc #{host_arg} add /`
`mpc shuffle` `mpc #{host_arg} shuffle`
`mpc repeat` `mpc #{host_arg} repeat`
end end
def update() def update()
`mpc update` `mpc #{host_arg} update`
end end
def toggle() def toggle()
`mpc toggle` `mpc #{host_arg} toggle`
end end
def add(filename = nil) def add(filename = nil)
if filename == nil if filename == nil
`mpc add /` `mpc #{host_arg} add /`
else else
`mpc add #{filename}` `mpc #{host_arg} add #{filename}`
end end
return $?.success? return $?.success?
end end
def initialize() def initialize(hostname=:localhost)
if hostname != :localhost
@host_arg = "--host #{hostname} "
end
true true
end end