Commit 61642608 authored by Antoine Cellerier's avatar Antoine Cellerier

Make sure that the playlist item has been preparsed first (and don't get stuck...

Make sure that the playlist item has been preparsed first (and don't get stuck in an infinite loop). Note that libs/input.c is a mess and would need to be cleanup before we release 1.1.
parent 1fac125a
...@@ -311,6 +311,12 @@ static int vlclua_input_item_metas( lua_State *L ) ...@@ -311,6 +311,12 @@ static int vlclua_input_item_metas( lua_State *L )
return 1; return 1;
} }
static int vlclua_input_item_is_preparsed( lua_State *L )
{
lua_pushboolean( L, input_item_IsPreparsed( vlclua_input_item_get_internal( L ) ) );
return 1;
}
static int vlclua_input_item_set_meta( lua_State *L ) static int vlclua_input_item_set_meta( lua_State *L )
{ {
input_item_t *p_item = vlclua_input_item_get_internal( L ); input_item_t *p_item = vlclua_input_item_get_internal( L );
...@@ -381,6 +387,7 @@ void luaopen_input( lua_State *L ) ...@@ -381,6 +387,7 @@ void luaopen_input( lua_State *L )
} }
static const luaL_Reg vlclua_input_item_reg[] = { static const luaL_Reg vlclua_input_item_reg[] = {
{ "is_preparsed", vlclua_input_item_is_preparsed },
{ "metas", vlclua_input_item_metas }, { "metas", vlclua_input_item_metas },
{ "set_meta", vlclua_input_item_set_meta }, { "set_meta", vlclua_input_item_set_meta },
{ NULL, NULL } { NULL, NULL }
......
...@@ -22,18 +22,20 @@ ...@@ -22,18 +22,20 @@
--]==========================================================================] --]==========================================================================]
--[[ to dump meta data information in the debug output, run: --[[ to dump meta data information in the debug output, run:
vlc -I lua --lua-intf dumpmeta coolmusic.mp3 vlc -I lua --lua-intf dumpmeta -v=0 coolmusic.mp3
--]] --]]
local meta local item
repeat repeat
meta = vlc.input.metas() item = vlc.input.item()
until meta until (item and item:is_preparsed()) or vlc.misc.should_die()
local meta = item:metas()
vlc.msg.info("Dumping meta data") vlc.msg.info("Dumping meta data")
if meta then if meta then
for key, value in pairs(meta) do for key, value in pairs(meta) do
vlc.msg.info(key..": "..value) vlc.msg.info(key..": "..value)
end end
end end
vlc.misc.quit() vlc.misc.quit()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment