Merge branch '1.9.1' into devel
Conflicts: VERSION airtime_mvc/application/configs/constants.php airtime_mvc/application/controllers/ScheduleController.php install_minimal/airtime-install install_minimal/include/AirtimeInstall.php install_minimal/include/airtime-upgrade.php python_apps/api_clients/api_client.py python_apps/pypo/pypofetch.py python_apps/pypo/pypopush.py
This commit is contained in:
commit
9c7bab616d
|
@ -87,8 +87,8 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$user = new User($userInfo->id);
|
||||
|
||||
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
$show = new ShowInstance($showInstanceId);
|
||||
$error = $show->moveShow($deltaDay, $deltaMin);
|
||||
$showInstance = new ShowInstance($showInstanceId);
|
||||
$error = $showInstance->moveShow($deltaDay, $deltaMin);
|
||||
}
|
||||
|
||||
if(isset($error))
|
||||
|
|
|
@ -1258,6 +1258,24 @@ class Show {
|
|||
|
||||
return $event;
|
||||
}
|
||||
|
||||
public function setShowFirstShow($s_date){
|
||||
$showDay = CcShowDaysQuery::create()
|
||||
->filterByDbShowId($this->_showId)
|
||||
->findOne();
|
||||
|
||||
$showDay->setDbFirstShow($s_date)
|
||||
->save();
|
||||
}
|
||||
|
||||
public function setShowLastShow($e_date){
|
||||
$showDay = CcShowDaysQuery::create()
|
||||
->filterByDbShowId($this->_showId)
|
||||
->findOne();
|
||||
|
||||
$showDay->setDbLastShow($e_date)
|
||||
->save();
|
||||
}
|
||||
}
|
||||
|
||||
class ShowInstance {
|
||||
|
@ -1471,6 +1489,13 @@ class ShowInstance {
|
|||
$this->setShowStart($new_starts);
|
||||
$this->setShowEnd($new_ends);
|
||||
$this->correctScheduleStartTimes();
|
||||
|
||||
$show = new Show($this->getShowId());
|
||||
if(!$show->isRepeating()){
|
||||
$show->setShowFirstShow($new_starts);
|
||||
$show->setShowLastShow($new_ends);
|
||||
}
|
||||
|
||||
RabbitMq::PushSchedule();
|
||||
}
|
||||
|
||||
|
|
|
@ -438,9 +438,11 @@ class StoredFile {
|
|||
* Get the URL to access this file.
|
||||
*/
|
||||
public function getFileUrl()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
return "http://$CC_CONFIG[baseUrl]:$CC_CONFIG[basePort]/api/get-media/file/".$this->getGunId().".".$this->getFileExtension();
|
||||
{
|
||||
$serverName = $_SERVER['SERVER_NAME'];
|
||||
$serverPort = $_SERVER['SERVER_PORT'];
|
||||
|
||||
return "http://$serverName:$serverPort/api/get-media/file/".$this->getGunId().".".$this->getFileExtension();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<td><?php echo $row["track_title"] ?></td>
|
||||
<td><?php echo $row["artist_name"] ?></td>
|
||||
<td><?php echo $row["album_title"] ?></td>
|
||||
<td><?php echo $row["length"] ?></td>
|
||||
<td><?php echo $row["clip_length"] ?></td>
|
||||
<td><?php echo $row["genre"] ?></td>
|
||||
</tr>
|
||||
<?php $i=$i+1; ?>
|
||||
|
|
|
@ -31,6 +31,7 @@ function deleteAudioClip(json) {
|
|||
}
|
||||
|
||||
deleteItem("au", json.id);
|
||||
location.reload(true);
|
||||
}
|
||||
|
||||
//callbacks called by jjmenu
|
||||
|
|
|
@ -303,6 +303,9 @@ function addSPLItem(event, ui){
|
|||
|
||||
function deleteSPLItem(event){
|
||||
event.stopPropagation();
|
||||
|
||||
// stop any preview playing
|
||||
$('#jquery_jplayer_1').jPlayer('stop');
|
||||
|
||||
var url, pos;
|
||||
|
||||
|
@ -399,7 +402,7 @@ function newSPL() {
|
|||
|
||||
function deleteSPL() {
|
||||
var url;
|
||||
|
||||
|
||||
// stop any preview playing
|
||||
$('#jquery_jplayer_1').jPlayer('stop');
|
||||
|
||||
|
|
|
@ -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"
|
|
@ -1,6 +1,10 @@
|
|||
#!/bin/bash
|
||||
#!/bin/bash -e
|
||||
#-e Causes bash script to exit if any of the installers
|
||||
#return with a non-zero return value.
|
||||
|
||||
set +e
|
||||
DEB=$(dpkg -s airtime 2> /dev/null | grep Status)
|
||||
set -e
|
||||
if [[ "$DEB" = "Status: install ok installed" ]]; then
|
||||
echo -e "\nDebian package of Airtime detected. Please use the debian package to upgrade.\n"
|
||||
exit 1
|
||||
|
@ -13,16 +17,61 @@ SCRIPT=`readlink -f $0`
|
|||
# Absolute directory this script is in
|
||||
SCRIPTPATH=`dirname $SCRIPT`
|
||||
|
||||
#Cause bash script to exit if any of the installers
|
||||
#return with a non-zero return value.
|
||||
set -e
|
||||
|
||||
${SCRIPTPATH}/../python_apps/python-virtualenv/virtualenv-install.sh
|
||||
VIRTUAL_ENV_DIR="/usr/lib/airtime/airtime_virtualenv"
|
||||
VIRTUAL_ENV_SHARE="/usr/share/python-virtualenv/"
|
||||
if [ ! -d "$VIRTUAL_ENV_DIR" ]; then
|
||||
echo -e "\n*** Creating Virtualenv for Airtime ***"
|
||||
set +e
|
||||
virtualenv --help | grep extra-search-dir
|
||||
EXTRAOPTION=$?
|
||||
set -e
|
||||
|
||||
if [ $EXTRAOPTION -eq "0" ]; then
|
||||
sudo virtualenv --extra-search-dir=${SCRIPTPATH}/3rd_party --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv
|
||||
else
|
||||
# copy distribute-0.6.10.tar.gz to /usr/share/python-virtualenv/
|
||||
# this is due to the bug in virtualenv 1.4.9
|
||||
if [ -d "$VIRTUAL_ENV_SHARE" ]; then
|
||||
cp ${SCRIPTPATH}/3rd_party/distribute-0.6.10.tar.gz /usr/share/python-virtualenv/
|
||||
fi
|
||||
sudo virtualenv --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv
|
||||
fi
|
||||
|
||||
echo -e "\n*** Installing Python Libraries ***"
|
||||
sudo /usr/lib/airtime/airtime_virtualenv/bin/pip install ${SCRIPTPATH}/airtime_virtual_env.pybundle -E /usr/lib/airtime/airtime_virtualenv
|
||||
|
||||
echo -e "\n*** Patching Python Libraries ***"
|
||||
PACHES=${SCRIPTPATH}/patches/*
|
||||
for file in $(find $PACHES -print); do
|
||||
if [ -d $file ]; then
|
||||
DIRNAME=$(basename $file)
|
||||
echo -e "\n ---Applying Patches for $DIRNAME---"
|
||||
else
|
||||
sudo patch -N -p0 -i $file
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo -e "\n*** Existing Airtime Virtualenv Found ***"
|
||||
fi
|
||||
|
||||
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
||||
. ${virtualenv_bin}activate
|
||||
|
||||
echo -e "\n*** Creating Pypo User ***"
|
||||
python ${SCRIPTPATH}/../python_apps/create-pypo-user.py
|
||||
|
||||
set +e
|
||||
php ${SCRIPTPATH}/include/airtime-install.php $@
|
||||
result=$?
|
||||
if [ "$result" -eq "2" ]; then
|
||||
#We've just finished an upgrade, so let's exit
|
||||
exit 0
|
||||
elif [ "$result" -ne "0" ]; then
|
||||
#There was an error, exit with error code.
|
||||
exit 1
|
||||
fi
|
||||
set -e
|
||||
|
||||
echo -e "\n*** API Client Installation ***"
|
||||
python ${SCRIPTPATH}/../python_apps/api_clients/install/api_client_install.py
|
||||
|
|
|
@ -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,18 +68,22 @@ 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);
|
||||
|
@ -87,6 +93,9 @@ class AirtimeIni
|
|||
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);
|
||||
|
|
|
@ -452,6 +452,7 @@ class AirtimeInstall
|
|||
}
|
||||
|
||||
public static function CreateCronFile(){
|
||||
echo "* Creating Cron File".PHP_EOL;
|
||||
// Create CRON task to run every day. Time of day is initialized to a random time.
|
||||
$hour = rand(0,23);
|
||||
$minute = rand(0,59);
|
||||
|
|
|
@ -65,9 +65,6 @@ if (isset($version) && ($version != false) && ($version < AIRTIME_VERSION) && !i
|
|||
|
||||
require_once("airtime-upgrade.php");
|
||||
|
||||
//Make sure to exit with non-zero error code so that airtime-install
|
||||
//shell script does not continue with installing pypo, show-recorder,
|
||||
//media-monitor etc.
|
||||
exit(2);
|
||||
}
|
||||
|
||||
|
|
|
@ -72,10 +72,14 @@ if (strcmp($version, "1.9.2") < 0){
|
|||
if (strcmp($version, "1.9.3") < 0){
|
||||
system("php ".__DIR__."/../upgrades/airtime-1.9.3/airtime-upgrade.php");
|
||||
}
|
||||
if (strcmp($version, "1.9.4") < 0){
|
||||
system("php ".__DIR__."/../upgrades/airtime-1.9.4/airtime-upgrade.php");
|
||||
}
|
||||
if (strcmp($version, "2.0.0") < 0){
|
||||
system("php ".__DIR__."/../upgrades/airtime-2.0.0/airtime-upgrade.php");
|
||||
}
|
||||
|
||||
|
||||
//set the new version in the database.
|
||||
$sql = "DELETE FROM cc_pref WHERE keystr = 'system_version'";
|
||||
$CC_DBC->query($sql);
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
class Airtime194Upgrade{
|
||||
|
||||
const CONF_FILE_LIQUIDSOAP = "/etc/airtime/liquidsoap.cfg";
|
||||
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
|
||||
const CONF_PYPO_GRP = "pypo";
|
||||
|
||||
public static function upgradeLiquidsoapCfgPerms(){
|
||||
chmod(self::CONF_FILE_LIQUIDSOAP, 0640);
|
||||
chgrp(self::CONF_FILE_LIQUIDSOAP, self::CONF_PYPO_GRP);
|
||||
}
|
||||
|
||||
public static function InstallAirtimePhpServerCode($phpDir)
|
||||
{
|
||||
$AIRTIME_SRC = realpath(__DIR__.'/../../../airtime_mvc');
|
||||
|
||||
echo "* Installing PHP code to ".$phpDir.PHP_EOL;
|
||||
exec("mkdir -p ".$phpDir);
|
||||
exec("cp -R ".$AIRTIME_SRC."/* ".$phpDir);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$values = parse_ini_file(AirtimeIni194::CONF_FILE_AIRTIME, true);
|
||||
$phpDir = $values['general']['airtime_dir'];
|
||||
Airtime194Upgrade::InstallAirtimePhpServerCode($phpDir);
|
||||
Airtime194Upgrade::upgradeLiquidsoapCfgPerms();
|
|
@ -1,4 +1,3 @@
|
|||
#!/usr/local/bin/python
|
||||
import time
|
||||
import logging
|
||||
import logging.config
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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 #
|
||||
|
|
|
@ -10,6 +10,7 @@ import string
|
|||
import json
|
||||
import telnetlib
|
||||
import math
|
||||
import socket
|
||||
from threading import Thread
|
||||
from subprocess import Popen, PIPE
|
||||
from datetime import datetime
|
||||
|
@ -251,7 +252,7 @@ class PypoFetch(Thread):
|
|||
scheduled_data = dict()
|
||||
scheduled_data['liquidsoap_playlists'] = liquidsoap_playlists
|
||||
scheduled_data['schedule'] = playlists
|
||||
scheduled_data['stream_metadata'] = schedule_data["stream_metadata"]
|
||||
scheduled_data['stream_metadata'] = schedule_data["stream_metadata"]
|
||||
self.queue.put(scheduled_data)
|
||||
|
||||
# cleanup
|
||||
|
@ -425,12 +426,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():
|
||||
|
@ -455,11 +451,33 @@ class PypoFetch(Thread):
|
|||
# Wait for messages from RabbitMQ. Timeout if we
|
||||
# dont get any after POLL_INTERVAL.
|
||||
self.connection.drain_events(timeout=POLL_INTERVAL)
|
||||
except Exception, e:
|
||||
# Hooray for globals!
|
||||
schedule_data = SCHEDULE_PUSH_MSG
|
||||
status = 1
|
||||
except socket.timeout, se:
|
||||
# We didnt get a message for a while, so poll the server
|
||||
# to get an updated schedule.
|
||||
logger.info("Exception %s", e)
|
||||
status, self.schedule_data = self.api_client.get_schedule()
|
||||
self.process_schedule(self.schedule_data, "scheduler", False)
|
||||
loops += 1
|
||||
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
|
||||
|
||||
"""
|
||||
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()
|
||||
|
|
|
@ -41,13 +41,7 @@ class PypoPush(Thread):
|
|||
self.playlists = dict()
|
||||
self.stream_metadata = dict()
|
||||
|
||||
"""
|
||||
push_ahead2 MUST be < push_ahead. The difference in these two values
|
||||
gives the number of seconds of the window of opportunity for the scheduler
|
||||
to catch when a playlist is to be played.
|
||||
"""
|
||||
self.push_ahead = 10
|
||||
self.push_ahead2 = self.push_ahead -5
|
||||
|
||||
def set_export_source(self, export_source):
|
||||
self.export_source = export_source
|
||||
|
@ -77,22 +71,16 @@ class PypoPush(Thread):
|
|||
playlists = self.playlists
|
||||
|
||||
if schedule:
|
||||
playedItems = self.load_schedule_tracker()
|
||||
|
||||
timenow = time.time()
|
||||
tcoming = time.gmtime(timenow + self.push_ahead)
|
||||
str_tcoming_s = "%04d-%02d-%02d-%02d-%02d-%02d" % (tcoming[0], tcoming[1], tcoming[2], tcoming[3], tcoming[4], tcoming[5])
|
||||
|
||||
tcoming2 = time.gmtime(timenow + self.push_ahead2)
|
||||
str_tcoming2_s = "%04d-%02d-%02d-%02d-%02d-%02d" % (tcoming2[0], tcoming2[1], tcoming2[2], tcoming2[3], tcoming2[4], tcoming2[5])
|
||||
|
||||
tnow = time.gmtime(timenow)
|
||||
tcoming = time.gmtime(timenow + self.push_ahead)
|
||||
str_tnow_s = "%04d-%02d-%02d-%02d-%02d-%02d" % (tnow[0], tnow[1], tnow[2], tnow[3], tnow[4], tnow[5])
|
||||
|
||||
str_tcoming_s = "%04d-%02d-%02d-%02d-%02d-%02d" % (tcoming[0], tcoming[1], tcoming[2], tcoming[3], tcoming[4], tcoming[5])
|
||||
|
||||
for pkey in schedule:
|
||||
plstart = schedule[pkey]['start'][0:19]
|
||||
|
||||
if plstart == str_tcoming_s or (plstart < str_tcoming_s and plstart > str_tcoming2_s):
|
||||
if str_tnow_s <= plstart and plstart < str_tcoming_s:
|
||||
logger.debug('Preparing to push playlist scheduled at: %s', pkey)
|
||||
playlist = schedule[pkey]
|
||||
|
||||
|
@ -100,14 +88,6 @@ class PypoPush(Thread):
|
|||
# force liquidsoap to refresh.
|
||||
if (self.push_liquidsoap(pkey, schedule, playlists) == 1):
|
||||
logger.debug("Pushed to liquidsoap, updating 'played' status.")
|
||||
# Marked the current playlist as 'played' in the schedule tracker
|
||||
# so it is not called again in the next push loop.
|
||||
# Write changes back to tracker file.
|
||||
playedItems[pkey] = playlist
|
||||
playedItems[pkey]['played'] = 1
|
||||
schedule_tracker = open(self.schedule_tracker_file, "w")
|
||||
pickle.dump(playedItems, schedule_tracker)
|
||||
schedule_tracker.close()
|
||||
|
||||
# Call API to update schedule states
|
||||
logger.debug("Doing callback to server to update 'played' status.")
|
||||
|
@ -115,8 +95,6 @@ class PypoPush(Thread):
|
|||
|
||||
show_start = schedule[pkey]['show_start']
|
||||
show_end = schedule[pkey]['show_end']
|
||||
else:
|
||||
pass
|
||||
|
||||
def push_liquidsoap(self, pkey, schedule, playlists):
|
||||
logger = logging.getLogger('push')
|
||||
|
@ -172,29 +150,6 @@ class PypoPush(Thread):
|
|||
status = 0
|
||||
return status
|
||||
|
||||
def load_schedule_tracker(self):
|
||||
logger = logging.getLogger('push')
|
||||
playedItems = dict()
|
||||
|
||||
# create the file if it doesnt exist
|
||||
if (not os.path.exists(self.schedule_tracker_file)):
|
||||
try:
|
||||
logger.debug('creating file ' + self.schedule_tracker_file)
|
||||
schedule_tracker = open(self.schedule_tracker_file, 'w')
|
||||
pickle.dump(playedItems, schedule_tracker)
|
||||
schedule_tracker.close()
|
||||
except Exception, e:
|
||||
logger.error('Error creating schedule tracker file: %s', e)
|
||||
else:
|
||||
try:
|
||||
schedule_tracker = open(self.schedule_tracker_file, "r")
|
||||
playedItems = pickle.load(schedule_tracker)
|
||||
schedule_tracker.close()
|
||||
except Exception, e:
|
||||
logger.error('Unable to load schedule tracker file: %s', e)
|
||||
|
||||
return playedItems
|
||||
|
||||
def run(self):
|
||||
loops = 0
|
||||
heartbeat_period = math.floor(30/PUSH_INTERVAL)
|
||||
|
|
0
python_apps/python-virtualenv/3rd_party/setuptools-0.6c11-py2.6.egg
vendored
Normal file → Executable file
0
python_apps/python-virtualenv/3rd_party/setuptools-0.6c11-py2.6.egg
vendored
Normal file → Executable file
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
||||
. ${virtualenv_bin}activate
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#!/usr/local/bin/python
|
||||
import urllib
|
||||
import logging
|
||||
import logging.config
|
||||
|
@ -8,6 +7,7 @@ import datetime
|
|||
import os
|
||||
import sys
|
||||
import shutil
|
||||
import socket
|
||||
|
||||
from configobj import ConfigObj
|
||||
|
||||
|
@ -291,10 +291,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
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#!/usr/local/bin/python
|
||||
import sys
|
||||
import os
|
||||
import logging
|
||||
|
@ -85,8 +84,10 @@ def checkOtherOption(args):
|
|||
def errorIfMultipleOption(args, msg=''):
|
||||
if(checkOtherOption(args)):
|
||||
if(msg != ''):
|
||||
printHelp()
|
||||
raise OptionValueError(msg)
|
||||
else:
|
||||
printHelp()
|
||||
raise OptionValueError("This option cannot be combined with other options")
|
||||
|
||||
def printHelp():
|
||||
|
@ -121,6 +122,9 @@ There are two ways to import audio files into Airtime:
|
|||
|
||||
def CopyAction(option, opt, value, parser):
|
||||
errorIfMultipleOption(parser.rargs)
|
||||
if(len(parser.rargs) == 0 ):
|
||||
printHelp()
|
||||
raise OptionValueError("No argument found. This option requires at least one argument.")
|
||||
stor = helper_get_stor_dir()
|
||||
if(stor is None):
|
||||
exit("Unable to connect to the Airtime server.")
|
||||
|
@ -129,6 +133,9 @@ def CopyAction(option, opt, value, parser):
|
|||
|
||||
def MoveAction(option, opt, value, parser):
|
||||
errorIfMultipleOption(parser.rargs)
|
||||
if(len(parser.rargs) == 0 ):
|
||||
printHelp()
|
||||
raise OptionValueError("No argument found. This option requires at least one argument.")
|
||||
stor = helper_get_stor_dir()
|
||||
if(stor is None):
|
||||
exit("Unable to connect to the Airtime server.")
|
||||
|
@ -138,8 +145,10 @@ def MoveAction(option, opt, value, parser):
|
|||
def WatchAddAction(option, opt, value, parser):
|
||||
errorIfMultipleOption(parser.rargs)
|
||||
if(len(parser.rargs) > 1):
|
||||
printHelp()
|
||||
raise OptionValueError("Too many arguments. This option requires exactly one argument.")
|
||||
elif(len(parser.rargs) == 0 ):
|
||||
printHelp()
|
||||
raise OptionValueError("No argument found. This option requires exactly one argument.")
|
||||
path = parser.rargs[0]
|
||||
if (path[0] == "/" or path[0] == "~"):
|
||||
|
@ -162,6 +171,7 @@ def WatchAddAction(option, opt, value, parser):
|
|||
def WatchListAction(option, opt, value, parser):
|
||||
errorIfMultipleOption(parser.rargs)
|
||||
if(len(parser.rargs) > 0):
|
||||
printHelp()
|
||||
raise OptionValueError("This option doesn't take any arguments.")
|
||||
res = api_client.list_all_watched_dirs()
|
||||
if(res is None):
|
||||
|
@ -178,8 +188,10 @@ def WatchListAction(option, opt, value, parser):
|
|||
def WatchRemoveAction(option, opt, value, parser):
|
||||
errorIfMultipleOption(parser.rargs)
|
||||
if(len(parser.rargs) > 1):
|
||||
printHelp()
|
||||
raise OptionValueError("Too many arguments. This option requires exactly one argument.")
|
||||
elif(len(parser.rargs) == 0 ):
|
||||
printHelp()
|
||||
raise OptionValueError("No argument found. This option requires exactly one argument.")
|
||||
path = parser.rargs[0]
|
||||
if (path[0] == "/" or path[0] == "~"):
|
||||
|
@ -222,8 +234,10 @@ def StorageSetAction(option, opt, value, parser):
|
|||
sys.exit(1)
|
||||
|
||||
if(len(parser.rargs) > 1):
|
||||
printHelp()
|
||||
raise OptionValueError("Too many arguments. This option requires exactly one argument.")
|
||||
elif(len(parser.rargs) == 0 ):
|
||||
printHelp()
|
||||
raise OptionValueError("No argument found. This option requires exactly one argument.")
|
||||
|
||||
path = parser.rargs[0]
|
||||
|
@ -247,6 +261,7 @@ def StorageSetAction(option, opt, value, parser):
|
|||
def StorageGetAction(option, opt, value, parser):
|
||||
errorIfMultipleOption(parser.rargs)
|
||||
if(len(parser.rargs) > 0):
|
||||
printHelp()
|
||||
raise OptionValueError("This option does not take any arguments.")
|
||||
print helper_get_stor_dir()
|
||||
|
||||
|
@ -275,7 +290,7 @@ if('-l' in sys.argv or '--link' in sys.argv):
|
|||
if('-h' in sys.argv):
|
||||
printHelp()
|
||||
sys.exit()
|
||||
if(len(sys.argv) == 1):
|
||||
if(len(sys.argv) == 1 or '-' not in sys.argv[1]):
|
||||
printHelp()
|
||||
sys.exit()
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
$values = parse_ini_file('/etc/airtime/airtime.conf', true);
|
||||
|
||||
|
|
Loading…
Reference in New Issue