{
eDebug("---- opening lame channel db");
FILE *f=fopen(file, "rt");
- if (!f && strcmp(file, eEnv::resolve("${sysconfdir}/enigma2/lamedb").c_str()) == 0)
- {
- struct stat s;
- if ( !stat("lamedb", &s) )
- {
- if ( !stat(eEnv::resolve("${sysconfdir}/enigma2").c_str(), &s) )
- {
- rename("lamedb", eEnv::resolve("${sysconfdir}/enigma2/lamedb").c_str());
- reloadServicelist();
- }
- }
+ if (!f) {
+ eDebug("can't open %s: %m", file);
return;
}
+
char line[256];
int version=3;
if ((!fgets(line, 256, f)) || sscanf(line, "eDVB services /%d/", &version) != 1)
p+=path;
eDebug("loading bouquet... %s", p.c_str());
FILE *fp=fopen(p.c_str(), "rt");
- int entries=0;
if (!fp)
{
- struct stat s;
- if ( !stat(path, &s) )
- {
- rename(path, p.c_str() );
- loadBouquet(path);
- return;
- }
- eDebug("failed to open.");
- if ( strstr(path, "bouquets.tv") )
+ eDebug("can't open %s: %m", p.c_str());
+ if (!strcmp(path, "bouquets.tv"))
{
eDebug("recreate bouquets.tv");
bouquet.m_bouquet_name="Bouquets (TV)";
bouquet.flushChanges();
}
- else if ( strstr(path, "bouquets.radio") )
+ else if (!strcmp(path, "bouquets.radio"))
{
eDebug("recreate bouquets.radio");
bouquet.m_bouquet_name="Bouquets (Radio)";
}
return;
}
+ int entries=0;
char line[256];
bool read_descr=false;
eServiceReference *e = NULL;
directory_category = directory + c
if not os_path.isdir(directory_category):
continue
- open(directory_category + "/__init__.py", "a").close()
for pluginname in os_listdir(directory_category):
path = directory_category + "/" + pluginname
if os_path.isdir(path):
def saveToFile(self, filename):
text = self.pickle()
- f = open(filename, "w")
- f.write(text)
- f.close()
+ try:
+ f = open(filename, "w")
+ f.write(text)
+ f.close()
+ except IOError:
+ print "Config: Couldn't write %s" % filename
def loadFromFile(self, filename, base_file=False):
f = open(filename, "r")
print "saveMode", port, mode, rate
config.av.videoport.value = port
config.av.videoport.save()
- config.av.videomode[port].value = mode
- config.av.videomode[port].save()
- config.av.videorate[mode].value = rate
- config.av.videorate[mode].save()
+ if port in config.av.videomode:
+ config.av.videomode[port].value = mode
+ config.av.videomode[port].save()
+ if mode in config.av.videorate:
+ config.av.videorate[mode].value = rate
+ config.av.videorate[mode].save()
def isPortAvailable(self, port):
# fixme
self["arrowup2"] = MovingPixmap()
def setDirectory(self):
- os_system("mount %s %s" % (resolveFilename(SCOPE_DEFAULTPARTITION), resolveFilename(SCOPE_DEFAULTPARTITIONMOUNTDIR)))
self.directory = resolveFilename(SCOPE_DEFAULTPARTITIONMOUNTDIR)
self.xmlfile = "defaultwizard.xml"
+ if self.directory:
+ os_system("mount %s %s" % (resolveFilename(SCOPE_DEFAULTPARTITION), self.directory))
def markDone(self):
config.misc.defaultchosen.value = 0
if flags == PATH_CREATE:
if not pathExists(path):
- mkdir(path)
+ try:
+ mkdir(path)
+ except OSError:
+ print "resolveFilename: Couldn't create %s" % path
+ return None
fallbackPath = fallbackPaths.get(scope)
# returns a list of tuples containing pathname and filename matching the given pattern
# example-pattern: match all txt-files: ".*\.txt$"
def crawlDirectory(directory, pattern):
- expression = compile(pattern)
list = []
- for root, dirs, files in walk(directory):
- for file in files:
- if expression.match(file) is not None:
- list.append((root, file))
+ if directory:
+ expression = compile(pattern)
+ for root, dirs, files in walk(directory):
+ for file in files:
+ if expression.match(file) is not None:
+ list.append((root, file))
return list
def copyfile(src, dst):