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 'video_info'
require 'uri'

View File

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