mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-27 23:42:51 +02:00
plugins: add configparam 'shellwindow'
Origin commit data
------------------
Branch: ni/coolstream
Commit: b46ad0c5ae
Author: vanhofen <vanhofen@gmx.de>
Date: 2014-09-17 (Wed, 17 Sep 2014)
Origin message was:
------------------
- plugins: add configparam 'shellwindow'
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -205,6 +205,7 @@ bool CPlugins::parseCfg(plugin *plugin_data)
|
|||||||
plugin_data->vtxtpid = false;
|
plugin_data->vtxtpid = false;
|
||||||
plugin_data->showpig = false;
|
plugin_data->showpig = false;
|
||||||
plugin_data->needoffset = false;
|
plugin_data->needoffset = false;
|
||||||
|
plugin_data->shellwindow = false;
|
||||||
plugin_data->hide = false;
|
plugin_data->hide = false;
|
||||||
plugin_data->type = CPlugins::P_TYPE_DISABLED;
|
plugin_data->type = CPlugins::P_TYPE_DISABLED;
|
||||||
|
|
||||||
@@ -265,6 +266,10 @@ bool CPlugins::parseCfg(plugin *plugin_data)
|
|||||||
{
|
{
|
||||||
plugin_data->needoffset = atoi(parm);
|
plugin_data->needoffset = atoi(parm);
|
||||||
}
|
}
|
||||||
|
else if (cmd == "shellwindow")
|
||||||
|
{
|
||||||
|
plugin_data->shellwindow = atoi(parm);
|
||||||
|
}
|
||||||
else if (cmd == "hide")
|
else if (cmd == "hide")
|
||||||
{
|
{
|
||||||
plugin_data->hide = atoi(parm);
|
plugin_data->hide = atoi(parm);
|
||||||
@@ -331,6 +336,27 @@ void CPlugins::startPlugin(const char * const name)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPlugins::popenScriptPlugin(const char * script)
|
||||||
|
{
|
||||||
|
pid_t pid = 0;
|
||||||
|
FILE *f = my_popen(pid, script, "r");
|
||||||
|
if (f != NULL)
|
||||||
|
{
|
||||||
|
char *output=NULL;
|
||||||
|
size_t len = 0;
|
||||||
|
while ((getline(&output, &len, f)) != -1)
|
||||||
|
scriptOutput += output;
|
||||||
|
pclose(f);
|
||||||
|
int s;
|
||||||
|
while (waitpid(pid, &s, WNOHANG)>0);
|
||||||
|
kill(pid, SIGTERM);
|
||||||
|
if (output)
|
||||||
|
free(output);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf("[CPlugins] can't execute %s\n",script);
|
||||||
|
}
|
||||||
|
|
||||||
void CPlugins::startScriptPlugin(int number)
|
void CPlugins::startScriptPlugin(int number)
|
||||||
{
|
{
|
||||||
const char *script = plugin_list[number].pluginfile.c_str();
|
const char *script = plugin_list[number].pluginfile.c_str();
|
||||||
@@ -345,8 +371,13 @@ void CPlugins::startScriptPlugin(int number)
|
|||||||
// workaround for manually messed up permissions
|
// workaround for manually messed up permissions
|
||||||
if (access(script, X_OK))
|
if (access(script, X_OK))
|
||||||
chmod(script, 0755);
|
chmod(script, 0755);
|
||||||
CShellWindow(script, CShellWindow::VERBOSE | CShellWindow::ACKNOWLEDGE);
|
if (plugin_list[number].shellwindow)
|
||||||
scriptOutput = "";
|
{
|
||||||
|
CShellWindow(script, CShellWindow::VERBOSE | CShellWindow::ACKNOWLEDGE);
|
||||||
|
scriptOutput = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
popenScriptPlugin(script);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlugins::startLuaPlugin(int number)
|
void CPlugins::startLuaPlugin(int number)
|
||||||
|
@@ -81,6 +81,7 @@ class CPlugins
|
|||||||
int posx, posy, sizex, sizey;
|
int posx, posy, sizex, sizey;
|
||||||
bool showpig;
|
bool showpig;
|
||||||
bool needoffset;
|
bool needoffset;
|
||||||
|
bool shellwindow;
|
||||||
bool hide;
|
bool hide;
|
||||||
bool operator< (const plugin& a) const
|
bool operator< (const plugin& a) const
|
||||||
{
|
{
|
||||||
@@ -129,6 +130,7 @@ class CPlugins
|
|||||||
void startPlugin(const char * const filename); // start plugins by filename
|
void startPlugin(const char * const filename); // start plugins by filename
|
||||||
void startPlugin_by_name(const std::string & name); // start plugins by "name=" in .cfg
|
void startPlugin_by_name(const std::string & name); // start plugins by "name=" in .cfg
|
||||||
void startScriptPlugin(int number);
|
void startScriptPlugin(int number);
|
||||||
|
void popenScriptPlugin(const char * script);
|
||||||
void startLuaPlugin(int number);
|
void startLuaPlugin(int number);
|
||||||
bool hasPlugin(CPlugins::p_type_t type);
|
bool hasPlugin(CPlugins::p_type_t type);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user