CC-2745: Show status of liquidsoap/icecast connection on Stream
Settings page - temp commit
This commit is contained in:
parent
d8c6b722ac
commit
efbd2f53d0
5 changed files with 15 additions and 11 deletions
|
@ -83,15 +83,18 @@ class Application_Model_StreamSetting {
|
||||||
$sql = "SELECT COUNT(*) FROM cc_stream_setting"
|
$sql = "SELECT COUNT(*) FROM cc_stream_setting"
|
||||||
." WHERE keyname = '$keyname'";
|
." WHERE keyname = '$keyname'";
|
||||||
$result = $CC_DBC->GetOne($sql);
|
$result = $CC_DBC->GetOne($sql);
|
||||||
|
Logging::log("setError");
|
||||||
if ($result == 1){
|
if ($result == 1){
|
||||||
$sql = "UPDATE cc_stream_setting"
|
$sql = "UPDATE cc_stream_setting"
|
||||||
." SET value = '$value'"
|
." SET value = '$msg'"
|
||||||
." WHERE keyname = '$keyname'";
|
." WHERE keyname = '$keyname'";
|
||||||
}else{
|
}else{
|
||||||
$sql = "INSERT INTO cc_stream_setting (keyname, value, type)"
|
$sql = "INSERT INTO cc_stream_setting (keyname, value, type)"
|
||||||
." VALUES ($keyname, '$msg', 'string')";
|
." VALUES ('$keyname', '$msg', 'string')";
|
||||||
}
|
}
|
||||||
|
Logging::log($sql);
|
||||||
|
$res = $CC_DBC->query($sql);
|
||||||
|
Logging::log($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getLiquidsoapError($stream_id){
|
public static function getLiquidsoapError($stream_id){
|
||||||
|
|
|
@ -577,7 +577,9 @@ class AirTimeApiClient(ApiClientInterface):
|
||||||
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["update_liquidsoap_error"])
|
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["update_liquidsoap_error"])
|
||||||
|
|
||||||
url = url.replace("%%api_key%%", self.config["api_key"])
|
url = url.replace("%%api_key%%", self.config["api_key"])
|
||||||
url = url.replace("%%error_msg%%", error_msg)
|
error_msg = error_msg.replace('/', ' ')
|
||||||
|
encoded_msg = urllib.quote(error_msg, '')
|
||||||
|
url = url.replace("%%error_msg%%", encoded_msg)
|
||||||
url = url.replace("%%stream_id%%", stream_id)
|
url = url.replace("%%stream_id%%", stream_id)
|
||||||
logger.debug(url)
|
logger.debug(url)
|
||||||
req = urllib2.Request(url)
|
req = urllib2.Request(url)
|
||||||
|
|
|
@ -39,8 +39,7 @@ end
|
||||||
|
|
||||||
def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, description, genre, user, s, stream) =
|
def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, description, genre, user, s, stream) =
|
||||||
def on_error(msg)
|
def on_error(msg)
|
||||||
system("airtime-check-system > ~/temp/temp1.log 2>&1")
|
system("/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --error='#{msg}' --stream-id=#{stream}")
|
||||||
system("/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --error='#{msg}' --stream-id=#{stream} > ~/temp/temp.log 2>&1")
|
|
||||||
log("/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --error='#{msg}' --stream-id=#{stream}")
|
log("/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --error='#{msg}' --stream-id=#{stream}")
|
||||||
5.
|
5.
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,4 +10,4 @@ SCRIPT=`readlink -f $0`
|
||||||
# Absolute path this script is in
|
# Absolute path this script is in
|
||||||
SCRIPTPATH=`dirname $SCRIPT`
|
SCRIPTPATH=`dirname $SCRIPT`
|
||||||
|
|
||||||
cd ${SCRIPTPATH}/../ && python pypo-notify.py $1 $2 $3 $4 $5 $6 $7 $8 &
|
cd ${SCRIPTPATH}/../ && python pypo-notify.py "$@"
|
||||||
|
|
|
@ -47,7 +47,7 @@ parser = OptionParser(usage=usage)
|
||||||
# Options
|
# Options
|
||||||
parser.add_option("-d", "--data", help="Pass JSON data from liquidsoap into this script.", metavar="data")
|
parser.add_option("-d", "--data", help="Pass JSON data from liquidsoap into this script.", metavar="data")
|
||||||
parser.add_option("-m", "--media-id", help="ID of the file that is currently playing.", metavar="media_id")
|
parser.add_option("-m", "--media-id", help="ID of the file that is currently playing.", metavar="media_id")
|
||||||
parser.add_option("-e", "--error", help="liquidsoap error msg.", metavar="error_msg")
|
parser.add_option("-e", "--error", action="store", dest="error", type="string", help="liquidsoap error msg.", metavar="error_msg")
|
||||||
parser.add_option("-s", "--stream-id", help="ID stream", metavar="stream_id")
|
parser.add_option("-s", "--stream-id", help="ID stream", metavar="stream_id")
|
||||||
parser.add_option("-c", "--connect", help="liquidsoap connected", action="store_true", metavar="connect")
|
parser.add_option("-c", "--connect", help="liquidsoap connected", action="store_true", metavar="connect")
|
||||||
|
|
||||||
|
@ -109,13 +109,13 @@ if __name__ == '__main__':
|
||||||
# initialize
|
# initialize
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|
||||||
if options.error_msg and options.stream_id:
|
if options.error and options.stream_id:
|
||||||
try:
|
try:
|
||||||
n = Notify()
|
n = Notify()
|
||||||
n.notify_liquidsoap_error(options.error_msg, options.stream_id)
|
n.notify_liquidsoap_error(options.error, options.stream_id)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print e
|
print e
|
||||||
elif optioins.connect and options.stream_id:
|
elif options.connect and options.stream_id:
|
||||||
try:
|
try:
|
||||||
n = Notify()
|
n = Notify()
|
||||||
n.notify_liquidsoap_connection(options.stream_id)
|
n.notify_liquidsoap_connection(options.stream_id)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue