diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index bd1047d00..8eac49bef 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -408,6 +409,7 @@ const luaL_Reg CLuaInstance::methods[] = { "Blit", CLuaInstance::Blit }, { "GetLanguage", CLuaInstance::GetLanguage }, { "runScript", CLuaInstance::runScriptExt }, + { "PlayFile", CLuaInstance::PlayFile }, { NULL, NULL } }; @@ -565,6 +567,28 @@ int CLuaInstance::DisplayImage(lua_State *L) return 0; } +int CLuaInstance::PlayFile(lua_State *L) +{ + printf("CLuaInstance::%s %d\n", __func__, lua_gettop(L)); + int numargs = lua_gettop(L); + + if (numargs < 3) { + printf("CLuaInstance::%s: not enough arguments (%d, expected 3)\n", __func__, numargs); + return 0; + } + const char *title; + const char *fname; + + title = luaL_checkstring(L, 2); + fname = luaL_checkstring(L, 3); + printf("CLuaInstance::%s: title %s file %s\n", __func__, title, fname); + std::string st(title); + std::string sf(fname); + CMoviePlayerGui::getInstance().SetFile(st, sf); + CMoviePlayerGui::getInstance().exec(NULL, "http"); + return 0; +} + int CLuaInstance::GetSize(lua_State *L) { DBG("CLuaInstance::%s %d\n", __func__, lua_gettop(L)); diff --git a/src/gui/luainstance.h b/src/gui/luainstance.h index be9459c42..bda26c6aa 100644 --- a/src/gui/luainstance.h +++ b/src/gui/luainstance.h @@ -191,6 +191,7 @@ private: static int runScriptExt(lua_State *L); static int GetSize(lua_State *L); static int DisplayImage(lua_State *L); + static int PlayFile(lua_State *L); void MenuRegister(lua_State *L); static int MenuNew(lua_State *L);