support nonlocal
This commit is contained in:
parent
416093b089
commit
f8dde5672b
1
main.rb
1
main.rb
@ -1,3 +1,4 @@
|
||||
#!/usr/bin/ruby
|
||||
require 'discordrb'
|
||||
require 'video_info'
|
||||
require 'uri'
|
||||
|
31
mpc_shim.rb
31
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user