CC-2607: Handling comments
- It handles comment lines - adding warning text telling not to edit liquidsoap.cfg file
This commit is contained in:
parent
c61759a1da
commit
078aa1d05d
|
@ -117,10 +117,14 @@ try:
|
||||||
# we should access the DB and generate liquidsoap.cfg under etc/airtime/
|
# we should access the DB and generate liquidsoap.cfg under etc/airtime/
|
||||||
api_client = api_client.api_client_factory(config)
|
api_client = api_client.api_client_factory(config)
|
||||||
ss = api_client.get_stream_setting()
|
ss = api_client.get_stream_setting()
|
||||||
|
|
||||||
# if api_client is somehow not working, just use original cfg file
|
# if api_client is somehow not working, just use original cfg file
|
||||||
if(ss is not None):
|
if(ss is not None):
|
||||||
data = ss['msg']
|
data = ss['msg']
|
||||||
fh = open('/etc/airtime/liquidsoap.cfg', 'w')
|
fh = open('/etc/airtime/liquidsoap.cfg', 'w')
|
||||||
|
fh.write("################################################\n")
|
||||||
|
fh.write("# THIS FILE IS AUTO GENERATED. DO NOT CHANGE!! #\n")
|
||||||
|
fh.write("################################################\n")
|
||||||
for d in data:
|
for d in data:
|
||||||
buffer = d[u'keyname'] + " = "
|
buffer = d[u'keyname'] + " = "
|
||||||
if(d[u'type'] == 'string'):
|
if(d[u'type'] == 'string'):
|
||||||
|
|
|
@ -117,7 +117,9 @@ class PypoFetch(Thread):
|
||||||
while 1:
|
while 1:
|
||||||
line = fh.readline()
|
line = fh.readline()
|
||||||
if not line:
|
if not line:
|
||||||
break;
|
break
|
||||||
|
if line.find('#') == 0:
|
||||||
|
continue
|
||||||
key, value = line.split('=')
|
key, value = line.split('=')
|
||||||
key = key.strip()
|
key = key.strip()
|
||||||
value = value.strip()
|
value = value.strip()
|
||||||
|
@ -176,6 +178,9 @@ class PypoFetch(Thread):
|
||||||
if restart:
|
if restart:
|
||||||
fh = open('/etc/airtime/liquidsoap.cfg', 'w')
|
fh = open('/etc/airtime/liquidsoap.cfg', 'w')
|
||||||
logger.info("Rewriting liquidsoap.cfg...")
|
logger.info("Rewriting liquidsoap.cfg...")
|
||||||
|
fh.write("################################################\n")
|
||||||
|
fh.write("# THIS FILE IS AUTO GENERATED. DO NOT CHANGE!! #\n")
|
||||||
|
fh.write("################################################\n")
|
||||||
for d in setting:
|
for d in setting:
|
||||||
buffer = d[u'keyname'] + " = "
|
buffer = d[u'keyname'] + " = "
|
||||||
if(d[u'type'] == 'string'):
|
if(d[u'type'] == 'string'):
|
||||||
|
|
Loading…
Reference in New Issue