3 SCOPE_TRANSPONDERDATA = 0
19 SCOPE_TRANSPONDERDATA: ("/etc/", PATH_DONTCREATE),
20 SCOPE_SYSETC: ("/etc/", PATH_DONTCREATE),
21 SCOPE_FONTS: ("/usr/share/fonts/", PATH_DONTCREATE),
22 SCOPE_CONFIG: ("/etc/enigma2/", PATH_CREATE),
23 SCOPE_PLUGINS: ("/usr/lib/enigma2/python/Plugins/", PATH_CREATE),
25 SCOPE_LANGUAGE: ("/usr/share/enigma2/po/", PATH_CREATE),
27 SCOPE_SKIN: ("/usr/share/enigma2/", PATH_DONTCREATE),
28 SCOPE_SKIN_IMAGE: ("/usr/share/enigma2/", PATH_DONTCREATE),
29 SCOPE_HDD: ("/hdd/movie/", PATH_DONTCREATE),
30 SCOPE_MEDIA: ("/media/", PATH_DONTCREATE),
32 SCOPE_USERETC: ("", PATH_DONTCREATE) # user home directory
35 FILE_COPY = 0 # copy files from fallback dir to the basedir
36 FILE_MOVE = 1 # move files
37 PATH_COPY = 2 # copy the complete fallback dir to the basedir
38 PATH_MOVE = 3 # move the fallback dir to the basedir (can be used for changes in paths)
40 SCOPE_CONFIG: [("/home/root/", FILE_MOVE),
41 ("/usr/share/enigma2/defaults/", FILE_COPY)],
42 SCOPE_HDD: [("/hdd/movies", PATH_MOVE)]
45 def resolveFilename(scope, base = ""):
47 # don't resolve absolute paths
48 if len(base) and base[0] == '/':
51 path = defaultPaths[scope]
53 if path[1] == PATH_CREATE:
54 if (not pathExists(defaultPaths[scope][0])):
57 #if len(base) > 0 and base[0] == '/':
60 if not fileExists(path[0] + base):
62 if fallbackPaths.has_key(scope):
63 for x in fallbackPaths[scope]:
65 if fileExists(x[0] + base):
66 os.system("cp " + x[0] + base + " " + path[0] + base)
68 elif x[1] == FILE_MOVE:
69 if fileExists(x[0] + base):
70 os.system("mv " + x[0] + base + " " + path[0] + base)
72 elif x[1] == PATH_COPY:
74 if not pathExists(defaultPaths[scope][0]):
76 os.system("cp -a " + x[0] + "* " + path[0])
78 elif x[1] == PATH_MOVE:
80 os.system("mv " + x[0] + " " + path[0])
84 # FIXME: we also have to handle DATADIR etc. here.
87 # this is only the BASE - an extension must be added later.
90 return os.path.exists(path)
101 def getRecordingFilename(basename):
102 # filter out non-allowed characters
103 non_allowed_characters = "/.\\:"
106 basename = basename.replace('\xc2\x86', '').replace('\xc2\x87', '')
109 if c in non_allowed_characters:
115 path = resolveFilename(SCOPE_HDD, filename)
124 # this is clearly a hack:
125 def InitFallbackFiles():
126 resolveFilename(SCOPE_CONFIG, "userbouquet.favourites.tv")
127 resolveFilename(SCOPE_CONFIG, "bouquets.tv")