Hello,
is it possile to open a .xspf playlist? vlc.playlist.add only accepts playlist items so that's not working.
Any info is appreciated!
Code: Select all
mytable = {}
number = 1
while true do
line = s:readline()
if line == nil then break end
mytable[number] = {}
mytable[number].path = "file:///" .. line
number = number + 1
end
for i = 1, #mytable do
vlc.playlist.enqueue({mytable[i]})
end
It does add all of them but crashes VLC anyway. Why is it crashing? If I add those same videos from a folder it works.vlc.playlist.enqueue(mytable)
Code: Select all
tadedPath = "taded.txt"
--playlistLocation = vlc.path
function key_press( var, old, new, data )
local key = new
--print("key_press:",tostring(key))
if true then
d:hide()
-- else
--vlc.msg.err("Key `"..key.."' isn't bound to any action.")
end
end
--vlc.var.add_callback( vlc.object.libvlc(), "key-pressed", key_press )
--vlc.var.add_callback( vlc.object.libvlc(), "action-triggered", action_trigger )
function saveToFile()
io.output(tadedPath)
io.write("-- vlcTADED --","\n")
io.write("Show Name","\n")
io.write("playlist id from last episode","\n") --currentID = vlc.playlist.current() -- clear playlist before loading new files with playlist.clear() for correct id
io.write("episode time","\n") --currentTime = vlc.var.get(inpt, "time")
io.write("\n","-- files --")
playlist = vlc.playlist.get()
for i, item in pairs(vlc.playlist.get("playlist",false).children) do
io.write("\n",item.path)
end
io.close()
end
function descriptor()
return {
title = "TADED";
version = "0.1";
author = "FizzeBu";
shortdesc = "Watch TV ALL DAY EVERYDAY";
description = "Continues TV-shows for the lazy minded.";
capabilities = {"input-listener"}
}
end
function readTADEDfile()
local s = vlc.stream( "file:///D:/Program%20Files%20%28x86%29/VideoLAN/VLC/taded.txt" ) -- specific to my system
if (s:readline() ~= "-- vlcTADED --" ) then return 0 end
buttonName = s:readline()
tadedID = s:readline()
tadedTime = s:readline()
s:readline() -- empty line for looks
d:set_title(s:readline())
vlc.playlist.clear()
mytable = {}
number = 1
while true do
line = s:readline()
if line == nil then break end
mytable[number] = {}
mytable[number].path = line
number = number + 1
end
vlc.playlist.enqueue(mytable)
end
function activate()
d = vlc.dialog( "My VLC Extension" )
d:set_title("TADED")
d:add_button("Create TADED file for this playlist", saveToFile,1,1)
d:add_button("readTADEDfile", readTADEDfile,1,2)
readTADEDfile ()
--d:show()
end
Code: Select all
-- vlcTADED --
Show Name
playlist id from last episode
episode time
-- files --
file:///D:/Videos/...
file:///D:/Videos/...
file:///D:/Videos/...
Code: Select all
function meta_changed()
-- You better always define this empty function even if you do not need it
-- and even if "meta-listener" capability is not specified in descriptor()!
end
function input_changed()
-- Related to "input-listener" capability specified in descriptor().
end
function close()
-- Related to dialog box close event.
end
function deactivate()
end
Code: Select all
local file, err, code = io.open(path, "r")
if file then io.close(file) end
Return to “Scripting VLC in lua”
Users browsing this forum: No registered users and 7 guests