1 /*****************************************************************************
2 * luameta.c: Get meta/artwork using lua scripts
3 *****************************************************************************
4 * Copyright (C) 2007 the VideoLAN team
7 * Authors: Antoine Cellerier <dionoea at videolan tod org>
8 * Pierre d'Herbemont <pdherbemont # videolan.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
27 /*****************************************************************************
29 *****************************************************************************/
35 #include <vlc_input.h>
36 #include <vlc_playlist.h>
39 #include <vlc_strings.h>
40 #include <vlc_stream.h>
41 #include <vlc_charset.h>
43 #ifdef HAVE_SYS_STAT_H
44 # include <sys/stat.h>
47 #include <lua.h> /* Low level lua C API */
48 #include <lauxlib.h> /* Higher level C API */
49 #include <lualib.h> /* Lua libs */
51 /*****************************************************************************
53 *****************************************************************************/
54 int E_(FindArt)( vlc_object_t * );
55 int E_(FindMeta)( vlc_object_t * );
57 int E_(Import_LuaPlaylist)( vlc_object_t * );
58 void E_(Close_LuaPlaylist)( vlc_object_t * );
61 /*****************************************************************************
63 *****************************************************************************/
64 static inline void lua_Dbg( vlc_object_t * p_this, const char * ppz_fmt, ... )
66 if( p_this->p_libvlc->i_verbose < 3 )
70 va_start( ap, ppz_fmt );
71 __msg_GenericVa( ( vlc_object_t *)p_this, MSG_QUEUE_NORMAL,
72 VLC_MSG_DBG, MODULE_STRING,
77 /*****************************************************************************
79 *****************************************************************************/
80 vlc_object_t * vlclua_get_this( lua_State *p_state );
81 int vlclua_stream_new( lua_State *p_state );
82 int vlclua_stream_read( lua_State *p_state );
83 int vlclua_stream_readline( lua_State *p_state );
84 int vlclua_stream_delete( lua_State *p_state );
85 int vlclua_decode_uri( lua_State *p_state );
86 int vlclua_resolve_xml_special_chars( lua_State *p_state );
87 int vlclua_msg_dbg( lua_State *p_state );
88 int vlclua_msg_warn( lua_State *p_state );
89 int vlclua_msg_err( lua_State *p_state );
90 int vlclua_msg_info( lua_State *p_state );
93 /*****************************************************************************
94 * Will execute func on all scripts in luadirname, and stop if func returns
96 *****************************************************************************/
97 int vlclua_scripts_batch_execute( vlc_object_t *p_this, const char * luadirname,
98 int (*func)(vlc_object_t *, const char *, lua_State *, void *),
99 lua_State * p_state, void * user_data);
103 /*****************************************************************************
104 * Meta data setters utility.
105 *****************************************************************************/
106 void vlclua_read_meta_data( vlc_object_t *p_this,
107 lua_State *p_state, int o, int t, input_item_t *p_input );
110 void vlclua_read_custom_meta_data( vlc_object_t *p_this,
111 lua_State *p_state, int o, int t, input_item_t *p_input );
113 #endif /* VLC_LUA_H */