[vlc-devel] [lua/http] Playlist move

Gavin Lambert vlc at mirality.co.nz
Sat Jan 17 13:20:31 CET 2015


Hi,

A long while ago I asked on the user forums for a way to fiddle 
with the VLC playlist from another app running on the same machine 
(https://forum.videolan.org/viewtopic.php?t=116632).  In that 
thread I was told to use the HTTP interface.  I've been using that 
successfully for a while to view the current state of the 
playlist, but now I'm trying to manipulate it a little and am 
experiencing some bugs.  (I assume that this is still the "right" 
way to interface to VLC externally?)

Firstly, I noticed that the LUA playlist object exposes a "move" 
method, but that this is not surfaced to the HTTP API.  I've 
already made a trivial patch to 
share/lua/intf/modules/httprequests.lua which enables this, and 
was planning to send this through to here once I had tested it.

Unfortunately it looks like there's a bug in the C code for this.

In /src/playlist/item.c, the playlist_TreeMove function is 
expecting the target location to be specified as the new index in 
the parent's children list, which is reasonable enough.

However in /modules/lua/libs/playlist.c, the vlclua_playlist_move 
function accepts the id of the "target to insert after" as its own 
parameter, and then passes on the difference between this target's 
id and the id of the first child.  This is obviously wrong (at 
best it will work exactly once, if the ids happen to be 
consecutive, which will not be the case after the move succeeds).

I'm not familiar enough with the C code as yet to suggest a 
specific fix for this second issue, but I assume it'll need to 
find the actual index of the target child instead of using its id 
to "calculate" it.

Any chance this can be fixed sometime soon?  I can send through 
the patch for the lua interface, if that will help (it's pretty 
trivial though).

Regards,
Gavin Lambert




More information about the vlc-devel mailing list