[vlc-devel] commit: lua: Expose a "meta fetcher". (Pierre d'Herbemont )
git version control
git at videolan.org
Fri Jan 15 16:40:23 CET 2010
vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Wed Jan 13 13:14:21 2010 +0100| [8c8a1ceec5552442a5d2f76216ce01c33edc4da7] | committer: Pierre d'Herbemont
lua: Expose a "meta fetcher".
Attempt to run scripts in share/lua/meta/fetcher.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8c8a1ceec5552442a5d2f76216ce01c33edc4da7
---
modules/misc/lua/meta.c | 31 +++++++++++++++++++++++++++++++
modules/misc/lua/vlc.c | 10 ++++++++--
modules/misc/lua/vlc.h | 2 +-
3 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/modules/misc/lua/meta.c b/modules/misc/lua/meta.c
index fa389bd..22d4d26 100644
--- a/modules/misc/lua/meta.c
+++ b/modules/misc/lua/meta.c
@@ -181,6 +181,19 @@ static int read_meta( vlc_object_t *p_this, const char * psz_filename,
return 1;
}
+
+/*****************************************************************************
+ * Called through lua_scripts_batch_execute to call 'fetch_meta' on the script
+ * pointed by psz_filename.
+ *****************************************************************************/
+static int fetch_meta( vlc_object_t *p_this, const char * psz_filename,
+ lua_State * L, void * user_data )
+{
+ VLC_UNUSED(user_data);
+
+ return run(p_this, psz_filename, L, "fetch_meta");
+}
+
/*****************************************************************************
* Read meta.
*****************************************************************************/
@@ -197,6 +210,24 @@ int ReadMeta( vlc_object_t *p_this )
return i_ret;
}
+
+/*****************************************************************************
+ * Read meta.
+ *****************************************************************************/
+
+int FetchMeta( vlc_object_t *p_this )
+{
+ demux_meta_t *p_demux_meta = (demux_meta_t *)p_this;
+ input_item_t *p_item = p_demux_meta->p_item;
+
+ lua_State *L = init( p_this, p_item );
+ int i_ret = vlclua_scripts_batch_execute( p_this, "meta/fetcher", &fetch_meta, L, NULL );
+ lua_close( L );
+
+ return i_ret;
+}
+
+
/*****************************************************************************
* Module entry point for art.
*****************************************************************************/
diff --git a/modules/misc/lua/vlc.c b/modules/misc/lua/vlc.c
index 3613e11..6173b7c 100644
--- a/modules/misc/lua/vlc.c
+++ b/modules/misc/lua/vlc.c
@@ -64,8 +64,14 @@ vlc_module_begin ()
set_callbacks( FindArt, NULL )
add_submodule ()
- set_shortname( N_( "Lua Meta Reader" ) )
+ set_shortname( N_( "Lua Meta Fetcher" ) )
set_description( N_("Fetch meta data using lua scripts") )
+ set_capability( "meta fetcher", 10 )
+ set_callbacks( FetchMeta, NULL )
+
+ add_submodule ()
+ set_shortname( N_( "Lua Meta Reader" ) )
+ set_description( N_("Read meta data using lua scripts") )
set_capability( "meta reader", 10 )
set_callbacks( ReadMeta, NULL )
@@ -465,7 +471,7 @@ int __vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L,
else /* Play or Enqueue (preparse) */
/* FIXME: playlist_AddInput() can fail */
playlist_AddInput( p_playlist, p_input,
- PLAYLIST_APPEND |
+ PLAYLIST_APPEND |
( b_play ? PLAYLIST_GO : PLAYLIST_PREPARSE ),
PLAYLIST_END, true, false );
i_count ++; /* increment counter */
diff --git a/modules/misc/lua/vlc.h b/modules/misc/lua/vlc.h
index 11530b8..1e23233 100644
--- a/modules/misc/lua/vlc.h
+++ b/modules/misc/lua/vlc.h
@@ -45,7 +45,7 @@
* Module entry points
*****************************************************************************/
int ReadMeta( vlc_object_t * );
-
+int FetchMeta( vlc_object_t * );
int FindArt( vlc_object_t * );
int Import_LuaPlaylist( vlc_object_t * );
More information about the vlc-devel
mailing list