[vlc-devel] [PATCH 1/2] lua/libs/input: fix 17611: properly populate filename attribute

Pierre Ynard linkfanel at yahoo.fr
Sun Nov 6 22:11:04 CET 2016


> The previous implementations usage of input_item_GetName resulted in
> unexpected data in the filename attribute

I can agree so far.

> (given that input_item_GetName will first query vlc_meta_Title, and if
> present return that).

I don't follow, that would be input_item_GetTitleFbName() instead.
The only other relationship I'm aware of between name field and title
metadata is that the lua binding to add new items copies from name to
title if the title is missing.

> These changes extracts the filename for a given item, including
> support for trailing slashes (so that we do not get an empty filename
> for a path such as file:///media/).

That's a change in the API that can break current users. Have you
analyzed the potential users relying on that behavior, in tree and out
of tree? I see at least two meta scripts in tree (both seemingly broken
for years).

I'm not sure what's your real problem here. I agree that this field is
confusing, "filename" is misleading and it doesn't necessary belong
within metadata. The name field is exposed in the CLI through the
misnamed get_title command. The URI is exposed through the lua bindings
through item:uri(), and the "file name" part of it can be easily
obtained from it; alhough it's not available in the CLI.

I'm all for 1/ deprecating that field, 2/ improving known users of that
weird field to use something else like item:uri() or item:name() and 3/
improving CLI commands to display more, relevant information, but moving
away from that metadata abuse. Aliasing get_title to get_name, adding a
get_uri, and adding a section to info or a new command summarizing lua
item fields, all sound like good ideas to me.

> +    if( psz_filename && psz_filename[1] == '\0' )
> +    {
> +        psz_filename[0] = '\0';
> +        psz_filename = strrchr( psz_uri, '/' );
> +    }

In any case this could use a comment because it took me way too long to
understand what it's for.

-- 
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