From 61642608126855b643de8456d8677d9b3a9a5c2f Mon Sep 17 00:00:00 2001 From: Antoine Cellerier Date: Sat, 13 Feb 2010 18:27:05 +0100 Subject: [PATCH] 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. --- modules/misc/lua/libs/input.c | 7 +++++++ share/lua/intf/dumpmeta.lua | 10 ++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/modules/misc/lua/libs/input.c b/modules/misc/lua/libs/input.c index 3010cafbb8..1b7bd1ee67 100644 --- a/modules/misc/lua/libs/input.c +++ b/modules/misc/lua/libs/input.c @@ -311,6 +311,12 @@ static int vlclua_input_item_metas( lua_State *L ) 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 ) { input_item_t *p_item = vlclua_input_item_get_internal( L ); @@ -381,6 +387,7 @@ void luaopen_input( lua_State *L ) } static const luaL_Reg vlclua_input_item_reg[] = { + { "is_preparsed", vlclua_input_item_is_preparsed }, { "metas", vlclua_input_item_metas }, { "set_meta", vlclua_input_item_set_meta }, { NULL, NULL } diff --git a/share/lua/intf/dumpmeta.lua b/share/lua/intf/dumpmeta.lua index 194d446b88..78761117a0 100644 --- a/share/lua/intf/dumpmeta.lua +++ b/share/lua/intf/dumpmeta.lua @@ -22,18 +22,20 @@ --]==========================================================================] --[[ 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 - meta = vlc.input.metas() -until meta + item = vlc.input.item() +until (item and item:is_preparsed()) or vlc.misc.should_die() +local meta = item:metas() vlc.msg.info("Dumping meta data") if meta then for key, value in pairs(meta) do vlc.msg.info(key..": "..value) end end + vlc.misc.quit() -- 2.39.2