When i tried to sort the VLC media from browser based on their API it just returns me an invalid search key error.
This is their API.
The http request i used to sort the playlist is :
After i send the request VLC returns me this error:
This help would be a life saving
Let's consider VLC media player 3.0.13-8-g41878ff4f2
as the current version.
It seems that, currently, the following documentation sources are outdated:
vlc/README.txt at 3.0.17.4 · videolan/vlc:
> sort playlist using sort mode <val> and order <id>:
?command=pl_sort&id=<id>&val=<val>
If id=0 then items will be sorted in normal order, if id=1 they will be
sorted in reverse order
A non exhaustive list of sort modes:
0 Id
1 Name
3 Author
5 Random
7 Track number
It seems that the «Invalid search key» error is detected by the following piece of source code: vlc/playlist.c at f32f289264fd4a08c8b5f04d8395ea78f358f291 · videolan/vlc:
/* allow setting the different sort keys */
int i_mode = vlc_sort_key_from_string( luaL_checkstring( L, 1 ) );
if( i_mode == -1 )
return luaL_error( L, "Invalid search key." );
Please, note that the vlc_sort_key_from_string()
function validates the provided val
parameter value.
The valid val
parameter values may be found in the vlc_sort_key_from_string()
function: vlc/playlist.c at f32f289264fd4a08c8b5f04d8395ea78f358f291 · videolan/vlc:
static const struct
{
const char *psz_name;
int i_key;
} pp_keys[] =
{ { "id", SORT_ID },
{ "title", SORT_TITLE },
{ "title nodes first", SORT_TITLE_NODES_FIRST },
{ "artist", SORT_ARTIST },
{ "genre", SORT_GENRE },
{ "random", SORT_RANDOM },
{ "duration", SORT_DURATION },
{ "title numeric", SORT_TITLE_NUMERIC },
{ "album", SORT_ALBUM },
{ NULL, -1 } };
I have run a quick check: performed an HTTP GET request to sort items in a random order:
GET /requests/status.xml?command=pl_sort&id=0&val=random
It has worked correctly: the order of the playlist items has been changed appropriately.
This feature has been requested many times, but it has not been implemented yet:
Please, note that it does not matter which type of user interface is used (for example, graphical user interface or HTTP interface).
It might be a case that a workaround for your particular use case may be implemented.
For example, it seems to be possible to perform the following operations by using the HTTP interface:
GET /requests/playlist.xml
).GET /requests/status.xml?command=pl_empty
).GET /requests/status.xml?command=in_enqueue&input=<mrl>
).Therefore, it looks like:
Please, consider asking a separate question with the detailed use case description.