Changeset f95f8bd64da303985e7f5b70af8838f9ec7f5d21

Show
Ignore:
Timestamp:
08/15/07 06:40:32 (1 year ago)
Author:
Pierre d'Herbemont <pdherbemont@videolan.org>
git-committer:
Pierre d'Herbemont <pdherbemont@videolan.org> 1187152832 +0000
git-parent:

[51880eb16eed467a21c34b9e4bb962d1bd6a5be7]

git-author:
Pierre d'Herbemont <pdherbemont@videolan.org> 1187152832 +0000
Message:

modules/meta_engine/luameta.c: Add resolve_xml_special_chars and decode_uri to the lua env.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/meta_engine/luameta.c

    r51880eb rf95f8bd  
    3232#include <vlc_playlist.h> 
    3333#include <vlc_meta.h> 
     34#include <vlc_url.h> 
     35#include <vlc_strings.h> 
    3436#include <vlc_stream.h> 
    3537#include <vlc_charset.h> 
     
    140142} 
    141143 
     144static int vlclua_decode_uri( lua_State *p_state ) 
     145{ 
     146    int i = lua_gettop( p_state ); 
     147    if( !i ) return 0; 
     148    const char *psz_cstring = lua_tostring( p_state, 1 ); 
     149    if( !psz_cstring ) return 0; 
     150    char *psz_string = strdup( psz_cstring ); 
     151    lua_pop( p_state, i ); 
     152    decode_URI( psz_string ); 
     153    lua_pushstring( p_state, psz_string ); 
     154    free( psz_string ); 
     155    return 1; 
     156} 
     157 
     158static int vlclua_resolve_xml_special_chars( lua_State *p_state ) 
     159{ 
     160    int i = lua_gettop( p_state ); 
     161    if( !i ) return 0; 
     162    const char *psz_cstring = lua_tostring( p_state, 1 ); 
     163    if( !psz_cstring ) return 0; 
     164    char *psz_string = strdup( psz_cstring ); 
     165    lua_pop( p_state, i ); 
     166    resolve_xml_special_chars( psz_string ); 
     167    lua_pushstring( p_state, psz_string ); 
     168    free( psz_string ); 
     169    return 1; 
     170} 
     171 
    142172static int vlclua_msg_dbg( lua_State *p_state ) 
    143173{ 
     
    188218    { "stream_readline", vlclua_stream_readline }, 
    189219    { "stream_delete", vlclua_stream_delete }, 
     220    { "decode_uri", vlclua_decode_uri }, 
     221    { "resolve_xml_special_chars", vlclua_resolve_xml_special_chars }, 
    190222    { "msg_dbg", vlclua_msg_dbg }, 
    191223    { "msg_warn", vlclua_msg_warn }, 
  • share/luameta/README.txt

    r1179afb rf95f8bd  
    4040 * vlc.stream_readline 
    4141 * vlc.stream_read 
     42 * vlc.decode_uri( <string> ): decode %xy characters in a string. 
     43 * vlc.resolve_xml_special_chars( <string> ): decode &abc; characters in a 
     44                          string. 
    4245 * vlc.msg_dbg( <string> ): print a debug message. 
    4346 * vlc.msg_warn( <string> ): print a warning message.