|
Kodi Documentation 23.0
Kodi is an open source media player and entertainment hub.
|
#include <Util.h>
Public Types | |
| enum class | PreserveFileName : bool { REMOVE , KEEP } |
Static Public Member Functions | |
| static void | CleanString (const std::string &strFileName, std::string &strTitle, std::string &strTitleAndYear, std::string &strYear, bool bRemoveExtension=false, bool bCleanChars=true) |
| static std::string | GetTitleFromPath (const CURL &url, bool bIsFolder=false) |
| static std::string | GetTitleFromPath (const std::string &strFileNameAndPath, bool bIsFolder=false) |
| static std::string | GetPartNumberFromPath (std::string path) |
| Return the part number in case the last segment of given path ends with 'Disc', 'Disk' and the locale specific spelling, as well as 'CD', and 'DVD'. | |
| static std::string | RemoveTrailingPartNumberSegmentFromPath (std::string path, PreserveFileName preserveFileName) |
| Remove last segment of the given path if it matches with 'Disc', 'Disk' and the locale specific spelling, as well as 'CD', and 'DVD' along with any disc folders (ie. BDMV or VIDEO_TS). | |
| static void | GetQualifiedFilename (const std::string &strBasePath, std::string &strFilename) |
| static void | RunShortcut (const char *szPath) |
| static std::string | GetHomePath (const std::string &strTarget="KODI_HOME") |
| static bool | ExcludeFileOrFolder (const std::string &strFileOrFolder, const std::vector< std::string > ®exps, KODI::REGEXP::RegExpCache *cache) |
| static void | GetFileAndProtocol (const std::string &strURL, std::string &strDir) |
| static int | GetDVDIfoTitle (const std::string &strPathFile) |
| static bool | IsPicture (const std::string &strFile) |
| static std::string | GetSplashPath () |
| Get resolved filesystem location of splash image. | |
| static std::string | GetFileDigest (const std::string &strPath, KODI::UTILITY::CDigest::Type type) |
| retrieve MD5sum of a file | |
| static bool | GetDirectoryName (const std::string &strFileName, std::string &strDescription) |
| static void | GetDVDDriveIcon (const std::string &strPath, std::string &strIcon) |
| static void | RemoveTempFiles () |
| static void | ClearSubtitles () |
| static void | ScanForExternalSubtitles (const std::string &strMovie, std::vector< std::string > &vecSubtitles, const CVideoInfoTag *tag=nullptr, int listingFlags=0) |
| Retrieves paths of external subtitle files for a given video. | |
| static ExternalStreamInfo | GetExternalStreamDetailsFromFilename (const std::string &videoPath, const std::string &associatedFile, const CVideoInfoTag *tag=nullptr) |
| Retrieves stream info of external associated files, e.g., subtitles, for a given video. | |
| static bool | FindVobSubPair (const std::vector< std::string > &vecSubtitles, const std::string &strIdxPath, std::string &strSubPath) |
| in a vector of subtitles finds the corresponding .sub file for a given .idx file | |
| static bool | IsVobSub (const std::vector< std::string > &vecSubtitles, const std::string &strSubPath) |
| checks if in the vector of subtitles the given .sub file has a corresponding idx and hence is a vobsub file | |
| static std::string | GetVobSubSubFromIdx (const std::string &vobSubIdx) |
| find a plain or archived vobsub .sub file corresponding to an .idx file | |
| static std::string | GetVobSubIdxFromSub (const std::string &vobSub) |
| find a .idx file from a path of a plain or archived vobsub .sub file | |
| static void | ScanForExternalAudio (const std::string &videoPath, std::vector< std::string > &vecAudio, const CVideoInfoTag *tag=nullptr) |
| Retrieves paths of external audio files for a given video. | |
| static int64_t | ToInt64 (uint32_t high, uint32_t low) |
| static std::string | GetNextFilename (const std::string &fn_template, int max) |
| Finds next unused filename that matches padded int format identifier provided. | |
| static std::string | GetNextPathname (const std::string &path_template, int max) |
| static void | StatToStatI64 (struct _stati64 *result, struct stat *stat) |
| static void | StatToStat64 (struct __stat64 *result, const struct stat *stat) |
| static void | Stat64ToStatI64 (struct _stati64 *result, struct __stat64 *stat) |
| static void | StatI64ToStat64 (struct __stat64 *result, struct _stati64 *stat) |
| static void | Stat64ToStat (struct stat *result, struct __stat64 *stat) |
| static bool | CreateDirectoryEx (const std::string &strPath) |
| static std::string | MakeLegalFileName (std::string strFile, LegalPath LegalType=LegalPath::DEFAULT) |
| static std::string | MakeLegalPath (const std::string &strPath, LegalPath LegalType=LegalPath::DEFAULT) |
| static std::string | ValidatePath (std::string path, bool bFixDoubleSlashes=false) |
| return a validated path, with correct directory separators. | |
| static void | SplitParams (const std::string ¶mString, std::vector< std::string > ¶meters) |
| Split a comma separated parameter list into separate parameters. Takes care of the case where we may have a quoted string containing commas, or we may have a function (i.e. parentheses) with multiple parameters as a single parameter. | |
| static int | GetMatchingSource (const std::string &strPath, std::vector< CMediaSource > &sources, bool &bIsSourceName) |
| static std::string | TranslateSpecialSource (const std::string &strSpecial) |
| static void | DeleteDirectoryCache (const std::string &prefix="") |
| static void | DeleteMusicDatabaseDirectoryCache () |
| static void | DeleteVideoDatabaseDirectoryCache () |
| static std::string | MusicPlaylistsLocation () |
| static std::string | VideoPlaylistsLocation () |
| static std::string | PlaylistsPathOf (KODI::MEDIA::MediaSection section) |
The path listing the playlists of section: special://musicplaylists/ or special://videoplaylists/. Empty for a section without playlists of its own. | |
| static bool | IsInPlaylistsFolder (const std::string &path, KODI::MEDIA::MediaSection section) |
Whether path lies in the playlists folder of section, under its special:// path or the folders that path resolves to, wherever the user keeps playlists. | |
| static void | GetSkinThemes (std::vector< std::string > &vecTheme) |
| static void | GetRecursiveListing (const std::string &strPath, CFileItemList &items, const std::string &strMask, unsigned int flags=0) |
| static void | GetRecursiveDirsListing (const std::string &strPath, CFileItemList &items, unsigned int flags=0) |
| static void | ForceForwardSlashes (std::string &strPath) |
| static double | AlbumRelevance (const std::string &strAlbumTemp1, const std::string &strAlbum1, const std::string &strArtistTemp1, const std::string &strArtist1) |
| static bool | MakeShortenPath (std::string StrInput, std::string &StrOutput, size_t iTextMaxLength) |
| static bool | SupportsWriteFileOperations (const std::string &strPath) |
| Checks whether the supplied path supports Write file operations (e.g. Rename, Delete, ...) | |
| static bool | SupportsReadFileOperations (const std::string &strPath) |
| Checks whether the supplied path supports Read file operations (e.g. Copy, ...) | |
| static std::string | GetDefaultFolderThumb (const std::string &folderThumb) |
| static void | InitRandomSeed () |
| static int | LookupRomanDigit (char roman_digit) |
| static int | TranslateRomanNumeral (const char *roman_numeral) |
| static std::string | ResolveExecutablePath () |
| static std::string | GetFrameworksPath (bool forPython=false) |
| static bool | CanBindPrivileged () |
| static bool | ValidatePort (int port) |
| static int | GetRandomNumber () |
| Thread-safe random number generation. | |
| static int64_t | ConvertSecsToMilliSecs (double secs) |
| static double | ConvertMilliSecsToSecs (int64_t offset) |
| static int64_t | ConvertMilliSecsToSecsInt (int64_t offset) |
| static int64_t | ConvertMilliSecsToSecsIntRounded (int64_t offset) |
| static void | CopyUserDataIfNeeded (const std::string &strPath, const std::string &file, const std::string &destname="") |
| Copy files from the application bundle over to the user data directory in Application Support/Kodi. | |
| static std::string | GetHexString (const std::span< const uint8_t > &buf, int count) |
| Converts byte array in big endian format to hex string. | |
| static void | GetVideoBasePathAndFileName (const std::string &videoPath, std::string &basePath, std::string &videoFileName) |
| Retrieves the base path and the filename of a given video. | |
| static std::vector< std::string > | GetVersionFileNames (const std::string &videoPath, const CVideoInfoTag *tag=nullptr) |
| The names a version (playlist) of a bluray, or an episode, gives its own files beside its disc or file, as it does its art: index-S01E01, S01E01, index-00800 and 00800 for a folder rip (VIDEO_TS-S01E01 for a dvd), M3GAN-00800 for M3GAN.iso, Show-S01E01 for Show.iso or Show.mkv. An episode's come first. | |
| static bool | IsAnotherVersionsFile (const std::string &file, const std::string &videoName, const std::string &videoPath, const CVideoInfoTag *tag=nullptr) |
| Whether a file found for a version (playlist) of a bluray, or for an episode, is another version's or episode's, named as GetVersionFileNames() names it (M3GAN-00801, index-00801, 00801, index-S01E02, S01E02), or in an archive so named. | |
| static bool | IsDiscPlaylistExtra (const std::string &videoPath, const CVideoInfoTag *tag) |
| Whether a video is an extra the library stores as one of a disc's playlists, such as a featurette on the movie's own disc. The files beside a disc it shares, named after the disc, are another video's, so only those named for its playlist are its own. An extra that is a whole disc of its own plays one of its playlists too, but keeps the disc's. | |
| static bool | UseDynPathForAddOrUpdate (const CFileItem &item) |
| If a file has a stack://, bluray:// or archive (zip://, rar://, archive://) path, use the dynamic path for updates (settings, SaveFileStateJob) instead of the real path. | |
Static Protected Member Functions | |
| static void | GetItemsToScan (const std::string &videoPath, const std::string &item_exts, const std::vector< std::string > &sub_dirs, CFileItemList &items, int listingFlags=0) |
| Retrieves FileItems that could contain associated files of a given video. | |
| static void | ScanPathsForAssociatedItems (const std::string &videoName, CFileItemList &items, const std::vector< std::string > &item_exts, std::vector< std::string > &associatedFiles) |
| Searches for associated files of a given video. | |
| static int | DetermineArchiveAndScanForAssociatedItems (const std::string &path, const std::string &videoName, const std::vector< std::string > &item_exts, std::vector< std::string > &associatedFiles, int depth=0) |
| Determines if the given path is an archive and scans it for associated files of a given video. | |
| static int | ScanArchiveForAssociatedItems (const std::string &strArchivePath, const std::string &videoNameNoExt, const std::vector< std::string > &item_exts, std::vector< std::string > &associatedFiles, int depth) |
| Searches in an archive for associated files of a given video. | |
|
strong |
|
static |
|
static |
|
static |
|
static |
|
inlinestatic |
|
inlinestatic |
|
static |
Copy files from the application bundle over to the user data directory in Application Support/Kodi.
|
static |
|
static |
|
static |
|
static |
|
staticprotected |
Determines if the given path is an archive and scans it for associated files of a given video.
| path | The path of the file. | |
| videoName | The name of the video file. | |
| item_exts | A vector of extensions specifying the associated files. | |
| associatedFiles | A vector containing the full paths of all found associated files. | |
| [in] | depth | The current recursion depth. Callers do not need to set this. |
|
static |
|
static |
in a vector of subtitles finds the corresponding .sub file for a given .idx file
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Retrieves stream info of external associated files, e.g., subtitles, for a given video.
| [in] | videoPath | The full path of the video file. |
| [in] | associatedFile | A file that provides additional streams for the given video file. |
| [in] | tag | The video's info, if any, so an episode's own name is left out of the stream's |
|
static |
|
static |
retrieve MD5sum of a file
| strPath | - path to the file to MD5sum |
|
static |
Converts byte array in big endian format to hex string.
| buf | byte array |
| count | number of bytes to format (string padded with 0s) |
|
static |
|
staticprotected |
Retrieves FileItems that could contain associated files of a given video.
| [in] | videoPath | The full path of the video file. |
| [in] | item_exts | A | separated string of extensions specifying the associated files. |
| [in] | sub_dirs | A vector of sub directory names to look for. |
| [out] | items | A List of FileItems to scan for associated files. |
|
static |
|
static |
Finds next unused filename that matches padded int format identifier provided.
| [in] | fn_template | filename template consisting of a padded int format identifier (eg screenshot%03d) |
| [in] | max | maximum number to search for available name |
|
static |
|
static |
Return the part number in case the last segment of given path ends with 'Disc', 'Disk' and the locale specific spelling, as well as 'CD', and 'DVD'.
|
static |
|
static |
Thread-safe random number generation.
|
static |
|
static |
|
static |
|
static |
Get resolved filesystem location of splash image.
|
static |
|
static |
The names a version (playlist) of a bluray, or an episode, gives its own files beside its disc or file, as it does its art: index-S01E01, S01E01, index-00800 and 00800 for a folder rip (VIDEO_TS-S01E01 for a dvd), M3GAN-00800 for M3GAN.iso, Show-S01E01 for Show.iso or Show.mkv. An episode's come first.
| [in] | videoPath | The path of the video, a bluray:// playlist path for a version. |
| [in] | tag | The video's info, if any, for an episode's season and episode. |
|
static |
Retrieves the base path and the filename of a given video.
| [in] | videoPath | The full path of the video file. |
| [out] | basePath | The base path of the given video. |
| [out] | videoFileName | The file name of the given video. |
|
static |
find a .idx file from a path of a plain or archived vobsub .sub file
|
static |
find a plain or archived vobsub .sub file corresponding to an .idx file
|
static |
|
static |
Whether a file found for a version (playlist) of a bluray, or for an episode, is another version's or episode's, named as GetVersionFileNames() names it (M3GAN-00801, index-00801, 00801, index-S01E02, S01E02), or in an archive so named.
| [in] | file | The file found. |
| [in] | videoName | The name the video's files are found by, from GetVideoBasePathAndFileName(). |
| [in] | videoPath | The path of the video. |
| [in] | tag | The video's info, if any, for an episode's season and episode. |
|
static |
Whether a video is an extra the library stores as one of a disc's playlists, such as a featurette on the movie's own disc. The files beside a disc it shares, named after the disc, are another video's, so only those named for its playlist are its own. An extra that is a whole disc of its own plays one of its playlists too, but keeps the disc's.
| [in] | videoPath | The path the video plays, a bluray:// playlist path for a disc's. |
| [in] | tag | The video's info, if any, whose file id is the library's for the extra. |
|
static |
Whether path lies in the playlists folder of section, under its special:// path or the folders that path resolves to, wherever the user keeps playlists.
|
static |
|
static |
checks if in the vector of subtitles the given .sub file has a corresponding idx and hence is a vobsub file
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
The path listing the playlists of section: special://musicplaylists/ or special://videoplaylists/. Empty for a section without playlists of its own.
|
static |
|
static |
Remove last segment of the given path if it matches with 'Disc', 'Disk' and the locale specific spelling, as well as 'CD', and 'DVD' along with any disc folders (ie. BDMV or VIDEO_TS).
|
static |
|
static |
|
staticprotected |
Searches in an archive for associated files of a given video.
| [in] | strArchivePath | The full path of the archive. |
| [in] | videoNameNoExt | The filename of the video without extension for which associated files should be retrieved. |
| [in] | item_exts | A vector of extensions specifying the associated files. |
| [in] | depth | The current recursion depth. |
| [out] | associatedFiles | A vector containing the full paths of all found associated files. |
|
static |
Retrieves paths of external audio files for a given video.
| [in] | videoPath | The full path of the video file. |
| [in,out] | vecAudio | The full paths of all found external audio files are appended to it. What it already holds, such as the video itself, is kept. |
| [in] | tag | The video's info, if any, so an episode's own audio is found |
|
static |
Retrieves paths of external subtitle files for a given video.
| [in] | strMovie | The full path of the video file. |
| [out] | vecSubtitles | The full paths of the subtitle files found. |
| [in] | tag | The video's info, if any, so an episode's own subtitles are found |
| [in] | listingFlags | added to the flags the video's folder is listed with, eg. DIR_FLAG_READ_CACHE by a scan that has just listed it. The folders of subtitles in it, archives and the custom folder are listed as without them. |
|
staticprotected |
Searches for associated files of a given video.
| [in] | videoName | The name of the video file. |
| [in] | items | A List of FileItems to scan for associated files. |
| [in] | item_exts | A vector of extensions specifying the associated files. |
| [out] | associatedFiles | A vector containing the full paths of all found associated files. |
|
static |
Split a comma separated parameter list into separate parameters. Takes care of the case where we may have a quoted string containing commas, or we may have a function (i.e. parentheses) with multiple parameters as a single parameter.
eg:
foo, bar(param1, param2), foo
will return:
"foo", "bar(param1, param2)", and "foo".
| paramString | the string to break up |
| parameters | the returned parameters |
|
static |
Checks whether the supplied path supports Read file operations (e.g. Copy, ...)
| strPath | the path to be checked |
|
static |
Checks whether the supplied path supports Write file operations (e.g. Rename, Delete, ...)
| strPath | the path to be checked |
|
static |
|
static |
|
static |
If a file has a stack://, bluray:// or archive (zip://, rar://, archive://) path, use the dynamic path for updates (settings, SaveFileStateJob) instead of the real path.
| item | The file item to check. |
|
static |
return a validated path, with correct directory separators.
|
static |