]> git.sesse.net Git - vlc/commitdiff
Make sure that the playlist item has been preparsed first (and don't get stuck in...
authorAntoine Cellerier <dionoea@videolan.org>
Sat, 13 Feb 2010 17:27:05 +0000 (18:27 +0100)
committerAntoine Cellerier <dionoea@videolan.org>
Sat, 13 Feb 2010 17:27:05 +0000 (18:27 +0100)
modules/misc/lua/libs/input.c
share/lua/intf/dumpmeta.lua

index 3010cafbb8576b31ea373c9cfeb8b5b327bbd226..1b7bd1ee67b50887e7ba9fbe2a5af1b98aeb1c76 100644 (file)
@@ -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 }
index 194d446b887804d6ee4b759c82fdbd1af5f54e18..78761117a0ed5e1253d8c483c4c529debf9c0a68 100644 (file)
 --]==========================================================================]
 
 --[[ 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()