[vlc-devel] [PATCH 06/15] lua: Add a minimal medialib API

Pierre Ynard linkfanel at yahoo.fr
Wed Jun 24 10:52:28 CEST 2020


This should document the new lua bindings in share/lua/README.txt; as
far as I can tell, this isn't done in any of the patches.

>  include/vlc_media_library.h             |   1 +
>  modules/misc/medialibrary/entities.cpp  |   2 +
>  src/misc/medialibrary.c                 |   1 +

Maybe required changes to the core could be split as a separate patch.

> +setupHandlers = function(h, password)
> +    handlers = {
> +        h:handler("/medialib/video", nil, password, wrapHandler(listVideo), nil),
> +        h:handler("/medialib/audio", nil, password, wrapHandler(listAudio), nil),
> +        h:handler("/medialib/thumbnail", nil, password, wrapHandler(getThumbnail), nil),
> +        h:handler("/medialib/albums", nil, password, wrapHandler(listAlbums), nil),
> +        h:handler("/medialib/album", nil, password, wrapHandler(getAlbum), nil),
> +        h:handler("/medialib/album/thumbnail", nil, password, wrapHandler(getAlbumThumbnail), nil),
> +        h:handler("/medialib/album/tracks", nil, password, wrapHandler(getAlbumTracks), nil),
> +        h:handler("/medialib/artists", nil, password, wrapHandler(listArtists), nil),
> +        h:handler("/medialib/artist", nil, password, wrapHandler(getArtist), nil),
> +        h:handler("/medialib/artist/albums", nil, password, wrapHandler(getArtistAlbums), nil),
> +        h:handler("/medialib/artist/thumbnail", nil, password, wrapHandler(getArtistThumbnail), nil),
> +        h:handler("/medialib/genres", nil, password, wrapHandler(listGenres), nil),
> +        h:handler("/medialib/genre", nil, password, wrapHandler(getGenre), nil),
> +        h:handler("/medialib/genre/albums", nil, password, wrapHandler(getGenreAlbums), nil),
> +        h:handler("/medialib/genre/artists", nil, password, wrapHandler(getGenreArtists), nil),
> +    }
> +    -- Return the handlers so they don't immediatly get garbage collected
> +    return handlers
> +end

It doesn't seem very modular to hardcode all these paths, nor to assume
that no caller will ever want user-based authentication; perhaps the
path root and user could be taken as arguments.

-- 
Pierre Ynard
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."


More information about the vlc-devel mailing list