]> git.sesse.net Git - vlc/blobdiff - modules/lua/libs/input.c
input: Add support for AlbumArtist meta
[vlc] / modules / lua / libs / input.c
index 3e347bfbeea226b85239940b84351ea0167a93de..e75424205b6bcd2ba7a0d7db37c331782c33d1b6 100644 (file)
 
 #include "../vlc.h"
 #include "input.h"
-#include "playlist.h"
 #include "../libs.h"
 #include "../extension.h"
 
-static const luaL_Reg vlclua_input_reg[];
-static const luaL_Reg vlclua_input_item_reg[];
-
 static input_item_t* vlclua_input_item_get_internal( lua_State *L );
 
 input_thread_t * vlclua_get_input_internal( lua_State *L )
@@ -153,6 +149,11 @@ static int vlclua_input_metas_internal( lua_State *L, input_item_t *p_item )
         PUSH_META( ArtworkURL, "artwork_url" );
         PUSH_META( TrackID, "track_id" );
         PUSH_META( TrackTotal, "track_total" );
+        PUSH_META( Director, "director" );
+        PUSH_META( Season, "season" );
+        PUSH_META( Episode, "episode" );
+        PUSH_META( ShowName, "show_name" );
+        PUSH_META( Actors, "actors" );
 
 #undef PUSH_META
 
@@ -214,9 +215,9 @@ static int vlclua_input_add_subtitle( lua_State *L )
     if( !p_input )
         return luaL_error( L, "can't add subtitle: no current input" );
     if( !lua_isstring( L, 1 ) )
-        return luaL_error( L, "vlc.input.add_subtitle() usage: (url)" );
-    const char *psz_url = luaL_checkstring( L, 1 );
-    input_AddSubtitle( p_input, psz_url, false );
+        return luaL_error( L, "vlc.input.add_subtitle() usage: (path)" );
+    const char *psz_path = luaL_checkstring( L, 1 );
+    input_AddSubtitle( p_input, psz_path, false );
     vlc_object_release( p_input );
     return 1;
 }
@@ -251,25 +252,7 @@ static int vlclua_input_item_delete( lua_State *L )
     return 1;
 }
 
-static int vlclua_input_item_get( lua_State *L, input_item_t *p_item )
-{
-    vlc_gc_incref( p_item );
-    input_item_t **pp = lua_newuserdata( L, sizeof( input_item_t* ) );
-    *pp = p_item;
-
-    if( luaL_newmetatable( L, "input_item" ) )
-    {
-        lua_newtable( L );
-        luaL_register( L, NULL, vlclua_input_item_reg );
-        lua_setfield( L, -2, "__index" );
-        lua_pushcfunction( L, vlclua_input_item_delete );
-        lua_setfield( L, -2, "__gc" );
-    }
-
-    lua_setmetatable(L, -2);
-
-    return 1;
-}
+static int vlclua_input_item_get( lua_State *L, input_item_t *p_item );
 
 static int vlclua_input_item_get_current( lua_State *L )
 {
@@ -350,6 +333,12 @@ static int vlclua_input_item_set_meta( lua_State *L )
         META_TYPE( ArtworkURL, "artwork_url" )
         META_TYPE( TrackID, "track_id" )
         META_TYPE( TrackTotal, "track_total" )
+        META_TYPE( Director, "director" )
+        META_TYPE( Season, "season" )
+        META_TYPE( Episode, "episode" )
+        META_TYPE( ShowName, "show_name" )
+        META_TYPE( Actors, "actors" )
+        META_TYPE( AlbumArtist, "album_artist" )
     };
 #undef META_TYPE
 
@@ -400,6 +389,26 @@ static const luaL_Reg vlclua_input_item_reg[] = {
     { NULL, NULL }
 };
 
+static int vlclua_input_item_get( lua_State *L, input_item_t *p_item )
+{
+    vlc_gc_incref( p_item );
+    input_item_t **pp = lua_newuserdata( L, sizeof( input_item_t* ) );
+    *pp = p_item;
+
+    if( luaL_newmetatable( L, "input_item" ) )
+    {
+        lua_newtable( L );
+        luaL_register( L, NULL, vlclua_input_item_reg );
+        lua_setfield( L, -2, "__index" );
+        lua_pushcfunction( L, vlclua_input_item_delete );
+        lua_setfield( L, -2, "__gc" );
+    }
+
+    lua_setmetatable(L, -2);
+
+    return 1;
+}
+
 
 void luaopen_input_item( lua_State *L, input_item_t *item )
 {