- local input = _GET['input']
- local command = _GET['command']
- local id = tonumber(_GET['id'] or -1)
- local val = _GET['val']
- local options = _GET['option']
- local band = _GET['band']
- if type(options) ~= "table" then -- Deal with the 0 or 1 option case
- options = { options }
- end
-
- if command == "in_play" then
- --[[
- vlc.msg.err( "<options>" )
- for a,b in ipairs(options) do
- vlc.msg.err(b)
- end
- vlc.msg.err( "</options>" )
- --]]
- vlc.playlist.add({{path=stripslashes(input),options=options}})
- elseif command == "addsubtitle" then
- vlc.input.add_subtitle (stripslashes(val))
- elseif command == "in_enqueue" then
- vlc.playlist.enqueue({{path=stripslashes(input),options=options}})
- elseif command == "pl_play" then
- if id == -1 then
- vlc.playlist.play()
- else
- vlc.playlist.goto(id)
- end
- elseif command == "pl_pause" then
- if vlc.playlist.status() == "stopped" then
- if id == -1 then
- vlc.playlist.play()
- else
- vlc.playlist.goto(id)
- end
- else
- vlc.playlist.pause()
- end
- elseif command == "pl_forcepause" then
- if vlc.playlist.status() == "playing" then
- vlc.playlist.pause()
- end
- elseif command == "pl_forceresume" then
- if vlc.playlist.status() == "paused" then
- vlc.playlist.pause()
- end
- elseif command == "pl_stop" then
- vlc.playlist.stop()
- elseif command == "pl_next" then
- vlc.playlist.next()
- elseif command == "pl_previous" then
- vlc.playlist.prev()
- elseif command == "pl_delete" then
- vlc.playlist.delete(id)
- elseif command == "pl_empty" then
- vlc.playlist.clear()
- elseif command == "pl_sort" then
- vlc.playlist.sort( val, id > 0 )
- elseif command == "pl_random" then
- vlc.playlist.random()
- elseif command == "pl_loop" then
- vlc.playlist.loop()
- elseif command == "pl_repeat" then
- vlc.playlist.repeat_()
- elseif command == "pl_sd" then
- if vlc.sd.is_loaded(val) then
- vlc.sd.remove(val)
- else
- vlc.sd.add(val)
- end
- elseif command == "fullscreen" then
- vlc.video.fullscreen()
- elseif command == "snapshot" then
- common.snapshot()
- elseif command == "volume" then
- common.volume(val)
- elseif command == "seek" then
- common.seek(val)
- elseif command == "key" then
- common.hotkey("key-"..val)
- elseif command == "audiodelay" then
- if vlc.object.input() and val then
- vlc.var.set(vlc.object.input(),"audio-delay",val)
- end
- elseif command == "rate" then
- if vlc.object.input() and tonumber(val) >= 0 then
- vlc.var.set(vlc.object.input(),"rate",val)
- end
- elseif command == "subdelay" then
- if vlc.object.input() then
- vlc.var.set(vlc.object.input(),"spu-delay",val)
- end
- elseif command == "aspectratio" then
- if vlc.object.vout() then
- vlc.var.set(vlc.object.vout(),"aspect-ratio",val)
- end
- elseif command == "preamp" then
- vlc.equalizer.preampset(val)
- elseif command == "equalizer" then
- vlc.equalizer.equalizerset(band,val)
- elseif command == "enableeq" then
- if val == '0' then vlc.equalizer.enable(false) else vlc.equalizer.enable(true) end
- end
-
- local input = nil
- local command = nil
- local id = nil
- local val = nil
+ local input = _GET['input']
+ local command = _GET['command']
+ local id = tonumber(_GET['id'] or -1)
+ local val = _GET['val']
+ local options = _GET['option']
+ local band = tonumber(_GET['band'])
+ if type(options) ~= "table" then -- Deal with the 0 or 1 option case
+ options = { options }
+ end
+
+ if command == "in_play" then
+ --[[
+ vlc.msg.err( "<options>" )
+ for a,b in ipairs(options) do
+ vlc.msg.err(b)
+ end
+ vlc.msg.err( "</options>" )
+ --]]
+ vlc.playlist.add({{path=vlc.strings.make_uri(input),options=options}})
+ elseif command == "addsubtitle" then
+ vlc.input.add_subtitle (vlc.strings.make_uri(val))
+ elseif command == "in_enqueue" then
+ vlc.playlist.enqueue({{path=vlc.strings.make_uri(input),options=options}})
+ elseif command == "pl_play" then
+ if id == -1 then
+ vlc.playlist.play()
+ else
+ vlc.playlist.gotoitem(id)
+ end
+ elseif command == "pl_pause" then
+ if vlc.playlist.status() == "stopped" then
+ if id == -1 then
+ vlc.playlist.play()
+ else
+ vlc.playlist.gotoitem(id)
+ end
+ else
+ vlc.playlist.pause()
+ end
+ elseif command == "pl_forcepause" then
+ if vlc.playlist.status() == "playing" then
+ vlc.playlist.pause()
+ end
+ elseif command == "pl_forceresume" then
+ if vlc.playlist.status() == "paused" then
+ vlc.playlist.pause()
+ end
+ elseif command == "pl_stop" then
+ vlc.playlist.stop()
+ elseif command == "pl_next" then
+ vlc.playlist.next()
+ elseif command == "pl_previous" then
+ vlc.playlist.prev()
+ elseif command == "pl_delete" then
+ vlc.playlist.delete(id)
+ elseif command == "pl_empty" then
+ vlc.playlist.clear()
+ elseif command == "pl_sort" then
+ vlc.playlist.sort( val, id > 0 )
+ elseif command == "pl_random" then
+ vlc.playlist.random()
+ elseif command == "pl_loop" then
+ --if loop is set true, then repeat needs to be set false
+ if vlc.playlist.loop() then
+ vlc.playlist.repeat_("off")
+ end
+ elseif command == "pl_repeat" then
+ --if repeat is set true, then loop needs to be set false
+ if vlc.playlist.repeat_() then
+ vlc.playlist.loop("off")
+ end
+ elseif command == "pl_sd" then
+ if vlc.sd.is_loaded(val) then
+ vlc.sd.remove(val)
+ else
+ vlc.sd.add(val)
+ end
+ elseif command == "fullscreen" then
+ vlc.video.fullscreen()
+ elseif command == "snapshot" then
+ common.snapshot()
+ elseif command == "volume" then
+ common.volume(val)
+ elseif command == "seek" then
+ common.seek(val)
+ elseif command == "key" then
+ common.hotkey("key-"..val)
+ elseif command == "audiodelay" then
+ if vlc.object.input() and val then
+ val = common.us_tonumber(val)
+ vlc.var.set(vlc.object.input(),"audio-delay",val)
+ end
+ elseif command == "rate" then
+ val = common.us_tonumber(val)
+ if vlc.object.input() and val >= 0 then
+ vlc.var.set(vlc.object.input(),"rate",val)
+ end
+ elseif command == "subdelay" then
+ if vlc.object.input() then
+ val = common.us_tonumber(val)
+ vlc.var.set(vlc.object.input(),"spu-delay",val)
+ end
+ elseif command == "aspectratio" then
+ if vlc.object.vout() then
+ vlc.var.set(vlc.object.vout(),"aspect-ratio",val)
+ end
+ elseif command == "preamp" then
+ val = common.us_tonumber(val)
+ vlc.equalizer.preampset(val)
+ elseif command == "equalizer" then
+ val = common.us_tonumber(val)
+ vlc.equalizer.equalizerset(band,val)
+ elseif command == "enableeq" then
+ if val == '0' then vlc.equalizer.enable(false) else vlc.equalizer.enable(true) end
+ elseif command == "setpreset" then
+ vlc.equalizer.setpreset(val)
+ elseif command == "title" then
+ vlc.var.set(vlc.object.input(), "title", val)
+ elseif command == "chapter" then
+ vlc.var.set(vlc.object.input(), "chapter", val)
+ elseif command == "audio_track" then
+ vlc.var.set(vlc.object.input(), "audio-es", val)
+ elseif command == "video_track" then
+ vlc.var.set(vlc.object.input(), "video-es", val)
+ elseif command == "subtitle_track" then
+ vlc.var.set(vlc.object.input(), "spu-es", val)
+ end
+
+ local input = nil
+ local command = nil
+ local id = nil
+ local val = nil