CC-4114: separate Liquidsoap into its own init.d script

if liquidsoap restarts, automatically notify pypo
This commit is contained in:
Martin Konecny 2012-08-28 15:00:02 -04:00
parent 8cf048d459
commit 8d81ecf3ad
6 changed files with 59 additions and 2 deletions

View file

@ -117,3 +117,6 @@ get_files_without_replay_gain = 'get-files-without-replay-gain/api_key/%%api_key
update_replay_gain_value = 'update-replay-gain-value/api_key/%%api_key%%'
notify_webstream_data = 'notify-webstream-data/api_key/%%api_key%%/media_id/%%media_id%%/format/json'
notify_liquidsoap_started = 'rabbitmq-do-push/api_key/%%api_key%%/format/json'

View file

@ -229,6 +229,22 @@ class AirtimeApiClient():
except Exception, e:
logger.error("%s", e)
def notify_liquidsoap_started(self):
logger = self.logger
try:
url = "http://%s:%s/%s/%s" % (self.config["base_url"], \
str(self.config["base_port"]), \
self.config["api_base"], \
self.config["notify_liquidsoap_started"])
url = url.replace("%%api_key%%", self.config["api_key"])
self.get_response_from_server(url)
except Exception, e:
logger.error("Exception: %s", str(e))
"""
This is a callback from liquidsoap, we use this to notify about the
currently playing *song*. We get passed a JSON string which we handed to