Added support for reading the base config
This commit is contained in:
parent
ae172c785f
commit
d4ed74ae5f
6 changed files with 164 additions and 133 deletions
|
|
@ -59,3 +59,70 @@ class configuration:
|
|||
self.help_path="/usr/share/doc/devede_ng"
|
||||
|
||||
self.gettext_domain = "devede_ng"
|
||||
|
||||
self.PAL = True
|
||||
self.tmp_folder = "/var/tmp"
|
||||
self.multicore = True
|
||||
self.final_folder = None
|
||||
self.sub_language = None
|
||||
self.sub_codepage = None
|
||||
|
||||
config_path = os.path.join(os.environ.get("HOME"),".devede")
|
||||
try:
|
||||
config_data = open(config_path,"r")
|
||||
for linea in config_data:
|
||||
linea = linea.strip()
|
||||
if linea == "":
|
||||
continue
|
||||
if linea[0] == "#":
|
||||
continue
|
||||
if linea[:13]=="video_format:":
|
||||
if linea[13:].strip() =="pal":
|
||||
self.PAL=True
|
||||
continue
|
||||
if linea[13:].strip()=="ntsc":
|
||||
self.PAL=False
|
||||
continue
|
||||
if linea[:12]=="temp_folder:":
|
||||
self.tmp_folder=linea[12:].strip()
|
||||
if linea[:10]=="multicore:":
|
||||
if linea[10:].strip()=="1":
|
||||
self.multicore = False
|
||||
else:
|
||||
self.multicore = True
|
||||
if linea[:13]=="final_folder:":
|
||||
self.final_folder=linea[13:].strip()
|
||||
if linea[:13]=="sub_language:":
|
||||
self.sub_language=linea[13:].strip()
|
||||
if linea[:13]=="sub_codepage:":
|
||||
self.sub_codepage=linea[13:].strip()
|
||||
config_data.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
def save_config(self):
|
||||
|
||||
config_path = os.path.join(os.environ.get("HOME"),".devede")
|
||||
try:
|
||||
config_data = open(config_path,"w")
|
||||
config_data.write("video_format:")
|
||||
if (self.PAL):
|
||||
config_data.write("pal\n")
|
||||
else:
|
||||
config_data.write("ntsc\n")
|
||||
if (self.tmp_folder != None):
|
||||
config_data.write("temp_folder:"+str(self.tmp_folder)+"\n")
|
||||
config_data.write("multicore:")
|
||||
if (self.multicore):
|
||||
config_data.write("2\n")
|
||||
else:
|
||||
config_data.write("1\n")
|
||||
if (self.final_folder != None):
|
||||
config_data.write("final_folder:"+str(self.final_folder)+"\n")
|
||||
if (self.sub_language != None):
|
||||
config_data.write("sub_language:"+str(self.sub_language)+"\n")
|
||||
if (self.sub_codepage != None):
|
||||
config_data.write("sub_codepage:"+str(self.sub_codepage)+"\n")
|
||||
config_data.close()
|
||||
except:
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue