11 #include "MediaSource.h" 12 #include "utils/Digest.h" 22 #define LEGAL_WIN32_COMPAT 1 33 unsigned int flag = 0;
40 static void CleanString(
const std::string& strFileName,
41 std::string& strTitle,
42 std::string& strTitleAndYear,
44 bool bRemoveExtension =
false,
45 bool bCleanChars =
true);
46 static bool GetFilenameIdentifier(
const std::string& fileName,
47 std::string& identifierType,
48 std::string& identifier);
49 static bool GetFilenameIdentifier(
const std::string& fileName,
50 std::string& identifierType,
51 std::string& identifier,
53 static bool HasFilenameIdentifier(
const std::string& fileName);
54 static std::string GetTitleFromPath(
const CURL& url,
bool bIsFolder =
false);
55 static std::string GetTitleFromPath(
const std::string& strFileNameAndPath,
bool bIsFolder =
false);
61 static std::string GetDiscNumberFromPath(
const std::string& path);
67 static std::string RemoveTrailingDiscNumberSegmentFromPath(std::string path);
69 static void GetQualifiedFilename(
const std::string &strBasePath, std::string &strFilename);
70 static void RunShortcut(
const char* szPath);
71 static std::string GetHomePath(
72 const std::string& strTarget =
"KODI_HOME");
73 static bool ExcludeFileOrFolder(
const std::string& strFileOrFolder,
const std::vector<std::string>& regexps);
74 static void GetFileAndProtocol(
const std::string& strURL, std::string& strDir);
75 static int GetDVDIfoTitle(
const std::string& strPathFile);
77 static bool IsPicture(
const std::string& strFile);
79 static std::string GetSplashPath();
85 static std::string GetFileDigest(
const std::string& strPath, KODI::UTILITY::CDigest::Type type);
86 static bool GetDirectoryName(
const std::string& strFileName, std::string& strDescription);
87 static void GetDVDDriveIcon(
const std::string& strPath, std::string& strIcon);
88 static void RemoveTempFiles();
90 static void ClearSubtitles();
91 static void ScanForExternalSubtitles(
const std::string& strMovie, std::vector<std::string>& vecSubtitles );
98 static ExternalStreamInfo GetExternalStreamDetailsFromFilename(
const std::string& videoPath,
const std::string& associatedFile);
99 static bool FindVobSubPair(
const std::vector<std::string>& vecSubtitles,
const std::string& strIdxPath, std::string& strSubPath );
100 static bool IsVobSub(
const std::vector<std::string>& vecSubtitles,
const std::string& strSubPath);
101 static std::string GetVobSubSubFromIdx(
const std::string& vobSubIdx);
102 static std::string GetVobSubIdxFromSub(
const std::string& vobSub);
108 static void ScanForExternalAudio(
const std::string& videoPath, std::vector<std::string>& vecAudio);
109 static int64_t ToInt64(uint32_t high, uint32_t low);
110 static std::string GetNextFilename(
const std::string &fn_template,
int max);
111 static std::string GetNextPathname(
const std::string &path_template,
int max);
112 static void StatToStatI64(
struct _stati64 *result,
struct stat *stat);
113 static void StatToStat64(
struct __stat64 *result,
const struct stat *stat);
114 static void Stat64ToStatI64(
struct _stati64 *result,
struct __stat64 *stat);
115 static void StatI64ToStat64(
struct __stat64 *result,
struct _stati64 *stat);
116 static void Stat64ToStat(
struct stat *result,
struct __stat64 *stat);
117 #ifdef TARGET_WINDOWS 118 static void Stat64ToStat64i32(
struct _stat64i32 *result,
struct __stat64 *stat);
120 static bool CreateDirectoryEx(
const std::string& strPath);
122 #ifdef TARGET_WINDOWS 123 static std::string MakeLegalFileName(std::string strFile,
int LegalType = LEGAL_WIN32_COMPAT);
124 static std::string MakeLegalPath(std::string strPath,
int LegalType = LEGAL_WIN32_COMPAT);
126 static std::string MakeLegalFileName(std::string strFile,
int LegalType = LEGAL_NONE);
127 static std::string MakeLegalPath(std::string strPath,
int LegalType = LEGAL_NONE);
129 static std::string ValidatePath(
131 bool bFixDoubleSlashes =
139 static bool IsSupportedFontExtension(
const std::string& fileName);
156 static void SplitParams(
const std::string& paramString, std::vector<std::string>& parameters);
157 static int GetMatchingSource(
const std::string& strPath, VECSOURCES& VECSOURCES,
bool& bIsSourceName);
158 static std::string TranslateSpecialSource(
const std::string &strSpecial);
159 static void DeleteDirectoryCache(
const std::string &prefix =
"");
160 static void DeleteMusicDatabaseDirectoryCache();
161 static void DeleteVideoDatabaseDirectoryCache();
162 static std::string MusicPlaylistsLocation();
163 static std::string VideoPlaylistsLocation();
165 static void GetSkinThemes(std::vector<std::string>& vecTheme);
166 static void GetRecursiveListing(
const std::string& strPath,
CFileItemList& items,
const std::string& strMask,
unsigned int flags = 0 );
167 static void GetRecursiveDirsListing(
const std::string& strPath,
CFileItemList& items,
unsigned int flags = 0 );
168 static void ForceForwardSlashes(std::string& strPath);
170 static double AlbumRelevance(
const std::string& strAlbumTemp1,
const std::string& strAlbum1,
const std::string& strArtistTemp1,
const std::string& strArtist1);
171 static bool MakeShortenPath(std::string StrInput, std::string& StrOutput,
size_t iTextMaxLength);
178 static bool SupportsWriteFileOperations(
const std::string& strPath);
185 static bool SupportsReadFileOperations(
const std::string& strPath);
186 static std::string GetDefaultFolderThumb(
const std::string &folderThumb);
188 static void InitRandomSeed();
192 static int LookupRomanDigit(
char roman_digit);
195 static int TranslateRomanNumeral(
const char* roman_numeral);
197 #if defined(TARGET_POSIX) && !defined(TARGET_DARWIN_TVOS) 201 static bool Command(
const std::vector<std::string>& arrArgs,
bool waitExit =
false);
206 static bool RunCommandLine(
const std::string& cmdLine,
bool waitExit =
false);
208 static std::string ResolveExecutablePath();
209 static std::string GetFrameworksPath(
bool forPython =
false);
211 static bool CanBindPrivileged();
212 static bool ValidatePort(
int port);
217 static int GetRandomNumber();
219 static int64_t ConvertSecsToMilliSecs(
double secs) {
return static_cast<int64_t
>(secs * 1000); }
220 static double ConvertMilliSecsToSecs(int64_t offset) {
return offset / 1000.0; }
221 static int64_t ConvertMilliSecsToSecsInt(int64_t offset) {
return offset / 1000; }
222 static int64_t ConvertMilliSecsToSecsIntRounded(int64_t offset) {
return ConvertMilliSecsToSecsInt(offset + 499); }
226 static void CopyUserDataIfNeeded(
const std::string& strPath,
227 const std::string& file,
228 const std::string& destname =
"");
230 #if !defined(TARGET_WINDOWS) 232 static unsigned int s_randomSeed;
241 static void GetVideoBasePathAndFileName(
const std::string& videoPath,
242 std::string& basePath,
243 std::string& videoFileName);
251 static void GetItemsToScan(
const std::string& videoPath,
252 const std::string& item_exts,
253 const std::vector<std::string>& sub_dirs,
262 static void ScanPathsForAssociatedItems(
const std::string& videoName,
264 const std::vector<std::string>& item_exts,
265 std::vector<std::string>& associatedFiles);
273 static int ScanArchiveForAssociatedItems(
const std::string& strArchivePath,
274 const std::string& videoNameNoExt,
275 const std::vector<std::string>& item_exts,
276 std::vector<std::string>& associatedFiles);
Represents a list of files.
Definition: FileItem.h:702
Definition: PlatformDefs.h:120
Represents a file on a share.
Definition: FileItem.h:102