From 610b7a6d2c3fadfdd023624497a4edc729837d60 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 1 Sep 2011 16:06:01 -0400 Subject: [PATCH 01/24] CC-2747: removing debug code - done --- .../media-monitor/airtimefilemonitor/airtimemetadata.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/python_apps/media-monitor/airtimefilemonitor/airtimemetadata.py b/python_apps/media-monitor/airtimefilemonitor/airtimemetadata.py index a57e44507..8214aadf8 100644 --- a/python_apps/media-monitor/airtimefilemonitor/airtimemetadata.py +++ b/python_apps/media-monitor/airtimefilemonitor/airtimemetadata.py @@ -161,9 +161,6 @@ class AirtimeMetadata: self.logger.error("Exception %s", e) return None - - self.logger.info("sDFSDFSDF") - self.logger.info(file_info) if file_info is None: return None #check if file has any metadata From 03efb8f293fb7a3e85d71e7ce05b76d124c20e90 Mon Sep 17 00:00:00 2001 From: martin Date: Tue, 6 Sep 2011 19:06:13 -0400 Subject: [PATCH 02/24] CC-2760: Remove shebangs from files that don't need them, fix chmod of files -done --- .../php-amqplib/demo/amqp_airtime_consumer.php | 0 .../library/php-amqplib/demo/amqp_consumer.php | 0 .../library/php-amqplib/demo/amqp_publisher.php | 0 .../3rd_party/setuptools-0.6c11-py2.6.egg | Bin python_apps/api_clients/api_client.py | 0 python_apps/media-monitor/MediaMonitor.py | 1 - .../media-monitor/install/media-monitor-install.py | 0 .../install/media-monitor-uninstall.py | 0 python_apps/pypo/install/pypo-install.py | 0 python_apps/pypo/install/pypo-uninstall.py | 0 .../liquidsoap_scripts/library/tests/LS354-1.liq | 0 .../liquidsoap_scripts/library/tests/LS354-2.liq | 0 python_apps/pypo/pypo-cli.py | 0 python_apps/pypo/pypo-notify.py | 0 python_apps/pypo/pypofetch.py | 0 python_apps/pypo/pypopush.py | 0 python_apps/pypo/test/pypo-api-validator.py | 0 python_apps/pypo/util/__init__.py | 0 python_apps/pypo/util/status.py | 0 .../show-recorder/install/recorder-install.py | 0 .../show-recorder/install/recorder-uninstall.py | 0 python_apps/show-recorder/recorder.py | 1 - utils/airtime-import/airtime-import.py | 1 - utils/airtime-user.php | 0 utils/phone_home_stat.php | 0 utils/rivendell-converter.sh | 0 utils/serbianLatinToCyrillicConverter.py | 0 27 files changed, 3 deletions(-) mode change 100644 => 100755 airtime_mvc/library/php-amqplib/demo/amqp_airtime_consumer.php mode change 100644 => 100755 airtime_mvc/library/php-amqplib/demo/amqp_consumer.php mode change 100644 => 100755 airtime_mvc/library/php-amqplib/demo/amqp_publisher.php mode change 100644 => 100755 install_minimal/3rd_party/setuptools-0.6c11-py2.6.egg mode change 100644 => 100755 python_apps/api_clients/api_client.py mode change 100755 => 100644 python_apps/media-monitor/install/media-monitor-install.py mode change 100755 => 100644 python_apps/media-monitor/install/media-monitor-uninstall.py mode change 100755 => 100644 python_apps/pypo/install/pypo-install.py mode change 100755 => 100644 python_apps/pypo/install/pypo-uninstall.py mode change 100755 => 100644 python_apps/pypo/liquidsoap_scripts/library/tests/LS354-1.liq mode change 100755 => 100644 python_apps/pypo/liquidsoap_scripts/library/tests/LS354-2.liq mode change 100755 => 100644 python_apps/pypo/pypo-cli.py mode change 100755 => 100644 python_apps/pypo/pypo-notify.py mode change 100755 => 100644 python_apps/pypo/pypofetch.py mode change 100755 => 100644 python_apps/pypo/pypopush.py mode change 100755 => 100644 python_apps/pypo/test/pypo-api-validator.py mode change 100755 => 100644 python_apps/pypo/util/__init__.py mode change 100755 => 100644 python_apps/pypo/util/status.py mode change 100755 => 100644 python_apps/show-recorder/install/recorder-install.py mode change 100755 => 100644 python_apps/show-recorder/install/recorder-uninstall.py mode change 100644 => 100755 utils/airtime-user.php mode change 100644 => 100755 utils/phone_home_stat.php mode change 100644 => 100755 utils/rivendell-converter.sh mode change 100755 => 100644 utils/serbianLatinToCyrillicConverter.py 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/install_minimal/3rd_party/setuptools-0.6c11-py2.6.egg b/install_minimal/3rd_party/setuptools-0.6c11-py2.6.egg old mode 100644 new mode 100755 diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py old mode 100644 new mode 100755 diff --git a/python_apps/media-monitor/MediaMonitor.py b/python_apps/media-monitor/MediaMonitor.py index dadb1e65e..16f27a495 100644 --- a/python_apps/media-monitor/MediaMonitor.py +++ b/python_apps/media-monitor/MediaMonitor.py @@ -1,4 +1,3 @@ -#!/usr/local/bin/python import time import logging import logging.config 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/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/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 diff --git a/python_apps/pypo/pypopush.py b/python_apps/pypo/pypopush.py old mode 100755 new mode 100644 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/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 22bf64452..681f8c831 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 diff --git a/utils/airtime-import/airtime-import.py b/utils/airtime-import/airtime-import.py index fdad11512..0c9b02d89 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 diff --git a/utils/airtime-user.php b/utils/airtime-user.php old mode 100644 new mode 100755 diff --git a/utils/phone_home_stat.php b/utils/phone_home_stat.php old mode 100644 new mode 100755 diff --git a/utils/rivendell-converter.sh b/utils/rivendell-converter.sh old mode 100644 new mode 100755 diff --git a/utils/serbianLatinToCyrillicConverter.py b/utils/serbianLatinToCyrillicConverter.py old mode 100755 new mode 100644 From b73016550b0a01381c970895c622c24786fc931e Mon Sep 17 00:00:00 2001 From: james Date: Wed, 7 Sep 2011 17:30:25 -0400 Subject: [PATCH 03/24] CC-2265: Date Start is not updated after dragging show to new day - fixed --- .../controllers/ScheduleController.php | 4 +-- airtime_mvc/application/models/Shows.php | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index 953cfee52..793dcbfff 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 1311b837a..b6185c094 100644 --- a/airtime_mvc/application/models/Shows.php +++ b/airtime_mvc/application/models/Shows.php @@ -1262,6 +1262,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 { @@ -1464,6 +1482,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(); } From a20bdb941cbc9a2152ad9aef15c03335bd0ef545 Mon Sep 17 00:00:00 2001 From: martin Date: Wed, 7 Sep 2011 17:50:00 -0400 Subject: [PATCH 04/24] CC-2260: Liquidsoap and Show contents window do not respect cue-out point -fixed --- .../views/scripts/schedule/show-content-dialog.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 c830dd3da..f95a9def0 100644 --- a/airtime_mvc/application/views/scripts/schedule/show-content-dialog.phtml +++ b/airtime_mvc/application/views/scripts/schedule/show-content-dialog.phtml @@ -16,7 +16,7 @@ - + From b2db168a10c9a2a933edf3096a170138d1e8d659 Mon Sep 17 00:00:00 2001 From: martin Date: Wed, 7 Sep 2011 18:12:46 -0400 Subject: [PATCH 05/24] CC-2720: Should utils scripts have a shebang and/or be marked executable -fixed. scripts should not be have exec bit set. --- utils/airtime-user.php | 0 utils/phone_home_stat.php | 1 - 2 files changed, 1 deletion(-) mode change 100755 => 100644 utils/airtime-user.php mode change 100755 => 100644 utils/phone_home_stat.php diff --git a/utils/airtime-user.php b/utils/airtime-user.php old mode 100755 new mode 100644 diff --git a/utils/phone_home_stat.php b/utils/phone_home_stat.php old mode 100755 new mode 100644 index 543779b70..1a695645b --- a/utils/phone_home_stat.php +++ b/utils/phone_home_stat.php @@ -1,4 +1,3 @@ -#!/usr/bin/env php Date: Thu, 8 Sep 2011 09:20:16 -0400 Subject: [PATCH 06/24] CC-2659: Print help for airtime-import when a copy or move switch is not provided - fixed --- utils/airtime-import/airtime-import | 3 ++- utils/airtime-import/airtime-import.py | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/utils/airtime-import/airtime-import b/utils/airtime-import/airtime-import index ed62c8a72..771b7bb51 100755 --- a/utils/airtime-import/airtime-import +++ b/utils/airtime-import/airtime-import @@ -5,7 +5,8 @@ virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/" invokePwd=$PWD -airtime_import_path="/usr/lib/airtime/utils/airtime-import/" +#airtime_import_path="/usr/lib/airtime/utils/airtime-import/" +airtime_import_path="/home/james/src/airtime/utils/airtime-import/" airtime_import_script="airtime-import.py" api_client_path="/usr/lib/airtime/" diff --git a/utils/airtime-import/airtime-import.py b/utils/airtime-import/airtime-import.py index 0c9b02d89..c309be720 100644 --- a/utils/airtime-import/airtime-import.py +++ b/utils/airtime-import/airtime-import.py @@ -120,6 +120,8 @@ There are two ways to import audio files into Airtime: def CopyAction(option, opt, value, parser): errorIfMultipleOption(parser.rargs) + if(len(parser.rargs) == 0 ): + 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.") @@ -128,6 +130,8 @@ def CopyAction(option, opt, value, parser): def MoveAction(option, opt, value, parser): errorIfMultipleOption(parser.rargs) + if(len(parser.rargs) == 0 ): + 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.") @@ -274,7 +278,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() From 4e6cb7e0bed4feef3e1ee433262894703e8fb557 Mon Sep 17 00:00:00 2001 From: james Date: Thu, 8 Sep 2011 09:20:58 -0400 Subject: [PATCH 07/24] CC-2659: removing debug code - done --- utils/airtime-import/airtime-import | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/utils/airtime-import/airtime-import b/utils/airtime-import/airtime-import index 771b7bb51..ed62c8a72 100755 --- a/utils/airtime-import/airtime-import +++ b/utils/airtime-import/airtime-import @@ -5,8 +5,7 @@ virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/" invokePwd=$PWD -#airtime_import_path="/usr/lib/airtime/utils/airtime-import/" -airtime_import_path="/home/james/src/airtime/utils/airtime-import/" +airtime_import_path="/usr/lib/airtime/utils/airtime-import/" airtime_import_script="airtime-import.py" api_client_path="/usr/lib/airtime/" From 6dab211a12163df67103c8fb2f7ad97c2a80ac9d Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 8 Sep 2011 12:17:42 -0400 Subject: [PATCH 08/24] CC-2784: Stopping rabbitmq-server causes pypo CPU usage to increase dramatically -fixed --- .../airtime-media-monitor-init-d | 4 +-- .../airtimefilemonitor/airtimeprocessevent.py | 12 +++---- python_apps/monit/airtime-monit.cfg | 8 ++--- python_apps/pypo/pypofetch.py | 31 ++++++++++++++----- python_apps/show-recorder/recorder.py | 7 +++-- 5 files changed, 39 insertions(+), 23 deletions(-) diff --git a/python_apps/media-monitor/airtime-media-monitor-init-d b/python_apps/media-monitor/airtime-media-monitor-init-d index 38dc92895..8bf311161 100755 --- a/python_apps/media-monitor/airtime-media-monitor-init-d +++ b/python_apps/media-monitor/airtime-media-monitor-init-d @@ -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 } 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/monit/airtime-monit.cfg b/python_apps/monit/airtime-monit.cfg index 22f05e2ca..647fffd10 100644 --- a/python_apps/monit/airtime-monit.cfg +++ b/python_apps/monit/airtime-monit.cfg @@ -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 diff --git a/python_apps/pypo/pypofetch.py b/python_apps/pypo/pypofetch.py index 5edc3f4f3..6c531cabd 100644 --- a/python_apps/pypo/pypofetch.py +++ b/python_apps/pypo/pypofetch.py @@ -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() diff --git a/python_apps/show-recorder/recorder.py b/python_apps/show-recorder/recorder.py index 681f8c831..2a6305944 100644 --- a/python_apps/show-recorder/recorder.py +++ b/python_apps/show-recorder/recorder.py @@ -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 From 805e358d9cdf6dd03807c9a8d5abefb46eaef66e Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 8 Sep 2011 12:36:51 -0400 Subject: [PATCH 09/24] CC-2788: Airtime uses both /bin/bash and /bin/sh in different scripts -fixed --- dev_tools/pl.sh | 5 ----- dev_tools/pr.sh | 7 ------- dev_tools/pypoless.sh | 7 ------- dev_tools/pypotail.sh | 7 ------- python_apps/media-monitor/airtime-media-monitor | 2 +- python_apps/pypo/airtime-liquidsoap | 2 +- python_apps/pypo/airtime-playout | 2 +- python_apps/show-recorder/airtime-show-recorder | 2 +- utils/airtime-import/airtime-import | 2 +- 9 files changed, 5 insertions(+), 31 deletions(-) delete mode 100755 dev_tools/pl.sh delete mode 100755 dev_tools/pr.sh delete mode 100755 dev_tools/pypoless.sh delete mode 100755 dev_tools/pypotail.sh 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/python_apps/media-monitor/airtime-media-monitor b/python_apps/media-monitor/airtime-media-monitor index 4b79d892a..ac45bde13 100755 --- a/python_apps/media-monitor/airtime-media-monitor +++ b/python_apps/media-monitor/airtime-media-monitor @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Location of pypo_cli.py Python script 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/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/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 From 611630d4ebd4952afa7edd03ceb747174d1c0aaa Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 8 Sep 2011 13:44:33 -0400 Subject: [PATCH 10/24] CC-2788: Airtime uses both /bin/bash and /bin/sh in different scripts -forgot notify.sh --- python_apps/pypo/liquidsoap_scripts/notify.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 # From eed9aa5b887765904f9fe5008f530e0e99e97eb0 Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 8 Sep 2011 14:12:04 -0400 Subject: [PATCH 11/24] CC-2725: /etc/airtime/liquidsoap.cfg should not be world-readable -done --- install_minimal/include/AirtimeIni.php | 11 ++++++++++- .../upgrades/airtime-1.9.4/airtime-upgrade.php | 15 +++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 install_minimal/upgrades/airtime-1.9.4/airtime-upgrade.php diff --git a/install_minimal/include/AirtimeIni.php b/install_minimal/include/AirtimeIni.php index be81a9226..e2a70d55a 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,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); 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..888b0a7f9 --- /dev/null +++ b/install_minimal/upgrades/airtime-1.9.4/airtime-upgrade.php @@ -0,0 +1,15 @@ + Date: Thu, 8 Sep 2011 15:09:12 -0400 Subject: [PATCH 12/24] CC-2622: stop current play song, when item is removed from thie list - fixed --- airtime_mvc/public/js/airtime/library/spl.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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'); From 23d91620951711e476e4a5bfc650b8ed3b5bf9fc Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 8 Sep 2011 15:10:33 -0400 Subject: [PATCH 13/24] CC-2796: airtime-install script has error exit 2 even when upgrade has gone perfectly -fixed --- install_minimal/airtime-install | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/install_minimal/airtime-install b/install_minimal/airtime-install index d1e5afa67..35dc7a803 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 @@ -17,7 +21,9 @@ 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 EXTRAOPTION=$(virtualenv --help | grep extra-search-dir) + set -e if [ "$?" -eq "0" ]; then sudo virtualenv --extra-search-dir=${SCRIPTPATH}/3rd_party --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv @@ -50,10 +56,6 @@ fi virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/" . ${virtualenv_bin}activate -#Cause bash script to exit if any of the installers -#return with a non-zero return value. -set -e - echo -e "\n*** Creating Pypo User ***" python ${SCRIPTPATH}/../python_apps/create-pypo-user.py From 53306dffa4c56646fac73d7b0b8798f56fee0d68 Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 8 Sep 2011 15:18:54 -0400 Subject: [PATCH 14/24] -update version string to 1.9.4 --- VERSION | 2 +- airtime_mvc/application/configs/constants.php | 2 +- install_minimal/include/airtime-upgrade.php | 4 +++- python_apps/api_clients/api_client.py | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 99c973071..753715b20 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ PRODUCT_ID=Airtime -PRODUCT_RELEASE=1.9.3 +PRODUCT_RELEASE=1.9.4 diff --git a/airtime_mvc/application/configs/constants.php b/airtime_mvc/application/configs/constants.php index e9e72fc20..c9f0132f7 100644 --- a/airtime_mvc/application/configs/constants.php +++ b/airtime_mvc/application/configs/constants.php @@ -1,6 +1,6 @@ Date: Thu, 8 Sep 2011 15:28:38 -0400 Subject: [PATCH 15/24] CC-2796: airtime-install script has error exit 2 even when upgrade has gone perfectly -fixed --- install_minimal/airtime-install | 9 +++++++++ install_minimal/include/airtime-install.php | 3 --- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/install_minimal/airtime-install b/install_minimal/airtime-install index 35dc7a803..fa3e3502b 100755 --- a/install_minimal/airtime-install +++ b/install_minimal/airtime-install @@ -59,7 +59,16 @@ virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/" echo -e "\n*** Creating Pypo User ***" python ${SCRIPTPATH}/../python_apps/create-pypo-user.py +set +e php ${SCRIPTPATH}/include/airtime-install.php $@ +if [ "$?" -eq "2" ]; then + #We've just finished an upgrade, so let's exit + exit 0 +elif [ "$?" != "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/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); } From 1114494ace59071631e3a415180fcd246f527049 Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 9 Sep 2011 10:21:43 -0400 Subject: [PATCH 16/24] -fix installer --- install_minimal/airtime-install | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/install_minimal/airtime-install b/install_minimal/airtime-install index fa3e3502b..e35888010 100755 --- a/install_minimal/airtime-install +++ b/install_minimal/airtime-install @@ -22,10 +22,11 @@ VIRTUAL_ENV_SHARE="/usr/share/python-virtualenv/" if [ ! -d "$VIRTUAL_ENV_DIR" ]; then echo -e "\n*** Creating Virtualenv for Airtime ***" set +e - EXTRAOPTION=$(virtualenv --help | grep extra-search-dir) + virtualenv --help | grep extra-search-dir + EXTRAOPTION=$? set -e - if [ "$?" -eq "0" ]; then + 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/ From 77068086b05d5ed73d38ca60d8ee569cb63e3401 Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 9 Sep 2011 10:34:30 -0400 Subject: [PATCH 17/24] -fix install issue --- install_minimal/airtime-install | 5 +++-- install_minimal/include/AirtimeInstall.php | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/install_minimal/airtime-install b/install_minimal/airtime-install index e35888010..fe50d4a53 100755 --- a/install_minimal/airtime-install +++ b/install_minimal/airtime-install @@ -62,10 +62,11 @@ python ${SCRIPTPATH}/../python_apps/create-pypo-user.py set +e php ${SCRIPTPATH}/include/airtime-install.php $@ -if [ "$?" -eq "2" ]; then +$result=$? +if [ "$result" -eq "2" ]; then #We've just finished an upgrade, so let's exit exit 0 -elif [ "$?" != "0" ]; then +elif [ "$result" -ne "0" ]; then #There was an error, exit with error code. exit 1 fi diff --git a/install_minimal/include/AirtimeInstall.php b/install_minimal/include/AirtimeInstall.php index e11dd7cf2..5bce8ff37 100644 --- a/install_minimal/include/AirtimeInstall.php +++ b/install_minimal/include/AirtimeInstall.php @@ -352,6 +352,7 @@ class AirtimeInstall exec("rm -f /usr/bin/airtime-import"); exec("rm -f /usr/bin/airtime-update-db-settings"); exec("rm -f /usr/bin/airtime-check-system"); + exec("rm -f /usr/bin/airtime-user"); } public static function InstallPhpCode() @@ -432,6 +433,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); From 522ce0b7fbee68ff0b7e9c600914429b12851b0a Mon Sep 17 00:00:00 2001 From: James Date: Fri, 9 Sep 2011 11:04:14 -0400 Subject: [PATCH 18/24] CC-2659: print help on more cases - done --- utils/airtime-import/airtime-import.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/utils/airtime-import/airtime-import.py b/utils/airtime-import/airtime-import.py index c309be720..014428702 100644 --- a/utils/airtime-import/airtime-import.py +++ b/utils/airtime-import/airtime-import.py @@ -84,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 +123,7 @@ 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): @@ -131,6 +134,7 @@ 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): @@ -141,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] == "~"): @@ -165,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): @@ -181,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] == "~"): @@ -225,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] @@ -250,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() From 8239588a9587157c92e38e46985d7223c14db525 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 9 Sep 2011 11:35:30 -0400 Subject: [PATCH 19/24] CC-2798: Delete a song from the playlist builder doesn't refesh the list - fixed --- airtime_mvc/public/js/airtime/library/library.js | 1 + 1 file changed, 1 insertion(+) 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 From 8b09f82aa32277820fe5e9216ecaa512719929f6 Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 9 Sep 2011 11:45:19 -0400 Subject: [PATCH 20/24] -when returning a file url for download, use the server address that the server was contacted with. --- airtime_mvc/application/models/StoredFile.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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(); } /** From ace98569ed9213adf856b7cfe28f89d5b86a8b8e Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 9 Sep 2011 14:11:56 -0400 Subject: [PATCH 21/24] CC-2783: Investigate Pypo taking 100% CPU on production system -fixed --- python_apps/pypo/pypofetch.py | 2 +- python_apps/pypo/pypopush.py | 41 +---------------------------------- 2 files changed, 2 insertions(+), 41 deletions(-) diff --git a/python_apps/pypo/pypofetch.py b/python_apps/pypo/pypofetch.py index 6c531cabd..544312773 100644 --- a/python_apps/pypo/pypofetch.py +++ b/python_apps/pypo/pypofetch.py @@ -178,7 +178,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 diff --git a/python_apps/pypo/pypopush.py b/python_apps/pypo/pypopush.py index a4cc46282..cbce20e43 100644 --- a/python_apps/pypo/pypopush.py +++ b/python_apps/pypo/pypopush.py @@ -82,8 +82,6 @@ class PypoPush(Thread): currently_on_air = False if schedule: - playedItems = self.load_schedule_tracker() - timenow = time.time() tcoming = time.localtime(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]) @@ -96,12 +94,8 @@ class PypoPush(Thread): for pkey in schedule: plstart = schedule[pkey]['start'][0:19] - #plstart = pkey[0:19] - #playedFlag = (pkey in playedItems) and playedItems[pkey].get("played", 0) - playedFlag = False - - if plstart == str_tcoming_s or (plstart < str_tcoming_s and plstart > str_tcoming2_s and not playedFlag): + if plstart == str_tcoming_s or (plstart < str_tcoming_s and plstart > str_tcoming2_s): logger.debug('Preparing to push playlist scheduled at: %s', pkey) playlist = schedule[pkey] @@ -111,14 +105,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.") @@ -129,8 +115,6 @@ class PypoPush(Thread): if show_start <= str_tnow_s and str_tnow_s < show_end: currently_on_air = True - else: - pass if not currently_on_air and self.liquidsoap_state_play: logger.debug('Notifying Liquidsoap to stop playback.') @@ -202,29 +186,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) From ca292635798e929bf08f9d6452b40e0f761b4823 Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 9 Sep 2011 14:30:44 -0400 Subject: [PATCH 22/24] CC-2794: Upgrade script for 1.9.4 -fixed --- .../upgrades/airtime-1.9.4/airtime-upgrade.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/install_minimal/upgrades/airtime-1.9.4/airtime-upgrade.php b/install_minimal/upgrades/airtime-1.9.4/airtime-upgrade.php index 888b0a7f9..41d35436e 100644 --- a/install_minimal/upgrades/airtime-1.9.4/airtime-upgrade.php +++ b/install_minimal/upgrades/airtime-1.9.4/airtime-upgrade.php @@ -3,13 +3,27 @@ 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(); From f1c77845eafc6969b674fa05c9ccca01ebca69af Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 9 Sep 2011 14:49:12 -0400 Subject: [PATCH 23/24] CC-2783: Investigate Pypo taking 100% CPU on production system -fixed --- python_apps/pypo/pypopush.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/python_apps/pypo/pypopush.py b/python_apps/pypo/pypopush.py index cbce20e43..21d2a42b9 100644 --- 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 #toggle between "stop" and "play". Keeps track of the state of #liquidsoap @@ -86,16 +80,13 @@ class PypoPush(Thread): tcoming = time.localtime(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.localtime(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.localtime(timenow) str_tnow_s = "%04d-%02d-%02d-%02d-%02d-%02d" % (tnow[0], tnow[1], tnow[2], tnow[3], tnow[4], tnow[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] From de753bcb49a64a56199c2d3cf7810d5b8e6ed953 Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 9 Sep 2011 14:49:25 -0400 Subject: [PATCH 24/24] -fix installer warning --- install_minimal/airtime-install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_minimal/airtime-install b/install_minimal/airtime-install index fe50d4a53..bc0e66ae1 100755 --- a/install_minimal/airtime-install +++ b/install_minimal/airtime-install @@ -62,7 +62,7 @@ python ${SCRIPTPATH}/../python_apps/create-pypo-user.py set +e php ${SCRIPTPATH}/include/airtime-install.php $@ -$result=$? +result=$? if [ "$result" -eq "2" ]; then #We've just finished an upgrade, so let's exit exit 0