diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php
index 25ef8a26c..05bca3201 100644
--- a/airtime_mvc/application/controllers/ScheduleController.php
+++ b/airtime_mvc/application/controllers/ScheduleController.php
@@ -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))
diff --git a/airtime_mvc/application/models/Shows.php b/airtime_mvc/application/models/Shows.php
index ef8bf3852..fb7b3ae84 100644
--- a/airtime_mvc/application/models/Shows.php
+++ b/airtime_mvc/application/models/Shows.php
@@ -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();
}
diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php
index 7ff0bb56b..08563f98e 100644
--- a/airtime_mvc/application/models/StoredFile.php
+++ b/airtime_mvc/application/models/StoredFile.php
@@ -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();
}
/**
diff --git a/airtime_mvc/application/views/scripts/schedule/show-content-dialog.phtml b/airtime_mvc/application/views/scripts/schedule/show-content-dialog.phtml
index e1562983b..8fb4346d0 100644
--- a/airtime_mvc/application/views/scripts/schedule/show-content-dialog.phtml
+++ b/airtime_mvc/application/views/scripts/schedule/show-content-dialog.phtml
@@ -18,7 +18,7 @@
|
|
|
- |
+ |
|
diff --git a/airtime_mvc/library/php-amqplib/demo/amqp_airtime_consumer.php b/airtime_mvc/library/php-amqplib/demo/amqp_airtime_consumer.php
old mode 100644
new mode 100755
diff --git a/airtime_mvc/library/php-amqplib/demo/amqp_consumer.php b/airtime_mvc/library/php-amqplib/demo/amqp_consumer.php
old mode 100644
new mode 100755
diff --git a/airtime_mvc/library/php-amqplib/demo/amqp_publisher.php b/airtime_mvc/library/php-amqplib/demo/amqp_publisher.php
old mode 100644
new mode 100755
diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js
index 971bad119..f6b2d194c 100644
--- a/airtime_mvc/public/js/airtime/library/library.js
+++ b/airtime_mvc/public/js/airtime/library/library.js
@@ -31,6 +31,7 @@ function deleteAudioClip(json) {
}
deleteItem("au", json.id);
+ location.reload(true);
}
//callbacks called by jjmenu
diff --git a/airtime_mvc/public/js/airtime/library/spl.js b/airtime_mvc/public/js/airtime/library/spl.js
index 4f22f29e9..4187a36a0 100644
--- a/airtime_mvc/public/js/airtime/library/spl.js
+++ b/airtime_mvc/public/js/airtime/library/spl.js
@@ -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');
diff --git a/dev_tools/pl.sh b/dev_tools/pl.sh
deleted file mode 100755
index 9d3729e15..000000000
--- a/dev_tools/pl.sh
+++ /dev/null
@@ -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"
diff --git a/dev_tools/pr.sh b/dev_tools/pr.sh
deleted file mode 100755
index afb9426a9..000000000
--- a/dev_tools/pr.sh
+++ /dev/null
@@ -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"
diff --git a/dev_tools/pypoless.sh b/dev_tools/pypoless.sh
deleted file mode 100755
index 9d53be1f1..000000000
--- a/dev_tools/pypoless.sh
+++ /dev/null
@@ -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"
diff --git a/dev_tools/pypotail.sh b/dev_tools/pypotail.sh
deleted file mode 100755
index 7f83da595..000000000
--- a/dev_tools/pypotail.sh
+++ /dev/null
@@ -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"
diff --git a/install_minimal/airtime-install b/install_minimal/airtime-install
index 242725cd9..9010545c7 100755
--- a/install_minimal/airtime-install
+++ b/install_minimal/airtime-install
@@ -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
diff --git a/install_minimal/include/AirtimeIni.php b/install_minimal/include/AirtimeIni.php
index 893347920..6ba066316 100644
--- a/install_minimal/include/AirtimeIni.php
+++ b/install_minimal/include/AirtimeIni.php
@@ -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);
diff --git a/install_minimal/include/AirtimeInstall.php b/install_minimal/include/AirtimeInstall.php
index 1119db3e0..22f9dabc5 100644
--- a/install_minimal/include/AirtimeInstall.php
+++ b/install_minimal/include/AirtimeInstall.php
@@ -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);
diff --git a/install_minimal/include/airtime-install.php b/install_minimal/include/airtime-install.php
index ff4f8d731..7966994e8 100644
--- a/install_minimal/include/airtime-install.php
+++ b/install_minimal/include/airtime-install.php
@@ -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);
}
diff --git a/install_minimal/include/airtime-upgrade.php b/install_minimal/include/airtime-upgrade.php
index 4c8372f5d..333b5d8cd 100644
--- a/install_minimal/include/airtime-upgrade.php
+++ b/install_minimal/include/airtime-upgrade.php
@@ -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);
diff --git a/install_minimal/upgrades/airtime-1.9.4/airtime-upgrade.php b/install_minimal/upgrades/airtime-1.9.4/airtime-upgrade.php
new file mode 100644
index 000000000..41d35436e
--- /dev/null
+++ b/install_minimal/upgrades/airtime-1.9.4/airtime-upgrade.php
@@ -0,0 +1,29 @@
+/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
}
diff --git a/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py b/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py
index 56b320272..8bf25d0f6 100644
--- a/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py
+++ b/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py
@@ -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)
diff --git a/python_apps/media-monitor/install/media-monitor-install.py b/python_apps/media-monitor/install/media-monitor-install.py
old mode 100755
new mode 100644
diff --git a/python_apps/media-monitor/install/media-monitor-uninstall.py b/python_apps/media-monitor/install/media-monitor-uninstall.py
old mode 100755
new mode 100644
diff --git a/python_apps/pypo/airtime-liquidsoap b/python_apps/pypo/airtime-liquidsoap
index 00702853b..d2ece4db6 100755
--- a/python_apps/pypo/airtime-liquidsoap
+++ b/python_apps/pypo/airtime-liquidsoap
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
. ${virtualenv_bin}activate
diff --git a/python_apps/pypo/airtime-playout b/python_apps/pypo/airtime-playout
index a38ede950..3ef01ad2b 100755
--- a/python_apps/pypo/airtime-playout
+++ b/python_apps/pypo/airtime-playout
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
. ${virtualenv_bin}activate
diff --git a/python_apps/pypo/install/pypo-install.py b/python_apps/pypo/install/pypo-install.py
old mode 100755
new mode 100644
diff --git a/python_apps/pypo/install/pypo-uninstall.py b/python_apps/pypo/install/pypo-uninstall.py
old mode 100755
new mode 100644
diff --git a/python_apps/pypo/liquidsoap_scripts/library/tests/LS354-1.liq b/python_apps/pypo/liquidsoap_scripts/library/tests/LS354-1.liq
old mode 100755
new mode 100644
diff --git a/python_apps/pypo/liquidsoap_scripts/library/tests/LS354-2.liq b/python_apps/pypo/liquidsoap_scripts/library/tests/LS354-2.liq
old mode 100755
new mode 100644
diff --git a/python_apps/pypo/liquidsoap_scripts/notify.sh b/python_apps/pypo/liquidsoap_scripts/notify.sh
index 07a70f5d0..0f1cc73e9 100755
--- a/python_apps/pypo/liquidsoap_scripts/notify.sh
+++ b/python_apps/pypo/liquidsoap_scripts/notify.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
############################################
# just a wrapper to call the notifyer #
# needed here to keep dirs/configs clean #
diff --git a/python_apps/pypo/pypo-cli.py b/python_apps/pypo/pypo-cli.py
old mode 100755
new mode 100644
diff --git a/python_apps/pypo/pypo-notify.py b/python_apps/pypo/pypo-notify.py
old mode 100755
new mode 100644
diff --git a/python_apps/pypo/pypofetch.py b/python_apps/pypo/pypofetch.py
old mode 100755
new mode 100644
index 82269443a..28f45bc22
--- a/python_apps/pypo/pypofetch.py
+++ b/python_apps/pypo/pypofetch.py
@@ -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()
diff --git a/python_apps/pypo/pypopush.py b/python_apps/pypo/pypopush.py
old mode 100755
new mode 100644
index d9195dbe1..424613fd7
--- a/python_apps/pypo/pypopush.py
+++ b/python_apps/pypo/pypopush.py
@@ -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)
diff --git a/python_apps/pypo/test/pypo-api-validator.py b/python_apps/pypo/test/pypo-api-validator.py
old mode 100755
new mode 100644
diff --git a/python_apps/pypo/util/__init__.py b/python_apps/pypo/util/__init__.py
old mode 100755
new mode 100644
diff --git a/python_apps/pypo/util/status.py b/python_apps/pypo/util/status.py
old mode 100755
new mode 100644
diff --git a/python_apps/python-virtualenv/3rd_party/setuptools-0.6c11-py2.6.egg b/python_apps/python-virtualenv/3rd_party/setuptools-0.6c11-py2.6.egg
old mode 100644
new mode 100755
diff --git a/python_apps/show-recorder/airtime-show-recorder b/python_apps/show-recorder/airtime-show-recorder
index 4642c6322..db0165649 100755
--- a/python_apps/show-recorder/airtime-show-recorder
+++ b/python_apps/show-recorder/airtime-show-recorder
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
. ${virtualenv_bin}activate
diff --git a/python_apps/show-recorder/install/recorder-install.py b/python_apps/show-recorder/install/recorder-install.py
old mode 100755
new mode 100644
diff --git a/python_apps/show-recorder/install/recorder-uninstall.py b/python_apps/show-recorder/install/recorder-uninstall.py
old mode 100755
new mode 100644
diff --git a/python_apps/show-recorder/recorder.py b/python_apps/show-recorder/recorder.py
index 9dcd1f5ef..58c0718e7 100644
--- a/python_apps/show-recorder/recorder.py
+++ b/python_apps/show-recorder/recorder.py
@@ -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
diff --git a/utils/airtime-import/airtime-import b/utils/airtime-import/airtime-import
index ed62c8a72..b42ae7a01 100755
--- a/utils/airtime-import/airtime-import
+++ b/utils/airtime-import/airtime-import
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
. ${virtualenv_bin}activate
diff --git a/utils/airtime-import/airtime-import.py b/utils/airtime-import/airtime-import.py
index fdad11512..014428702 100644
--- a/utils/airtime-import/airtime-import.py
+++ b/utils/airtime-import/airtime-import.py
@@ -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()
diff --git a/utils/phone_home_stat.php b/utils/phone_home_stat.php
index 543779b70..1a695645b 100644
--- a/utils/phone_home_stat.php
+++ b/utils/phone_home_stat.php
@@ -1,4 +1,3 @@
-#!/usr/bin/env php