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

#include <PluginDirectory.h>

Inheritance diagram for XFILE::CPluginDirectory:
XFILE::IDirectory CRunningScriptsHandler< CPluginDirectory > CScriptRunner

Public Member Functions

 CPluginDirectory ()
 
 ~CPluginDirectory (void) override
 
bool GetDirectory (const CURL &url, CFileItemList &items) override
 Get the items of the directory strPath.
 
bool Resolve (CFileItem &item) const override
 Resolves a given item to a playable item.
 
bool AllowAll () const override
 Whether to allow all files/folders to be listed.
 
bool Exists (const CURL &url) override
 Check for directory existence.
 
float GetProgress () const override
 Retrieve the progress of the current directory fetch (if possible).
 
void CancelDirectory () override
 Cancel the current directory fetch (if possible).
 
- Public Member Functions inherited from XFILE::IDirectory
 IDirectory ()
 
virtual ~IDirectory (void)
 
virtual bool Create (const CURL &url)
 Create the directory.
 
virtual bool Remove (const CURL &url)
 Removes the directory.
 
virtual bool RemoveRecursive (const CURL &url)
 Recursively removes the directory.
 
virtual bool IsAllowed (const CURL &url) const
 Whether this file should be listed.
 
virtual DIR_CACHE_TYPE GetCacheType (const CURL &url) const
 How this directory should be cached.
 
void SetMask (const std::string &strMask)
 Set a mask of extensions for the files in the directory.
 
void SetFlags (int flags)
 Set the flags for this directory handler.
 
bool ProcessRequirements ()
 Process additional requirements before the directory fetch is performed. Some directory fetches may require authentication, keyboard input etc. The IDirectory subclass should call GetKeyboardInput, SetErrorDialog or RequireAuthentication and then return false from the GetDirectory method. CDirectory will then prompt for input from the user, before re-calling the GetDirectory method.
 

Static Public Member Functions

static bool RunScriptWithParams (const std::string &strPath, bool resume)
 
static bool GetResolvedPluginResult (CFileItem &resultItem)
 Get a reproducible CFileItem by trying to recursively resolve the plugin paths up to a maximum allowed limit. If no plugin paths exist it will be ignored.
 
static bool GetPluginResult (const std::string &strPath, CFileItem &resultItem, bool resume)
 
static bool IsMediaLibraryScanningAllowed (const std::string &content, const std::string &strPath)
 Check whether a plugin supports media library scanning.
 
static bool CheckExists (const std::string &content, const std::string &strPath)
 Check whether a plugin url exists by calling the plugin and checking result. Applies only to plugins that support media library scanning.
 
static bool AddItem (int handle, const CFileItem *item, int totalItems)
 
static bool AddItems (int handle, const CFileItemList *items, int totalItems)
 
static void EndOfDirectory (int handle, bool success, bool replaceListing, bool cacheToDisc)
 
static void AddSortMethod (int handle, SORT_METHOD sortMethod, const std::string &labelMask, const std::string &label2Mask)
 
static std::string GetSetting (int handle, const std::string &key)
 
static void SetSetting (int handle, const std::string &key, const std::string &value)
 
static void SetContent (int handle, const std::string &strContent)
 
static void SetProperty (int handle, const std::string &strProperty, const std::string &strValue)
 
static void SetResolvedUrl (int handle, bool success, const CFileItem *resultItem)
 
static void SetLabel2 (int handle, const std::string &ident)
 
- Static Public Member Functions inherited from XFILE::IDirectory
static void RegisterProfileManager (const CProfileManager &profileManager)
 
static void UnregisterProfileManager ()
 

Protected Member Functions

bool IsSuccessful () const override
 
bool IsCancelled () const override
 
- Protected Member Functions inherited from XFILE::IDirectory
bool GetKeyboardInput (const CVariant &heading, std::string &input, bool hiddenInput=false)
 Prompt the user for some keyboard input Call this method from the GetDirectory method to retrieve additional input from the user. If this function returns false then no input has been received, and the GetDirectory call should return false.
 
void SetErrorDialog (const CVariant &heading, const CVariant &line1, const CVariant &line2=0, const CVariant &line3=0)
 Show an error dialog on failure of GetDirectory call Call this method from the GetDirectory method to set an error message to be shown to the user.
 
void RequireAuthentication (const CURL &url)
 Prompt the user for authentication of a URL. Call this method from the GetDirectory method when authentication is required from the user, before returning false from the GetDirectory call. The user will be prompted for authentication, and GetDirectory will be re-called.
 
- Protected Member Functions inherited from CRunningScriptsHandler< CPluginDirectory >
 CRunningScriptsHandler ()=default
 
virtual ~CRunningScriptsHandler ()=default
 
bool RunScript (CPluginDirectory *script, const ADDON::AddonPtr &addon, const std::string &path, bool resume)
 
ADDON::AddonPtr GetAddon () const
 
void SetDone ()
 
bool StartScript (const ADDON::AddonPtr &addon, const std::string &path)
 
- Protected Member Functions inherited from CScriptRunner
 CScriptRunner ()
 
virtual ~CScriptRunner ()=default
 
ADDON::AddonPtr GetAddon () const
 
bool StartScript (const ADDON::AddonPtr &addon, const std::string &path)
 
bool RunScript (const ADDON::AddonPtr &addon, const std::string &path, int handle, bool resume)
 
void SetDone ()
 

Additional Inherited Members

- Protected Types inherited from CRunningScriptsHandler< CPluginDirectory >
using HandleType
 
- Static Protected Member Functions inherited from CRunningScriptsHandler< CPluginDirectory >
static HandleType GetNewScriptHandle (CPluginDirectory *script)
 
static void ReuseScriptHandle (HandleType handle, CPluginDirectory *script)
 
static void RemoveScriptHandle (HandleType handle)
 
static CPluginDirectory * GetScriptFromHandle (HandleType handle)
 
static CCriticalSection & GetScriptsLock ()
 
static int ExecuteScript (const ADDON::AddonPtr &addon, const std::string &path, bool resume)
 
static int ExecuteScript (const ADDON::AddonPtr &addon, const std::string &path, int handle, bool resume)
 
- Static Protected Member Functions inherited from CScriptRunner
static int ExecuteScript (const ADDON::AddonPtr &addon, const std::string &path, bool resume)
 
static int ExecuteScript (const ADDON::AddonPtr &addon, const std::string &path, int handle, bool resume)
 
- Protected Attributes inherited from XFILE::IDirectory
std::string m_strFileMask
 Holds the file mask specified by SetMask()
 
int m_flags
 Directory flags - see DIR_FLAG.
 
CVariant m_requirements
 
- Static Protected Attributes inherited from XFILE::IDirectory
static const CProfileManagerm_profileManager = nullptr
 

Constructor & Destructor Documentation

◆ CPluginDirectory()

CPluginDirectory::CPluginDirectory ( )

◆ ~CPluginDirectory()

CPluginDirectory::~CPluginDirectory ( void )
override

Member Function Documentation

◆ AddItem()

bool CPluginDirectory::AddItem ( int handle,
const CFileItem * item,
int totalItems )
static

◆ AddItems()

bool CPluginDirectory::AddItems ( int handle,
const CFileItemList * items,
int totalItems )
static

◆ AddSortMethod()

void CPluginDirectory::AddSortMethod ( int handle,
SORT_METHOD sortMethod,
const std::string & labelMask,
const std::string & label2Mask )
static
Todo
Add all sort methods and fix which labels go on the right or left

◆ AllowAll()

bool XFILE::CPluginDirectory::AllowAll ( ) const
inlineoverridevirtual

Whether to allow all files/folders to be listed.

Returns
Returns true if all files/folder should be listed.

Reimplemented from XFILE::IDirectory.

◆ CancelDirectory()

void CPluginDirectory::CancelDirectory ( )
overridevirtual

Cancel the current directory fetch (if possible).

See also
GetDirectory

Reimplemented from XFILE::IDirectory.

◆ CheckExists()

bool CPluginDirectory::CheckExists ( const std::string & content,
const std::string & strPath )
static

Check whether a plugin url exists by calling the plugin and checking result. Applies only to plugins that support media library scanning.

Parameters
contentcontent type - movies, tvshows, musicvideos.
strPathfull plugin url.
Returns
true if the plugin supports scanning and specified url exists, false otherwise.

◆ EndOfDirectory()

void CPluginDirectory::EndOfDirectory ( int handle,
bool success,
bool replaceListing,
bool cacheToDisc )
static

◆ Exists()

bool XFILE::CPluginDirectory::Exists ( const CURL & url)
inlineoverridevirtual

Check for directory existence.

Parameters
urlDirectory to check.
Returns
Returns true, if directory exists
See also
CDirectoryFactory

Reimplemented from XFILE::IDirectory.

◆ GetDirectory()

bool CPluginDirectory::GetDirectory ( const CURL & url,
CFileItemList & items )
overridevirtual

Get the items of the directory strPath.

Parameters
urlDirectory to read.
itemsRetrieves the directory entries.
Returns
Returns true, if successful.
See also
CDirectoryFactory

Implements XFILE::IDirectory.

◆ GetPluginResult()

bool CPluginDirectory::GetPluginResult ( const std::string & strPath,
CFileItem & resultItem,
bool resume )
static

◆ GetProgress()

float CPluginDirectory::GetProgress ( ) const
overridevirtual

Retrieve the progress of the current directory fetch (if possible).

Returns
the progress as a float in the range 0..100.
See also
GetDirectory, CancelDirectory

Reimplemented from XFILE::IDirectory.

◆ GetResolvedPluginResult()

bool CPluginDirectory::GetResolvedPluginResult ( CFileItem & resultItem)
static

Get a reproducible CFileItem by trying to recursively resolve the plugin paths up to a maximum allowed limit. If no plugin paths exist it will be ignored.

Parameters
resultItemthe CFileItem with plugin paths to be resolved.
Returns
false if the plugin path cannot be resolved, true otherwise.

◆ GetSetting()

std::string CPluginDirectory::GetSetting ( int handle,
const std::string & key )
static

◆ IsCancelled()

bool XFILE::CPluginDirectory::IsCancelled ( ) const
inlineoverrideprotectedvirtual

Implements CScriptRunner.

◆ IsMediaLibraryScanningAllowed()

bool CPluginDirectory::IsMediaLibraryScanningAllowed ( const std::string & content,
const std::string & strPath )
static

Check whether a plugin supports media library scanning.

Parameters
contentcontent type - movies, tvshows, musicvideos.
strPathfull plugin url.
Returns
true if scanning at specified url is allowed, false otherwise.

◆ IsSuccessful()

bool XFILE::CPluginDirectory::IsSuccessful ( ) const
inlineoverrideprotectedvirtual

Implements CScriptRunner.

◆ Resolve()

bool CPluginDirectory::Resolve ( CFileItem & item) const
overridevirtual

Resolves a given item to a playable item.

Note
Some directories (e.g. dvd, bluray, plugins etc) need to be translated/resolved to the actual playback url
Parameters
itemThe item being manipulated (which the path points to a vfs protocol implementation)
Returns
true if the item was resolved, false if it failed to resolve

Reimplemented from XFILE::IDirectory.

◆ RunScriptWithParams()

bool CPluginDirectory::RunScriptWithParams ( const std::string & strPath,
bool resume )
static

◆ SetContent()

void CPluginDirectory::SetContent ( int handle,
const std::string & strContent )
static

◆ SetLabel2()

static void XFILE::CPluginDirectory::SetLabel2 ( int handle,
const std::string & ident )
static

◆ SetProperty()

void CPluginDirectory::SetProperty ( int handle,
const std::string & strProperty,
const std::string & strValue )
static

◆ SetResolvedUrl()

void CPluginDirectory::SetResolvedUrl ( int handle,
bool success,
const CFileItem * resultItem )
static

◆ SetSetting()

void CPluginDirectory::SetSetting ( int handle,
const std::string & key,
const std::string & value )
static

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