Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CScriptInvocationManager Class Reference

#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
 
LanguageInvokerPtr 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 LanguageInvokerPtr &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 LanguageInvokerPtr &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 CScriptInvocationManagerGetInstance ()
 

Protected Member Functions

void OnExecutionDone (int scriptId)
 

Friends

class CLanguageInvokerThread
 

Member Function Documentation

◆ ExecuteAsync() [1/2]

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.

Parameters
scriptPath to the script to be executed
addon(Optional) Addon to which the script belongs
arguments(Optional) List of arguments passed to the script
Returns
-1 if an error occurred, otherwise the ID of the script

◆ ExecuteAsync() [2/2]

int CScriptInvocationManager::ExecuteAsync ( const std::string & script,
const LanguageInvokerPtr & 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.

Parameters
scriptPath to the script to be executed
languageInvokerLanguage 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
Returns
-1 if an error occurred, otherwise the ID of the script

◆ ExecuteSync() [1/2]

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.

Parameters
scriptPath 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.
Returns
-1 if an error occurred, 0 if the script terminated or ETIMEDOUT if the given timeout expired

◆ ExecuteSync() [2/2]

int CScriptInvocationManager::ExecuteSync ( const std::string & script,
const LanguageInvokerPtr & 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.

Parameters
scriptPath to the script to be executed
languageInvokerLanguage 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.
Returns
-1 if an error occurred, 0 if the script terminated or ETIMEDOUT if the given timeout expired

◆ GetInstance()

CScriptInvocationManager & CScriptInvocationManager::GetInstance ( )
static

◆ GetLanguageInvoker()

LanguageInvokerPtr CScriptInvocationManager::GetLanguageInvoker ( const std::string & script)

◆ GetReusablePluginHandle()

int CScriptInvocationManager::GetReusablePluginHandle ( const std::string & script)

Returns addon_handle if last reusable invoker is ready to use.

◆ HasLanguageInvoker()

bool CScriptInvocationManager::HasLanguageInvoker ( const std::string & script) const

◆ IsRunning() [1/2]

bool CScriptInvocationManager::IsRunning ( const std::string & scriptPath) const

◆ IsRunning() [2/2]

bool CScriptInvocationManager::IsRunning ( int scriptId) const

◆ OnExecutionDone()

void CScriptInvocationManager::OnExecutionDone ( int scriptId)
protected

◆ Process()

void CScriptInvocationManager::Process ( )

◆ RegisterLanguageInvocationHandler() [1/2]

void CScriptInvocationManager::RegisterLanguageInvocationHandler ( ILanguageInvocationHandler * invocationHandler,
const std::set< std::string > & extensions )

◆ RegisterLanguageInvocationHandler() [2/2]

void CScriptInvocationManager::RegisterLanguageInvocationHandler ( ILanguageInvocationHandler * invocationHandler,
const std::string & extension )

◆ Stop() [1/2]

bool CScriptInvocationManager::Stop ( const std::string & scriptPath,
bool wait = false )

◆ Stop() [2/2]

bool CScriptInvocationManager::Stop ( int scriptId,
bool wait = false )

◆ StopRunningScripts()

void CScriptInvocationManager::StopRunningScripts ( bool wait = false)

Stop all running scripts.

Parameters
waitif kodi should wait for each script to finish (default false)

◆ Uninitialize()

void CScriptInvocationManager::Uninitialize ( )

◆ UnregisterLanguageInvocationHandler()

void CScriptInvocationManager::UnregisterLanguageInvocationHandler ( ILanguageInvocationHandler * invocationHandler)

Friends And Related Symbol Documentation

◆ CLanguageInvokerThread

friend class CLanguageInvokerThread
friend

The documentation for this class was generated from the following files: