cc-3447: synchronize access to liquidsoap via telnet
-add another critical section
This commit is contained in:
parent
c8c9e46228
commit
6634e9f663
2 changed files with 12 additions and 15 deletions
|
@ -166,6 +166,8 @@ class PypoFetch(Thread):
|
||||||
|
|
||||||
def stop_current_show(self):
|
def stop_current_show(self):
|
||||||
self.logger.debug('Notifying Liquidsoap to stop playback.')
|
self.logger.debug('Notifying Liquidsoap to stop playback.')
|
||||||
|
|
||||||
|
self.telnet_lock.acquire()
|
||||||
try:
|
try:
|
||||||
tn = telnetlib.Telnet(LS_HOST, LS_PORT)
|
tn = telnetlib.Telnet(LS_HOST, LS_PORT)
|
||||||
tn.write('source.skip\n')
|
tn.write('source.skip\n')
|
||||||
|
@ -174,6 +176,8 @@ class PypoFetch(Thread):
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.logger.debug(e)
|
self.logger.debug(e)
|
||||||
self.logger.debug('Could not connect to liquidsoap')
|
self.logger.debug('Could not connect to liquidsoap')
|
||||||
|
finally:
|
||||||
|
self.telnet_lock.release()
|
||||||
|
|
||||||
def regenerateLiquidsoapConf(self, setting_p):
|
def regenerateLiquidsoapConf(self, setting_p):
|
||||||
existing = {}
|
existing = {}
|
||||||
|
@ -327,11 +331,7 @@ class PypoFetch(Thread):
|
||||||
# Push stream metadata to liquidsoap
|
# Push stream metadata to liquidsoap
|
||||||
# TODO: THIS LIQUIDSOAP STUFF NEEDS TO BE MOVED TO PYPO-PUSH!!!
|
# TODO: THIS LIQUIDSOAP STUFF NEEDS TO BE MOVED TO PYPO-PUSH!!!
|
||||||
try:
|
try:
|
||||||
self.logger.info(LS_HOST)
|
|
||||||
self.logger.info(LS_PORT)
|
|
||||||
|
|
||||||
self.telnet_lock.acquire()
|
self.telnet_lock.acquire()
|
||||||
try:
|
|
||||||
tn = telnetlib.Telnet(LS_HOST, LS_PORT)
|
tn = telnetlib.Telnet(LS_HOST, LS_PORT)
|
||||||
command = ('vars.stream_metadata_type %s\n' % stream_format).encode('utf-8')
|
command = ('vars.stream_metadata_type %s\n' % stream_format).encode('utf-8')
|
||||||
self.logger.info(command)
|
self.logger.info(command)
|
||||||
|
@ -339,11 +339,9 @@ class PypoFetch(Thread):
|
||||||
tn.write('exit\n')
|
tn.write('exit\n')
|
||||||
tn.read_all()
|
tn.read_all()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.logger.error(str(e))
|
self.logger.error("Exception %s", e)
|
||||||
finally:
|
finally:
|
||||||
self.telnet_lock.release()
|
self.telnet_lock.release()
|
||||||
except Exception, e:
|
|
||||||
self.logger.error("Exception %s", e)
|
|
||||||
|
|
||||||
def update_liquidsoap_station_name(self, station_name):
|
def update_liquidsoap_station_name(self, station_name):
|
||||||
# Push stream metadata to liquidsoap
|
# Push stream metadata to liquidsoap
|
||||||
|
|
|
@ -166,7 +166,6 @@ class PypoPush(Thread):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.telnet_lock.acquire()
|
self.telnet_lock.acquire()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
tn = telnetlib.Telnet(LS_HOST, LS_PORT)
|
tn = telnetlib.Telnet(LS_HOST, LS_PORT)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue