diff --git a/main.rb b/main.rb index c2f49df..f1d831e 100644 --- a/main.rb +++ b/main.rb @@ -1,3 +1,4 @@ +#!/usr/bin/ruby require 'discordrb' require 'video_info' require 'uri' diff --git a/mpc_shim.rb b/mpc_shim.rb index 92b47fc..a656905 100644 --- a/mpc_shim.rb +++ b/mpc_shim.rb @@ -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