Page 1 of 1
Using playlist.add in a Lua extension
Posted: 01 Jul 2010 07:17
by Riley
I'm working on a custom extension for changing playlists, and I can't seem to work out how exactly to get playlist.add or playlist.enqueue working in a Lua file.
Code: Select all
mytable = {}
mytable.path = { "file:///C:\\myvideo.avi" }
vlc.playlist.add(mytable)
I've tried a few variations, and I keep getting the error messages "Playlist item should be a table" or "Playlist item's path should be a string".
Any ideas on how to get a local file loaded into a playlist via Lua?
Or how to load an entire playlist in from a .xspf file?
Thanks.
Re: Using playlist.add in a Lua extension
Posted: 01 Jul 2010 17:32
by Jean-Baptiste Kempf
vlc.playlist.add(mytable.path)
Re: Using playlist.add in a Lua extension
Posted: 01 Jul 2010 17:38
by Riley
Thanks, but that syntax just gives me the "Playlist item should be a table" error.
Re: Using playlist.add in a Lua extension
Posted: 01 Jul 2010 18:00
by Jean-Baptiste Kempf
File a bug on trac.videolan.org
Re: Using playlist.add in a Lua extension
Posted: 01 Jul 2010 18:33
by Riley
OK. Thanks.
Re: Using playlist.add in a Lua extension
Posted: 01 Jul 2010 18:59
by ivoire
And what about ? (never tryied but...)
Code: Select all
mytable = {}
mytable.path = "file:///C:\\myvideo.avi"
vlc.playlist.add(mytable)
Is it working this way ?
Re: Using playlist.add in a Lua extension
Posted: 01 Jul 2010 19:35
by Riley
I tried that syntax too, and got a similar error. I've been reading up on the documentation, but haven't found any working full examples.
Also, the goal is to be able load multiple files into the current playlist, so please tell me if you know a better way to do this.
Thanks.
Re: Using playlist.add in a Lua extension
Posted: 01 Jul 2010 20:04
by ivoire
Code: Select all
mytable = {}
mytable.path = "file:///C:\\myvideo.avi"
vlc.playlist.add({mytable})
Re: Using playlist.add in a Lua extension
Posted: 01 Jul 2010 21:45
by Riley
Code: Select all
mytable = {}
mytable.path = "file:///C:\\myvideo.avi"
vlc.playlist.add({mytable})
You are awesome ivoire. That totally works. I think I tried every other variation except for that one with the brackets moved.
Thank you very much.
Re: Using playlist.add in a Lua extension
Posted: 02 Jul 2010 00:25
by Jean-Baptiste Kempf
Nice