Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 194 lines (165 sloc) 8.536 kb
45285e8 step 3/4: Move linuxport to trunk. How'd I get roped into this?
AlTheKiller authored
1 #pragma once
2 /*
3 * Copyright (C) 2005-2008 Team XBMC
4 * http://www.xbmc.org
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with XBMC; see the file COPYING. If not, write to
18 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19 * http://www.gnu.org/copyleft/gpl.html
20 *
21 */
22
23 #include <climits>
24 #include <cmath>
25 #include <vector>
26 #include <string.h>
adab057 cleanup: Indicate why system.h is included in a header, and remove where...
jmarshallnz authored
27 #include <stdint.h>
45285e8 step 3/4: Move linuxport to trunk. How'd I get roped into this?
AlTheKiller authored
28
29 #include "MediaSource.h"
30
31 // A list of filesystem types for LegalPath/FileName
32 #define LEGAL_NONE 0
33 #define LEGAL_WIN32_COMPAT 1
34 #define LEGAL_FATX 2
35
36 namespace XFILE
37 {
38 class IFileCallback;
39 }
40
41 class CFileItem;
42 class CFileItemList;
bcbff58 changed: have CUtil::IsInternetStream() take CURL since that is the firs...
elupus authored
43 class CURL;
45285e8 step 3/4: Move linuxport to trunk. How'd I get roped into this?
AlTheKiller authored
44
45 struct sortstringbyname
46 {
47 bool operator()(const CStdString& strItem1, const CStdString& strItem2)
48 {
49 CStdString strLine1 = strItem1;
50 CStdString strLine2 = strItem2;
51 strLine1 = strLine1.ToLower();
52 strLine2 = strLine2.ToLower();
53 return strcmp(strLine1.c_str(), strLine2.c_str()) < 0;
54 }
55 };
56
57 class CUtil
58 {
59 public:
60 CUtil(void);
61 virtual ~CUtil(void);
62 static bool GetVolumeFromFileName(const CStdString& strFileName, CStdString& strFileTitle, CStdString& strVolumeNumber);
f87be18 fixed: strFileName should be const. part of ticket #10078. thanks to dbr...
spiff_ authored
63 static void CleanString(const CStdString& strFileName, CStdString& strTitle, CStdString& strTitleAndYear, CStdString& strYear, bool bRemoveExtension = false, bool bCleanChars = true);
45285e8 step 3/4: Move linuxport to trunk. How'd I get roped into this?
AlTheKiller authored
64 static CStdString GetTitleFromPath(const CStdString& strFileNameAndPath, bool bIsFolder = false);
65 static void GetQualifiedFilename(const CStdString &strBasePath, CStdString &strFilename);
66 static void RunShortcut(const char* szPath);
ee850c9 Merge branch 'fhs'
ceros7 authored
67 static void GetHomePath(CStdString& strPath, const CStdString& strTarget = "XBMC_HOME");
45285e8 step 3/4: Move linuxport to trunk. How'd I get roped into this?
AlTheKiller authored
68 static bool ExcludeFileOrFolder(const CStdString& strFileOrFolder, const CStdStringArray& regexps);
69 static void GetFileAndProtocol(const CStdString& strURL, CStdString& strDir);
70 static int GetDVDIfoTitle(const CStdString& strPathFile);
c51b118 Merged cptspiff's code-reshuffle branch.
theuni authored
71
72 static bool IsPicture(const CStdString& strFile);
9f6f3e0 added: #10183 - md5 hash support to ensure we don't get corrupt download...
jmarshallnz authored
73
74 /*! \brief retrieve MD5sum of a file
75 \param strPath - path to the file to MD5sum
76 \return md5 sum of the file
77 */
78 static CStdString GetFileMD5(const CStdString& strPath);
45285e8 step 3/4: Move linuxport to trunk. How'd I get roped into this?
AlTheKiller authored
79 static bool GetDirectoryName(const CStdString& strFileName, CStdString& strDescription);
80 static void GetDVDDriveIcon( const CStdString& strPath, CStdString& strIcon );
81 static void RemoveTempFiles();
813b218 CrystalP [Win] Clean the temp font directory before playing. Helps with ticket 12...
CrystalP authored
82 static void ClearTempFonts();
45285e8 step 3/4: Move linuxport to trunk. How'd I get roped into this?
AlTheKiller authored
83
84 static void ClearSubtitles();
ea87f7e removed subtitle caching as it was only needed on xbox, partialy takes c...
amet authored
85 static void ScanForExternalSubtitles(const CStdString& strMovie, std::vector<CStdString>& vecSubtitles );
86 static int ScanArchiveForSubtitles( const CStdString& strArchivePath, const CStdString& strMovieFileNameNoExt, std::vector<CStdString>& vecSubtitles );
87 static bool FindVobSubPair( const std::vector<CStdString>& vecSubtitles, const CStdString& strIdxPath, CStdString& strSubPath );
88 static bool IsVobSub( const std::vector<CStdString>& vecSubtitles, const CStdString& strSubPath );
45285e8 step 3/4: Move linuxport to trunk. How'd I get roped into this?
AlTheKiller authored
89 static int64_t ToInt64(uint32_t high, uint32_t low);
90 static bool ThumbExists(const CStdString& strFileName, bool bAddCache = false);
91 static bool ThumbCached(const CStdString& strFileName);
92 static void ThumbCacheAdd(const CStdString& strFileName, bool bFileExists);
93 static void ThumbCacheClear();
94 static CStdString GetNextFilename(const CStdString &fn_template, int max);
3070ce0 fixed: ticket #10142 - use directories in the rar cache to avoid issues ...
spiff_ authored
95 static CStdString GetNextPathname(const CStdString &path_template, int max);
45285e8 step 3/4: Move linuxport to trunk. How'd I get roped into this?
AlTheKiller authored
96 static void TakeScreenshot();
48b06a4 added: async compressing and writing of png screenshots
bobo1on1 authored
97 static void TakeScreenshot(const CStdString &filename, bool sync);
45285e8 step 3/4: Move linuxport to trunk. How'd I get roped into this?
AlTheKiller authored
98 static void Tokenize(const CStdString& path, std::vector<CStdString>& tokens, const std::string& delimiters);
99 static void StatToStatI64(struct _stati64 *result, struct stat *stat);
6d3522f reverted: The __stat64 to stat64 part of r23102 as it wasn't complete. ...
jmarshallnz authored
100 static void Stat64ToStatI64(struct _stati64 *result, struct __stat64 *stat);
101 static void StatI64ToStat64(struct __stat64 *result, struct _stati64 *stat);
102 static void Stat64ToStat(struct stat *result, struct __stat64 *stat);
0cd6f20 fixed: linux doesn't have _stat64i32
wiso authored
103 #ifdef _WIN32
b780534 [WIN32] added: some more exports to the dll loader to make python compil...
wiso authored
104 static void Stat64ToStat64i32(struct _stat64i32 *result, struct __stat64 *stat);
0cd6f20 fixed: linux doesn't have _stat64i32
wiso authored
105 #endif
45285e8 step 3/4: Move linuxport to trunk. How'd I get roped into this?
AlTheKiller authored
106 static bool CreateDirectoryEx(const CStdString& strPath);
107
108 #ifdef _WIN32
109 static CStdString MakeLegalFileName(const CStdString &strFile, int LegalType=LEGAL_WIN32_COMPAT);
110 static CStdString MakeLegalPath(const CStdString &strPath, int LegalType=LEGAL_WIN32_COMPAT);
111 #else
112 static CStdString MakeLegalFileName(const CStdString &strFile, int LegalType=LEGAL_NONE);
113 static CStdString MakeLegalPath(const CStdString &strPath, int LegalType=LEGAL_NONE);
114 #endif
ac5ecdc changed: Improve the double slash correction in Validate Path() (don't m...
arnova authored
115 static CStdString ValidatePath(const CStdString &path, bool bFixDoubleSlashes = false); ///< return a validated path, with correct directory separators.
24240cf merged: Parts of Xbox's r28040 to fix potential problems with Python on ...
arnova authored
116
45285e8 step 3/4: Move linuxport to trunk. How'd I get roped into this?
AlTheKiller authored
117 static bool IsUsingTTFSubtitles();
a19ee9d factor out the parameter splitting of CUtil::SplitExecFunction
Jonathan Marshall authored
118
119 /*! \brief Split a comma separated parameter list into separate parameters.
120 Takes care of the case where we may have a quoted string containing commas, or we may
121 have a function (i.e. parentheses) with multiple parameters as a single parameter.
122
123 eg:
124
125 foo, bar(param1, param2), foo
126
127 will return:
128
129 "foo", "bar(param1, param2)", and "foo".
130
131 \param paramString the string to break up
132 \param parameters the returned parameters
133 */
134 static void SplitParams(const CStdString &paramString, std::vector<CStdString> &parameters);
45285e8 step 3/4: Move linuxport to trunk. How'd I get roped into this?
AlTheKiller authored
135 static void SplitExecFunction(const CStdString &execString, CStdString &function, std::vector<CStdString> &parameters);
136 static int GetMatchingSource(const CStdString& strPath, VECSOURCES& VECSOURCES, bool& bIsSourceName);
137 static CStdString TranslateSpecialSource(const CStdString &strSpecial);
9b3c7a7 cleanup: Get rid of duplicated functions that clear the fileitemlist cac...
jmarshallnz authored
138 static void DeleteDirectoryCache(const CStdString &prefix = "");
45285e8 step 3/4: Move linuxport to trunk. How'd I get roped into this?
AlTheKiller authored
139 static void DeleteMusicDatabaseDirectoryCache();
140 static void DeleteVideoDatabaseDirectoryCache();
141 static CStdString MusicPlaylistsLocation();
142 static CStdString VideoPlaylistsLocation();
143
144 static bool SetSysDateTimeYear(int iYear, int iMonth, int iDay, int iHour, int iMinute);
145 static int GMTZoneCalc(int iRescBiases, int iHour, int iMinute, int &iMinuteNew);
146 static void GetSkinThemes(std::vector<CStdString>& vecTheme);
147 static void GetRecursiveListing(const CStdString& strPath, CFileItemList& items, const CStdString& strMask, bool bUseFileDirectories=false);
148 static void GetRecursiveDirsListing(const CStdString& strPath, CFileItemList& items);
149 static void ForceForwardSlashes(CStdString& strPath);
150
151 static double AlbumRelevance(const CStdString& strAlbumTemp1, const CStdString& strAlbum1, const CStdString& strArtistTemp1, const CStdString& strArtist1);
152 static bool MakeShortenPath(CStdString StrInput, CStdString& StrOutput, int iTextMaxLength);
153 static bool SupportsFileOperations(const CStdString& strPath);
154 static CStdString GetDefaultFolderThumb(const CStdString &folderThumb);
d5c23e3 cosmetics
spiff_ authored
155
fa912dc added: unit tests for Paramify() and SplitExecFunction()
jmarshallnz authored
156 #ifdef UNIT_TESTING
157 static bool TestSplitExec();
563f4d1 fixes #11434, path separator assumptions in CUtil::GetQualifiedFilename(...
Jonathan Marshall authored
158 static bool TestGetQualifiedFilename();
1273189 Michal Piechowiak changed: CUtil::MakeLegalPath now legalize entire path
pieh authored
159 static bool TestMakeLegalPath();
fa912dc added: unit tests for Paramify() and SplitExecFunction()
jmarshallnz authored
160 #endif
161
45285e8 step 3/4: Move linuxport to trunk. How'd I get roped into this?
AlTheKiller authored
162 static void InitRandomSeed();
163
bd4eaa0 added: Support enumeration of TV miniseries with roman numerals in filen...
althekiller authored
164 // Get decimal integer representation of roman digit, ivxlcdm are valid
165 // return 0 for other chars;
166 static int LookupRomanDigit(char roman_digit);
167 // Translate a string of roman numerals to decimal a decimal integer
168 // return -1 on error, valid range is 1-3999
169 static int TranslateRomanNumeral(const char* roman_numeral);
170
45285e8 step 3/4: Move linuxport to trunk. How'd I get roped into this?
AlTheKiller authored
171 #ifdef _LINUX
172 // this will run the command using sudo in a new process.
173 // the user that runs xbmc should be allowed to issue the given sudo command.
174 // in order to allow a user to run sudo without supplying the password you'll need to edit sudoers
175 // # sudo visudo
176 // and add a line at the end defining the user and allowed commands
177 static bool SudoCommand(const CStdString &strCommand);
178
179 //
180 // Forks to execute a shell command.
181 //
182 static bool Command(const CStdStringArray& arrArgs, bool waitExit = false);
183
184 //
185 // Forks to execute an unparsed shell command line.
186 //
187 static bool RunCommandLine(const CStdString& cmdLine, bool waitExit = false);
188 #endif
23a7c1f changed: Rewrote IoSupport::GetXbePath as CUtil::ResolveExecutablePath. ...
althekiller authored
189 static CStdString ResolveExecutablePath();
93b0f35 davilla [osx/ios] fixed. resolve special://frameworks for all three osx cases (x...
davilla authored
190 static CStdString GetFrameworksPath(bool forPython = false);
45285e8 step 3/4: Move linuxport to trunk. How'd I get roped into this?
AlTheKiller authored
191 };
192
193
Something went wrong with that request. Please try again.