mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 08:51:10 +02:00
gui/luainstance.cpp: add function to start file/url play
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include <gui/widget/msgbox.h>
|
||||
#include <gui/widget/messagebox.h>
|
||||
#include <gui/filebrowser.h>
|
||||
#include <gui/movieplayer.h>
|
||||
#include <driver/pictureviewer/pictureviewer.h>
|
||||
#include <neutrino.h>
|
||||
|
||||
@@ -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));
|
||||
|
Reference in New Issue
Block a user