Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
1. General access functions

General access functions More...

Topics

 Callbacks GetDirectory()
 Callback functions on GetDirectory()
 

Functions

virtual int kodi::addon::CInstanceVFS::Stat (const kodi::addon::VFSUrl &url, kodi::vfs::FileStatus &buffer)
 Stat a file.
 
virtual bool kodi::addon::CInstanceVFS::Exists (const kodi::addon::VFSUrl &url)
 Check for file existence.
 
virtual void kodi::addon::CInstanceVFS::ClearOutIdle ()
 Clear out any idle connections.
 
virtual void kodi::addon::CInstanceVFS::DisconnectAll ()
 Disconnect all connections.
 
virtual bool kodi::addon::CInstanceVFS::Delete (const kodi::addon::VFSUrl &url)
 Delete a file.
 
virtual bool kodi::addon::CInstanceVFS::Rename (const kodi::addon::VFSUrl &url, const kodi::addon::VFSUrl &url2)
 Rename a file.
 
virtual bool kodi::addon::CInstanceVFS::DirectoryExists (const kodi::addon::VFSUrl &url)
 Check for directory existence.
 
virtual bool kodi::addon::CInstanceVFS::RemoveDirectory (const kodi::addon::VFSUrl &url)
 Remove a directory.
 
virtual bool kodi::addon::CInstanceVFS::CreateDirectory (const kodi::addon::VFSUrl &url)
 Create a directory.
 
virtual bool kodi::addon::CInstanceVFS::GetDirectory (const kodi::addon::VFSUrl &url, std::vector< kodi::vfs::CDirEntry > &entries, CVFSCallbacks callbacks)
 List a directory.
 
virtual bool kodi::addon::CInstanceVFS::ContainsFiles (const kodi::addon::VFSUrl &url, std::vector< kodi::vfs::CDirEntry > &entries, std::string &rootPath)
 Check if file should be presented as a directory (multiple streams)
 

Detailed Description

General access functions

This functions which are intended for getting folders, editing storage locations and file system queries.

Function Documentation

◆ ClearOutIdle()

virtual void kodi::addon::CInstanceVFS::ClearOutIdle ( )
inlinevirtual

Clear out any idle connections.

◆ ContainsFiles()

virtual bool kodi::addon::CInstanceVFS::ContainsFiles ( const kodi::addon::VFSUrl & url,
std::vector< kodi::vfs::CDirEntry > & entries,
std::string & rootPath )
inlinevirtual

Check if file should be presented as a directory (multiple streams)

Parameters
[in]urlThe URL of the file
[out]entriesThe entries in the directory, see kodi::vfs::CDirEntry about his content
[out]rootPathPath to root directory if multiple entries
Returns
Context for the directory listing

◆ CreateDirectory()

virtual bool kodi::addon::CInstanceVFS::CreateDirectory ( const kodi::addon::VFSUrl & url)
inlinevirtual

Create a directory.

Parameters
[in]urlThe URL of the file
Returns
True if creation was successful, false otherwise

◆ Delete()

virtual bool kodi::addon::CInstanceVFS::Delete ( const kodi::addon::VFSUrl & url)
inlinevirtual

Delete a file.

Parameters
[in]urlThe URL of the file
Returns
True if deletion was successful, false otherwise

◆ DirectoryExists()

virtual bool kodi::addon::CInstanceVFS::DirectoryExists ( const kodi::addon::VFSUrl & url)
inlinevirtual

Check for directory existence.

Parameters
[in]urlThe URL of the file
Returns
True if directory exists, false otherwise

◆ DisconnectAll()

virtual void kodi::addon::CInstanceVFS::DisconnectAll ( )
inlinevirtual

Disconnect all connections.

◆ Exists()

virtual bool kodi::addon::CInstanceVFS::Exists ( const kodi::addon::VFSUrl & url)
inlinevirtual

Check for file existence.

Parameters
[in]urlThe URL of the file
Returns
True if file exists, false otherwise

◆ GetDirectory()

virtual bool kodi::addon::CInstanceVFS::GetDirectory ( const kodi::addon::VFSUrl & url,
std::vector< kodi::vfs::CDirEntry > & entries,
CVFSCallbacks callbacks )
inlinevirtual

List a directory.

Parameters
[in]urlThe URL of the directory
[out]entriesThe entries in the directory, see kodi::vfs::CDirEntry about his content
[in]callbacksA callback structure
Returns
Context for the directory listing

Callbacks:

This functions becomes available during call of GetDirectory() from Kodi.

If GetDirectory() returns false becomes the parts from here used on next call of the function.

Example:

...
bool CMyVFS::GetDirectory(const kodi::addon::VFSUrl& url,
std::vector<kodi::vfs::CDirEntry>& items,
CVFSCallbacks callbacks)
{
std::string neededString;
callbacks.GetKeyboardInput("Test", neededString, true);
if (neededString.empty())
return false;
// Do the work
...
return true;
}
Definition addon-instance/vfs.h:790
Definition addon-instance/vfs.h:51
bool GetKeyboardInput(const std::string &heading, std::string &input, bool hiddenInput=false)
Require keyboard input.
Definition addon-instance/vfs.h:804

Available callback functions

Function: Description
CVFSCallbacks::GetKeyboardInput

Require keyboard input. Becomes called if GetDirectory() returns false and GetDirectory() becomes after entry called again.

Parameters
[in]headingThe heading of the keyboard dialog
[out]inputThe resulting string. Returns string after second call!
[in]hiddenInputTo show input only as "*" on dialog
Returns
True if input was received, false otherwise
CVFSCallbacks::SetErrorDialog Display an error dialog.
Parameters
[in]headingThe heading of the error dialog
[in]line1The first line of the error dialog
[in]line2[opt] The second line of the error dialog
[in]line3[opt] The third line of the error dialog
CVFSCallbacks::RequireAuthentication Prompt the user for authentication of a URL.
Parameters
[in]urlThe URL

◆ RemoveDirectory()

virtual bool kodi::addon::CInstanceVFS::RemoveDirectory ( const kodi::addon::VFSUrl & url)
inlinevirtual

Remove a directory.

Parameters
[in]urlThe URL of the directory
Returns
True if removal was successful, false otherwise

◆ Rename()

virtual bool kodi::addon::CInstanceVFS::Rename ( const kodi::addon::VFSUrl & url,
const kodi::addon::VFSUrl & url2 )
inlinevirtual

Rename a file.

Parameters
[in]urlThe URL of the source file
[in]url2The URL of the destination file
Returns
True if deletion was successful, false otherwise

◆ Stat()

virtual int kodi::addon::CInstanceVFS::Stat ( const kodi::addon::VFSUrl & url,
kodi::vfs::FileStatus & buffer )
inlinevirtual

Stat a file.

Parameters
[in]urlThe URL of the file
[in]bufferThe buffer to store results in
Returns
-1 on error, 0 otherwise

The following table contains values that can be set with class VFSUrl :

Name Type Get call
URL std::string GetURL
Domain name std::string GetDomain
Hostname std::string GetHostname
Filename std::string GetFilename
Network port unsigned int GetPort
Special options std::string GetOptions
Username std::string GetUsername
Password std::string GetPassword
Get URL with user and password hidden std::string GetRedacted
Sharename std::string GetSharename
Network protocol std::string GetProtocol