Commit 8c8a1cee authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

lua: Expose a "meta fetcher".

Attempt to run scripts in share/lua/meta/fetcher.
parent b34c73d1
...@@ -181,6 +181,19 @@ static int read_meta( vlc_object_t *p_this, const char * psz_filename, ...@@ -181,6 +181,19 @@ static int read_meta( vlc_object_t *p_this, const char * psz_filename,
return 1; 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. * Read meta.
*****************************************************************************/ *****************************************************************************/
...@@ -197,6 +210,24 @@ int ReadMeta( vlc_object_t *p_this ) ...@@ -197,6 +210,24 @@ int ReadMeta( vlc_object_t *p_this )
return i_ret; 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. * Module entry point for art.
*****************************************************************************/ *****************************************************************************/
......
...@@ -64,8 +64,14 @@ vlc_module_begin () ...@@ -64,8 +64,14 @@ vlc_module_begin ()
set_callbacks( FindArt, NULL ) set_callbacks( FindArt, NULL )
add_submodule () add_submodule ()
set_shortname( N_( "Lua Meta Reader" ) ) set_shortname( N_( "Lua Meta Fetcher" ) )
set_description( N_("Fetch meta data using lua scripts") ) 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_capability( "meta reader", 10 )
set_callbacks( ReadMeta, NULL ) set_callbacks( ReadMeta, NULL )
...@@ -465,7 +471,7 @@ int __vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L, ...@@ -465,7 +471,7 @@ int __vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L,
else /* Play or Enqueue (preparse) */ else /* Play or Enqueue (preparse) */
/* FIXME: playlist_AddInput() can fail */ /* FIXME: playlist_AddInput() can fail */
playlist_AddInput( p_playlist, p_input, playlist_AddInput( p_playlist, p_input,
PLAYLIST_APPEND | PLAYLIST_APPEND |
( b_play ? PLAYLIST_GO : PLAYLIST_PREPARSE ), ( b_play ? PLAYLIST_GO : PLAYLIST_PREPARSE ),
PLAYLIST_END, true, false ); PLAYLIST_END, true, false );
i_count ++; /* increment counter */ i_count ++; /* increment counter */
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
* Module entry points * Module entry points
*****************************************************************************/ *****************************************************************************/
int ReadMeta( vlc_object_t * ); int ReadMeta( vlc_object_t * );
int FetchMeta( vlc_object_t * );
int FindArt( vlc_object_t * ); int FindArt( vlc_object_t * );
int Import_LuaPlaylist( vlc_object_t * ); int Import_LuaPlaylist( vlc_object_t * );
......
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