Merge branch '1.9.1' of dev.sourcefabric.org:airtime into 1.9.1
This commit is contained in:
commit
1a3a5b3c1f
|
@ -1,5 +0,0 @@
|
|||
#!/bin/sh
|
||||
echo
|
||||
echo "This will tail the pypo-liquidsoap log file."
|
||||
echo "Type in password for pypo user (default password is 'pypo'):"
|
||||
su -l pypo -c "tail -F /var/log/airtime/pypo-liquidsoap/main/current"
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo
|
||||
echo "This will tail the recorder log file."
|
||||
echo "Type in password for pypo user (default password is 'pypo'):"
|
||||
|
||||
su -l pypo -c "tail -F /var/log/airtime/show-recorder/main/current"
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo
|
||||
echo "This will output the pypo log file."
|
||||
echo "Type in password for pypo user (default password is 'pypo'):"
|
||||
|
||||
su -l pypo -c "less /var/log/airtime/pypo/main/current"
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo
|
||||
echo "This will tail the pypo log file."
|
||||
echo "Type in password for pypo user (default password is 'pypo'):"
|
||||
|
||||
su -l pypo -c "tail -F /var/log/airtime/pypo/main/current"
|
|
@ -32,6 +32,8 @@ class AirtimeIni
|
|||
const CONF_FILE_MEDIAMONITOR = "/etc/airtime/media-monitor.cfg";
|
||||
const CONF_FILE_MONIT = "/etc/monit/conf.d/airtime-monit.cfg";
|
||||
|
||||
const CONF_PYPO_GRP = "pypo";
|
||||
|
||||
public static function IniFilesExist()
|
||||
{
|
||||
$configFiles = array(AirtimeIni::CONF_FILE_AIRTIME,
|
||||
|
@ -66,22 +68,29 @@ class AirtimeIni
|
|||
echo "Could not copy airtime.conf to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!copy(__DIR__."/../../python_apps/api_clients/api_client.cfg", AirtimeIni::CONF_FILE_API_CLIENT)){
|
||||
echo "Could not copy api_client.cfg to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!copy(__DIR__."/../../python_apps/pypo/pypo.cfg", AirtimeIni::CONF_FILE_PYPO)){
|
||||
echo "Could not copy pypo.cfg to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!copy(__DIR__."/../../python_apps/show-recorder/recorder.cfg", AirtimeIni::CONF_FILE_RECORDER)){
|
||||
echo "Could not copy recorder.cfg to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!copy(__DIR__."/../../python_apps/pypo/liquidsoap_scripts/liquidsoap.cfg", AirtimeIni::CONF_FILE_LIQUIDSOAP)){
|
||||
echo "Could not copy liquidsoap.cfg to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
chmod(AirtimeIni::CONF_FILE_LIQUIDSOAP, 0640);
|
||||
chgrp(AirtimeIni::CONF_FILE_LIQUIDSOAP, AirtimeIni::CONF_PYPO_GRP);
|
||||
|
||||
if (!copy(__DIR__."/../../python_apps/media-monitor/media-monitor.cfg", AirtimeIni::CONF_FILE_MEDIAMONITOR)){
|
||||
echo "Could not copy media-monitor.cfg to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
class Airtime194Upgrade{
|
||||
|
||||
const CONF_FILE_LIQUIDSOAP = "/etc/airtime/liquidsoap.cfg";
|
||||
const CONF_PYPO_GRP = "pypo";
|
||||
|
||||
public static function upgradeLiquidsoapCfgPerms(){
|
||||
chmod(self::CONF_FILE_LIQUIDSOAP, 0640);
|
||||
chgrp(self::CONF_FILE_LIQUIDSOAP, self::CONF_PYPO_GRP);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Airtime194Upgrade::upgradeLiquidsoapCfgPerms();
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
# Location of pypo_cli.py Python script
|
||||
|
||||
|
|
|
@ -17,13 +17,13 @@ DAEMON=/usr/lib/airtime/media-monitor/airtime-media-monitor
|
|||
PIDFILE=/var/run/airtime-media-monitor.pid
|
||||
|
||||
start () {
|
||||
#monit monitor airtime-media-monitor >/dev/null 2>&1
|
||||
monit monitor airtime-media-monitor >/dev/null 2>&1
|
||||
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID --make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
||||
}
|
||||
|
||||
stop () {
|
||||
# Send TERM after 5 seconds, wait at most 30 seconds.
|
||||
#monit unmonitor airtime-media-monitor >/dev/null 2>&1
|
||||
monit unmonitor airtime-media-monitor >/dev/null 2>&1
|
||||
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE
|
||||
rm -f $PIDFILE
|
||||
}
|
||||
|
|
|
@ -2,14 +2,9 @@ import socket
|
|||
import logging
|
||||
import time
|
||||
|
||||
|
||||
import pyinotify
|
||||
from pyinotify import ProcessEvent
|
||||
|
||||
# For RabbitMQ
|
||||
from kombu.connection import BrokerConnection
|
||||
from kombu.messaging import Exchange, Queue, Consumer, Producer
|
||||
|
||||
from airtimemetadata import AirtimeMetadata
|
||||
from airtimefilemonitor.mediaconfig import AirtimeMediaConfig
|
||||
|
||||
|
@ -186,8 +181,10 @@ class AirtimeProcessEvent(ProcessEvent):
|
|||
self.mmc.touch_index_file()
|
||||
|
||||
self.file_events = []
|
||||
#yeild to workder thread
|
||||
|
||||
#yield to worker thread
|
||||
time.sleep(0)
|
||||
|
||||
#use items() because we are going to be modifying this
|
||||
#dictionary while iterating over it.
|
||||
for k, pair in self.cookies_IN_MOVED_FROM.items():
|
||||
|
@ -206,7 +203,7 @@ class AirtimeProcessEvent(ProcessEvent):
|
|||
self.handle_removed_file(False, event.pathname)
|
||||
|
||||
|
||||
#check for any events recieved from Airtime.
|
||||
#check for any events received from Airtime.
|
||||
try:
|
||||
notifier.connection.drain_events(timeout=0.1)
|
||||
#avoid logging a bunch of timeout messages.
|
||||
|
@ -214,4 +211,5 @@ class AirtimeProcessEvent(ProcessEvent):
|
|||
pass
|
||||
except Exception, e:
|
||||
self.logger.info("%s", e)
|
||||
time.sleep(3)
|
||||
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
with pidfile "/var/run/airtime-liquidsoap.pid"
|
||||
start program = "/etc/init.d/airtime-playout start" with timeout 10 seconds
|
||||
stop program = "/etc/init.d/airtime-playout stop"
|
||||
# check process airtime-media-monitor
|
||||
# with pidfile "/var/run/airtime-media-monitor.pid"
|
||||
# start program = "/etc/init.d/airtime-media-monitor start" with timeout 10 seconds
|
||||
# stop program = "/etc/init.d/airtime-media-monitor stop"
|
||||
check process airtime-media-monitor
|
||||
with pidfile "/var/run/airtime-media-monitor.pid"
|
||||
start program = "/etc/init.d/airtime-media-monitor start" with timeout 10 seconds
|
||||
stop program = "/etc/init.d/airtime-media-monitor stop"
|
||||
check process airtime-show-recorder
|
||||
with pidfile "/var/run/airtime-show-recorder.pid"
|
||||
start program = "/etc/init.d/airtime-show-recorder start" with timeout 10 seconds
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
||||
. ${virtualenv_bin}activate
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
||||
. ${virtualenv_bin}activate
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
############################################
|
||||
# just a wrapper to call the notifyer #
|
||||
# needed here to keep dirs/configs clean #
|
||||
|
|
|
@ -9,6 +9,7 @@ import string
|
|||
import json
|
||||
import telnetlib
|
||||
import math
|
||||
import socket
|
||||
from threading import Thread
|
||||
from subprocess import Popen, PIPE
|
||||
from datetime import datetime
|
||||
|
@ -351,12 +352,7 @@ class PypoFetch(Thread):
|
|||
logger.error(e)
|
||||
|
||||
|
||||
"""
|
||||
Main loop of the thread:
|
||||
Wait for schedule updates from RabbitMQ, but in case there arent any,
|
||||
poll the server to get the upcoming schedule.
|
||||
"""
|
||||
def run(self):
|
||||
def main(self):
|
||||
logger = logging.getLogger('fetch')
|
||||
|
||||
while not self.init_rabbit_mq():
|
||||
|
@ -384,12 +380,31 @@ class PypoFetch(Thread):
|
|||
# Hooray for globals!
|
||||
schedule_data = SCHEDULE_PUSH_MSG
|
||||
status = 1
|
||||
except:
|
||||
except socket.timeout, se:
|
||||
# We didnt get a message for a while, so poll the server
|
||||
# to get an updated schedule.
|
||||
status, schedule_data = self.api_client.get_schedule()
|
||||
except Exception, e:
|
||||
"""
|
||||
This Generic exception is thrown whenever the RabbitMQ
|
||||
Service is stopped. In this case let's check every few
|
||||
seconds to see if it has come back up
|
||||
"""
|
||||
logger.info("Unknown exception")
|
||||
return
|
||||
|
||||
#return based on the exception
|
||||
|
||||
if status == 1:
|
||||
self.process_schedule(schedule_data, "scheduler", False)
|
||||
loops += 1
|
||||
loops += 1
|
||||
|
||||
"""
|
||||
Main loop of the thread:
|
||||
Wait for schedule updates from RabbitMQ, but in case there arent any,
|
||||
poll the server to get the upcoming schedule.
|
||||
"""
|
||||
def run(self):
|
||||
while True:
|
||||
self.main()
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
||||
. ${virtualenv_bin}activate
|
||||
|
|
|
@ -7,6 +7,7 @@ import datetime
|
|||
import os
|
||||
import sys
|
||||
import shutil
|
||||
import socket
|
||||
|
||||
from configobj import ConfigObj
|
||||
|
||||
|
@ -289,10 +290,12 @@ class CommandListener(Thread):
|
|||
try:
|
||||
# block until 5 seconds before the next show start
|
||||
self.connection.drain_events(timeout=self.time_till_next_show)
|
||||
except Exception, e:
|
||||
self.logger.info(e)
|
||||
except socket.timeout, s:
|
||||
self.logger.info(s)
|
||||
# start recording
|
||||
self.start_record()
|
||||
except Exception, e:
|
||||
time.sleep(3)
|
||||
|
||||
loops += 1
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
||||
. ${virtualenv_bin}activate
|
||||
|
|
Loading…
Reference in New Issue