diff options
| author | Stefan Pluecken <stefan.pluecken@multimedia-labs.de> | 2005-12-30 05:12:34 +0000 |
|---|---|---|
| committer | Stefan Pluecken <stefan.pluecken@multimedia-labs.de> | 2005-12-30 05:12:34 +0000 |
| commit | 21ad640445f0812c5fa954015a3389e4824dc5e1 (patch) | |
| tree | 858148d2874496e380cbe56ce70252106870cd17 /lib/python/Tools | |
| parent | d4e7de836464117242bea65c7e192ff25dee2e46 (diff) | |
| download | enigma2-21ad640445f0812c5fa954015a3389e4824dc5e1.tar.gz enigma2-21ad640445f0812c5fa954015a3389e4824dc5e1.zip | |
the new hdd movie directory is /hdd/movie (for 7020 compatibility reasons)
if /hdd/movies is found and /hdd/movie doesn't exist, /hdd/movies is moved to /hdd/movie
Diffstat (limited to 'lib/python/Tools')
| -rw-r--r-- | lib/python/Tools/Directories.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/python/Tools/Directories.py b/lib/python/Tools/Directories.py index a192298e..64c44cb2 100644 --- a/lib/python/Tools/Directories.py +++ b/lib/python/Tools/Directories.py @@ -8,6 +8,7 @@ SCOPE_SKIN_IMAGE = 4 SCOPE_USERETC = 5 SCOPE_CONFIG = 6 SCOPE_LANGUAGE = 7 +SCOPE_HDD = 8 PATH_CREATE = 0 PATH_DONTCREATE = 1 @@ -22,23 +23,28 @@ defaultPaths = { SCOPE_SKIN: ("/usr/share/enigma2/", PATH_DONTCREATE), SCOPE_SKIN_IMAGE: ("/usr/share/enigma2/", PATH_DONTCREATE), + SCOPE_HDD: ("/hdd/movie/", PATH_DONTCREATE), SCOPE_USERETC: ("", PATH_DONTCREATE) # user home directory } -def resolveFilename(scope, base): +def resolveFilename(scope, base = ""): # in future, we would check for file existence here, # so we can provide default/fallbacks. path = defaultPaths[scope] if path[1] == PATH_CREATE: - if (not os.path.exists(path[0])): + if (not pathExists(scope)): os.mkdir(path[0]) # FIXME: we also have to handle DATADIR etc. here. return path[0] + base # this is only the BASE - an extension must be added later. + +def pathExists(scope): + return os.path.exists(defaultPaths[scope][0]) + def getRecordingFilename(basename): # filter out non-allowed characters @@ -52,7 +58,7 @@ def getRecordingFilename(basename): i = 0 while True: - path = "/hdd/movies/" + filename + path = resolveFilename(SCOPE_HDD, filename) if i > 0: path += "_%03d" % i try: @@ -60,3 +66,9 @@ def getRecordingFilename(basename): i += 1 except IOError: return path + +# this fixes paths or files when changed in a new enigma2 version +def fixOldDirectoryEntries(): + if (os.path.exists("/hdd/movies")): + if (not os.path.exists(resolveFilename(SCOPE_HDD))): + os.system("mv /hdd/movies " + resolveFilename(SCOPE_HDD)) |
