Using playlist.add in a Lua extension

Discuss your Lua playlist, album art and interface scripts.
Riley
New Cone
New Cone
Posts: 9
Joined: 29 Aug 2008 23:57

Using playlist.add in a Lua extension

Postby Riley » 01 Jul 2010 07:17

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.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Using playlist.add in a Lua extension

Postby Jean-Baptiste Kempf » 01 Jul 2010 17:32

vlc.playlist.add(mytable.path)
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

Riley
New Cone
New Cone
Posts: 9
Joined: 29 Aug 2008 23:57

Re: Using playlist.add in a Lua extension

Postby Riley » 01 Jul 2010 17:38

Thanks, but that syntax just gives me the "Playlist item should be a table" error.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Using playlist.add in a Lua extension

Postby Jean-Baptiste Kempf » 01 Jul 2010 18:00

File a bug on trac.videolan.org
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

Riley
New Cone
New Cone
Posts: 9
Joined: 29 Aug 2008 23:57

Re: Using playlist.add in a Lua extension

Postby Riley » 01 Jul 2010 18:33

OK. Thanks.

ivoire
Cone that earned his stripes
Cone that earned his stripes
Posts: 413
Joined: 20 Aug 2008 11:29
VLC version: trunk
Operating System: linux (debian sid)
Contact:

Re: Using playlist.add in a Lua extension

Postby ivoire » 01 Jul 2010 18:59

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 ?

Riley
New Cone
New Cone
Posts: 9
Joined: 29 Aug 2008 23:57

Re: Using playlist.add in a Lua extension

Postby Riley » 01 Jul 2010 19:35

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.
Last edited by Riley on 01 Jul 2010 21:40, edited 1 time in total.

ivoire
Cone that earned his stripes
Cone that earned his stripes
Posts: 413
Joined: 20 Aug 2008 11:29
VLC version: trunk
Operating System: linux (debian sid)
Contact:

Re: Using playlist.add in a Lua extension

Postby ivoire » 01 Jul 2010 20:04

Code: Select all

mytable = {} mytable.path = "file:///C:\\myvideo.avi" vlc.playlist.add({mytable})

Riley
New Cone
New Cone
Posts: 9
Joined: 29 Aug 2008 23:57

Re: Using playlist.add in a Lua extension

Postby Riley » 01 Jul 2010 21:45

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. :D

Thank you very much.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Using playlist.add in a Lua extension

Postby Jean-Baptiste Kempf » 02 Jul 2010 00:25

Nice :D
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.


Return to “Scripting VLC in lua”

Who is online

Users browsing this forum: No registered users and 6 guests