![]() |
Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
#include <ScriptInvocationManager.h>
Public Member Functions | |
void | Process () |
void | Uninitialize () |
void | RegisterLanguageInvocationHandler (ILanguageInvocationHandler *invocationHandler, const std::string &extension) |
void | RegisterLanguageInvocationHandler (ILanguageInvocationHandler *invocationHandler, const std::set< std::string > &extensions) |
void | UnregisterLanguageInvocationHandler (ILanguageInvocationHandler *invocationHandler) |
bool | HasLanguageInvoker (const std::string &script) const |
std::shared_ptr< ILanguageInvoker > | GetLanguageInvoker (const std::string &script) |
int | GetReusablePluginHandle (const std::string &script) |
Returns addon_handle if last reusable invoker is ready to use. | |
int | ExecuteAsync (const std::string &script, const ADDON::AddonPtr &addon=ADDON::AddonPtr(), const std::vector< std::string > &arguments=std::vector< std::string >(), bool reuseable=false, int pluginHandle=-1) |
Executes the given script asynchronously in a separate thread. | |
int | ExecuteAsync (const std::string &script, const std::shared_ptr< ILanguageInvoker > &languageInvoker, const ADDON::AddonPtr &addon=ADDON::AddonPtr(), const std::vector< std::string > &arguments=std::vector< std::string >(), bool reuseable=false, int pluginHandle=-1) |
Executes the given script asynchronously in a separate thread. | |
int | ExecuteSync (const std::string &script, const ADDON::AddonPtr &addon=ADDON::AddonPtr(), const std::vector< std::string > &arguments=std::vector< std::string >(), uint32_t timeoutMs=0, bool waitShutdown=false) |
Executes the given script synchronously. | |
int | ExecuteSync (const std::string &script, const std::shared_ptr< ILanguageInvoker > &languageInvoker, const ADDON::AddonPtr &addon=ADDON::AddonPtr(), const std::vector< std::string > &arguments=std::vector< std::string >(), uint32_t timeoutMs=0, bool waitShutdown=false) |
Executes the given script synchronously. | |
bool | Stop (int scriptId, bool wait=false) |
bool | Stop (const std::string &scriptPath, bool wait=false) |
void | StopRunningScripts (bool wait=false) |
Stop all running scripts. | |
bool | IsRunning (int scriptId) const |
bool | IsRunning (const std::string &scriptPath) const |
Static Public Member Functions | |
static CScriptInvocationManager & | GetInstance () |
Protected Member Functions | |
void | OnExecutionDone (int scriptId) |
Friends | |
class | CLanguageInvokerThread |
int CScriptInvocationManager::ExecuteAsync | ( | const std::string & | script, |
const ADDON::AddonPtr & | addon = ADDON::AddonPtr() , |
||
const std::vector< std::string > & | arguments = std::vector<std::string>() , |
||
bool | reuseable = false , |
||
int | pluginHandle = -1 |
||
) |
Executes the given script asynchronously in a separate thread.
script | Path to the script to be executed |
addon | (Optional) Addon to which the script belongs |
arguments | (Optional) List of arguments passed to the script |
int CScriptInvocationManager::ExecuteAsync | ( | const std::string & | script, |
const std::shared_ptr< ILanguageInvoker > & | languageInvoker, | ||
const ADDON::AddonPtr & | addon = ADDON::AddonPtr() , |
||
const std::vector< std::string > & | arguments = std::vector<std::string>() , |
||
bool | reuseable = false , |
||
int | pluginHandle = -1 |
||
) |
Executes the given script asynchronously in a separate thread.
script | Path to the script to be executed |
languageInvoker | Language invoker to be used to execute the script |
addon | (Optional) Addon to which the script belongs |
arguments | (Optional) List of arguments passed to the script |
int CScriptInvocationManager::ExecuteSync | ( | const std::string & | script, |
const ADDON::AddonPtr & | addon = ADDON::AddonPtr() , |
||
const std::vector< std::string > & | arguments = std::vector<std::string>() , |
||
uint32_t | timeoutMs = 0 , |
||
bool | waitShutdown = false |
||
) |
Executes the given script synchronously.
The script is actually executed asynchronously but the calling thread is blocked until either the script has finished or the given timeout has expired. If the given timeout has expired the script's execution is stopped and depending on the specified wait behaviour we wait for the script's execution to finish or not.
script | Path to the script to be executed |
addon | (Optional) Addon to which the script belongs |
arguments | (Optional) List of arguments passed to the script |
timeout | (Optional) Timeout (in milliseconds) for the script's execution |
waitShutdown | (Optional) Whether to wait when having to forcefully stop the script's execution or not. |
int CScriptInvocationManager::ExecuteSync | ( | const std::string & | script, |
const std::shared_ptr< ILanguageInvoker > & | languageInvoker, | ||
const ADDON::AddonPtr & | addon = ADDON::AddonPtr() , |
||
const std::vector< std::string > & | arguments = std::vector<std::string>() , |
||
uint32_t | timeoutMs = 0 , |
||
bool | waitShutdown = false |
||
) |
Executes the given script synchronously.
The script is actually executed asynchronously but the calling thread is blocked until either the script has finished or the given timeout has expired. If the given timeout has expired the script's execution is stopped and depending on the specified wait behaviour we wait for the script's execution to finish or not.
script | Path to the script to be executed |
languageInvoker | Language invoker to be used to execute the script |
addon | (Optional) Addon to which the script belongs |
arguments | (Optional) List of arguments passed to the script |
timeout | (Optional) Timeout (in milliseconds) for the script's execution |
waitShutdown | (Optional) Whether to wait when having to forcefully stop the script's execution or not. |
|
static |
std::shared_ptr< ILanguageInvoker > CScriptInvocationManager::GetLanguageInvoker | ( | const std::string & | script | ) |
int CScriptInvocationManager::GetReusablePluginHandle | ( | const std::string & | script | ) |
Returns addon_handle if last reusable invoker is ready to use.
bool CScriptInvocationManager::HasLanguageInvoker | ( | const std::string & | script | ) | const |
bool CScriptInvocationManager::IsRunning | ( | const std::string & | scriptPath | ) | const |
void CScriptInvocationManager::Process | ( | ) |
void CScriptInvocationManager::RegisterLanguageInvocationHandler | ( | ILanguageInvocationHandler * | invocationHandler, |
const std::set< std::string > & | extensions | ||
) |
void CScriptInvocationManager::RegisterLanguageInvocationHandler | ( | ILanguageInvocationHandler * | invocationHandler, |
const std::string & | extension | ||
) |
Stop all running scripts.
wait | if kodi should wait for each script to finish (default false) |
void CScriptInvocationManager::Uninitialize | ( | ) |
void CScriptInvocationManager::UnregisterLanguageInvocationHandler | ( | ILanguageInvocationHandler * | invocationHandler | ) |
|
friend |