medialibrary: expose the `publicOnly` query parameter

Allow medialibrary queries to process and list public media.

Public media are a new addition of the medialibrary 0.13 version. With
this, the users will have the opportunity to allow a subset of the
medialibrary to be exposed on network interfaces (notably the upnp
server and the HTTP remote control).

Community discussions around the subject can be found here:
https://code.videolan.org/videolan/vlc/-/merge_requests/269#note_274345
This commit is contained in:
Alaric Senat 2024-04-05 10:36:49 +02:00 committed by Steve Lhomme
parent 533ff6236d
commit c4a3e9ceee
4 changed files with 5 additions and 0 deletions

View File

@ -443,6 +443,7 @@ typedef struct vlc_ml_query_params_t
vlc_ml_sorting_criteria_t i_sort;
bool b_desc;
bool b_favorite_only;
bool b_public_only;
} vlc_ml_query_params_t;
enum vlc_ml_get_queries

View File

@ -251,12 +251,14 @@ static void vlclua_ml_assign_params( lua_State *L, vlc_ml_query_params_t *params
*params = vlc_ml_query_params_create();
if (!lua_istable(L, paramIndex))
return;
lua_getfield(L, 1, "public_only" );
lua_getfield(L, 1, "favorite_only" );
lua_getfield(L, 1, "limit" );
lua_getfield(L, 1, "offset" );
lua_getfield(L, 1, "desc" );
lua_getfield(L, 1, "sort" );
lua_getfield(L, 1, "pattern" );
params->b_public_only = lua_toboolean( L, -7 );
params->b_favorite_only = lua_toboolean( L, -6 );
params->i_nbResults = lua_tointeger( L, -5 );
params->i_offset = lua_tointeger( L, -4 );

View File

@ -775,6 +775,7 @@ int MediaLibrary::List( int listQuery, const vlc_ml_query_params_t* params, va_l
p.desc = params->b_desc;
p.sort = sortingCriteria( params->i_sort );
p.favoriteOnly = params->b_favorite_only;
p.publicOnly = params->b_public_only;
nbItems = params->i_nbResults;
offset = params->i_offset;
psz_pattern = params->psz_pattern;

View File

@ -432,6 +432,7 @@ query_params = {
"sort": integer,
"pattern": string,
"favorite_only": boolean,
"public_only": boolean,
}
vlc.ml.video(query_params): Get video media list