Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
1. General access functions

Detailed Description

General access functions

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

Topics

 Callbacks GetDirectory()
 Callback functions on GetDirectory()
 

Function Documentation

◆ Stat()

virtual int 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

◆ Exists()

virtual bool 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

◆ ClearOutIdle()

virtual void ClearOutIdle ( )
inlinevirtual

Clear out any idle connections.

◆ DisconnectAll()

virtual void DisconnectAll ( )
inlinevirtual

Disconnect all connections.

◆ Delete()

virtual bool 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

◆ Rename()

virtual bool 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

◆ DirectoryExists()

virtual bool 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

◆ RemoveDirectory()

virtual bool 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

◆ CreateDirectory()

virtual bool 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

◆ GetDirectory()

virtual bool 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:

#include <kodi/addon-instance/VFS.h>
...
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 VFS.h:51
bool GetKeyboardInput(const std::string &heading, std::string &input, bool hiddenInput=false)
Require keyboard input.
Definition 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

◆ ContainsFiles()

virtual bool 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