From 42fbab9ff760ea7fc8ddc6e49bd0e2e7308d8bf2 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 30 Apr 2012 12:17:25 -0400 Subject: [PATCH 01/17] CC-3738: Installation: Errors on installation -also commented out code --- install_minimal/include/airtime-copy-files.sh | 7 +++---- install_minimal/include/airtime-initialize.sh | 4 ---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/install_minimal/include/airtime-copy-files.sh b/install_minimal/include/airtime-copy-files.sh index 62ac6524a..e173842d9 100755 --- a/install_minimal/include/airtime-copy-files.sh +++ b/install_minimal/include/airtime-copy-files.sh @@ -35,7 +35,9 @@ AIRTIMEROOT=$SCRIPTPATH/../../ echo "* Creating /etc/airtime" mkdir -p /etc/airtime -if [ ! -e /etc/airtime/airtime.conf ]; then +#if [ ! -e /etc/airtime/airtime.conf ]; then +if [ "$DO_UPGRADE" -eq "0" ]; then + #We aren't doing an upgrade so simply overwrite the config files. cp $AIRTIMEROOT/airtime_mvc/build/airtime.conf /etc/airtime fi @@ -62,9 +64,6 @@ if [ "$python_service" -eq "0" ]; then if [ "$pypo" = "t" ]; then python $AIRTIMEROOT/python_apps/pypo/install/pypo-copy-files.py fi - #if [ "$showrecorder" = "t" ]; then - # python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-copy-files.py - #fi fi mkdir -p /usr/lib/airtime diff --git a/install_minimal/include/airtime-initialize.sh b/install_minimal/include/airtime-initialize.sh index 5383ff311..d3d6cdfed 100755 --- a/install_minimal/include/airtime-initialize.sh +++ b/install_minimal/include/airtime-initialize.sh @@ -36,10 +36,6 @@ fi if [ "$pypo" = "t" ]; then python $AIRTIMEROOT/python_apps/pypo/install/pypo-initialize.py fi -#if [ "$showrecorder" = "t" ]; then -# python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-initialize.py -#fi - # Start monit if it is not running, or restart if it is. # Need to ensure monit is running before Airtime daemons are run. This is From c6337793523347f069c75ec54d20f2effbd98c52 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 30 Apr 2012 12:25:05 -0400 Subject: [PATCH 02/17] -better comment in airtime-installed-check.php --- install_minimal/include/airtime-installed-check.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install_minimal/include/airtime-installed-check.php b/install_minimal/include/airtime-installed-check.php index e4ad0bbf9..f65f44bbf 100644 --- a/install_minimal/include/airtime-installed-check.php +++ b/install_minimal/include/airtime-installed-check.php @@ -15,6 +15,8 @@ require_once(__DIR__.'/airtime-constants.php'); AirtimeInstall::ExitIfNotRoot(); if (!file_exists('/etc/airtime/airtime.conf')) { + #airtime.conf doesn't exist, and we need it to connect to database + #Assume Airtime is not installed. return 0; } From db2ccb1859cfc6a487de232a49047ef00b1a67e1 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 30 Apr 2012 15:48:36 -0400 Subject: [PATCH 03/17] CC-3736: Full Install fail at Ubuntu 12.04: virtualenv problem -pip no longer supports and we don't need the -E (environment) option --- python_apps/python-virtualenv/virtualenv-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_apps/python-virtualenv/virtualenv-install.sh b/python_apps/python-virtualenv/virtualenv-install.sh index 757d22008..152492be5 100755 --- a/python_apps/python-virtualenv/virtualenv-install.sh +++ b/python_apps/python-virtualenv/virtualenv-install.sh @@ -49,7 +49,7 @@ else fi echo -e "\n*** Installing Python Libraries ***" -/usr/lib/airtime/airtime_virtualenv/bin/pip install ${SCRIPTPATH}/airtime_virtual_env.pybundle -E /usr/lib/airtime/airtime_virtualenv || exit 1 +/usr/lib/airtime/airtime_virtualenv/bin/pip install ${SCRIPTPATH}/airtime_virtual_env.pybundle || exit 1 echo -e "\n*** Patching Python Libraries ***" PATCHES=${SCRIPTPATH}/patches/* From 4477ac02e7afd575c64be2b336e694881cdd1be6 Mon Sep 17 00:00:00 2001 From: denise Date: Mon, 30 Apr 2012 16:20:23 -0400 Subject: [PATCH 04/17] CC-3677: Tooltips improvements -done --- airtime_mvc/application/models/StoredFile.php | 2 +- airtime_mvc/public/js/airtime/showbuilder/builder.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index fcac1a8db..a63cf2703 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -686,7 +686,7 @@ Logging::log("getting media! - 2"); if($type == "au"){//&& isset( $audioResults )) { $row['audioFile'] = $row['gunid'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION); - $row['image'] = ''; + $row['image'] = ''; } else { $row['image'] = ''; diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js index 4a115b120..19cc42d9c 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/builder.js +++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js @@ -409,7 +409,7 @@ var AIRTIME = (function(AIRTIME){ $image = $(nRow).find('td.sb-image'); //check if the file exists. if (aData.image === true) { - $image.html('') + $image.html('') .click(function() { open_show_preview(aData.instance, aData.pos); return false; From 141d27bf27d06a2b747cfc71d0582b611d2ac2d0 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 30 Apr 2012 17:06:35 -0400 Subject: [PATCH 05/17] CC-3736: Full Install fail at Ubuntu 12.04 -various fixes --- python_apps/api_clients/api_client.py | 3 --- .../media-monitor/airtimefilemonitor/mediamonitorcommon.py | 1 - python_apps/pypo/install/pypo-initialize.py | 4 +++- python_apps/python-virtualenv/virtualenv-install.sh | 6 +++--- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index c98b0358c..b2aa1d586 100755 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -1,6 +1,3 @@ -#!/usr/bin/env python2.6 -# -*- coding: utf-8 -*- - ############################################################################### # This file holds the implementations for all the API clients. # diff --git a/python_apps/media-monitor/airtimefilemonitor/mediamonitorcommon.py b/python_apps/media-monitor/airtimefilemonitor/mediamonitorcommon.py index 7a6e833c1..b28b1dfcd 100644 --- a/python_apps/media-monitor/airtimefilemonitor/mediamonitorcommon.py +++ b/python_apps/media-monitor/airtimefilemonitor/mediamonitorcommon.py @@ -64,7 +64,6 @@ class MediaMonitorCommon: except IOError: self.logger.warn("File does not have correct permissions: '%s'", filepath) readable = False - self.logger.error("traceback: %s", traceback.format_exc()) except Exception, e: self.logger.error("Unexpected exception thrown: %s", e) readable = False diff --git a/python_apps/pypo/install/pypo-initialize.py b/python_apps/pypo/install/pypo-initialize.py index 10d9d9bcd..79cf8a396 100644 --- a/python_apps/pypo/install/pypo-initialize.py +++ b/python_apps/pypo/install/pypo-initialize.py @@ -100,10 +100,12 @@ try: print e sys.exit(1) + logging.basicConfig(format='%(asctime) %(message)s') + logger = logging.getLogger() #generate liquidsoap config file #access the DB and generate liquidsoap.cfg under /etc/airtime/ - ac = api_client.api_client_factory(config) + ac = api_client.api_client_factory(config, logger) ss = ac.get_stream_setting() if ss is not None: diff --git a/python_apps/python-virtualenv/virtualenv-install.sh b/python_apps/python-virtualenv/virtualenv-install.sh index 152492be5..47769ba89 100755 --- a/python_apps/python-virtualenv/virtualenv-install.sh +++ b/python_apps/python-virtualenv/virtualenv-install.sh @@ -38,14 +38,14 @@ echo -e "\n*** Creating Virtualenv for Airtime ***" EXTRAOPTION=$(virtualenv --help | grep extra-search-dir) if [ "$?" -eq "0" ]; then - virtualenv --extra-search-dir=${SCRIPTPATH}/3rd_party --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv 2>/dev/null || exit 1 + virtualenv --extra-search-dir=${SCRIPTPATH}/3rd_party --no-site-package -p /usr/bin/python /usr/lib/airtime/airtime_virtualenv 2>/dev/null || exit 1 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 - virtualenv --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv 2>/dev/null || exit 1 + virtualenv --no-site-package -p /usr/bin/python /usr/lib/airtime/airtime_virtualenv 2>/dev/null || exit 1 fi echo -e "\n*** Installing Python Libraries ***" @@ -58,7 +58,7 @@ if [ -d $file ]; then DIRNAME=$(basename $file) echo -e "\n ---Applying Patches for $DIRNAME---" else - patch -N -p0 -i $file + patch -N -p7 -i $file -d /usr/lib/airtime/airtime_virtualenv/lib/python2.7/ fi done exit 0 From c84acdfea65744f109a556dfd3a8a5c6926b7ac5 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 30 Apr 2012 17:10:12 -0400 Subject: [PATCH 06/17] CC-3736: Full Install fail at Ubuntu 12.04 -Forgot some imports --- python_apps/pypo/install/pypo-initialize.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python_apps/pypo/install/pypo-initialize.py b/python_apps/pypo/install/pypo-initialize.py index 79cf8a396..fa077fb78 100644 --- a/python_apps/pypo/install/pypo-initialize.py +++ b/python_apps/pypo/install/pypo-initialize.py @@ -7,6 +7,9 @@ sys.path.append('/usr/lib/airtime/') from api_clients import api_client from configobj import ConfigObj +import logging +import logging.basicConfig + if os.geteuid() != 0: print "Please run this as root." sys.exit(1) From 234ee0f696a9c9f0f53e20e0a278d14eefc0c7ec Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 30 Apr 2012 17:13:52 -0400 Subject: [PATCH 07/17] CC-3736: Full Install fail at Ubuntu 12.04 --- install_full/ubuntu/airtime-full-install | 2 +- python_apps/pypo/install/pypo-initialize.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/install_full/ubuntu/airtime-full-install b/install_full/ubuntu/airtime-full-install index 7f2892500..613f9ba5b 100755 --- a/install_full/ubuntu/airtime-full-install +++ b/install_full/ubuntu/airtime-full-install @@ -35,7 +35,7 @@ apt-get update # Updated package list apt-get -y install tar gzip curl apache2 php5-pgsql libapache2-mod-php5 \ -php-pear php5-gd postgresql odbc-postgresql python2.6 libsoundtouch-ocaml \ +php-pear php5-gd postgresql odbc-postgresql python libsoundtouch-ocaml \ libtaglib-ocaml libao-ocaml libmad-ocaml ecasound \ libesd0 libportaudio2 libsamplerate0 rabbitmq-server patch \ php5-curl mpg123 monit python-virtualenv multitail libcamomile-ocaml-data \ diff --git a/python_apps/pypo/install/pypo-initialize.py b/python_apps/pypo/install/pypo-initialize.py index fa077fb78..ec6867ad0 100644 --- a/python_apps/pypo/install/pypo-initialize.py +++ b/python_apps/pypo/install/pypo-initialize.py @@ -8,7 +8,6 @@ from api_clients import api_client from configobj import ConfigObj import logging -import logging.basicConfig if os.geteuid() != 0: print "Please run this as root." From f59bae42463a921407e058c2d317a6a2a7ab47c4 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 30 Apr 2012 17:26:04 -0400 Subject: [PATCH 08/17] CC-3736: Full Install fail at Ubuntu 12.04 -Fix logger format --- python_apps/pypo/install/pypo-initialize.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/python_apps/pypo/install/pypo-initialize.py b/python_apps/pypo/install/pypo-initialize.py index ec6867ad0..daccc8d9c 100644 --- a/python_apps/pypo/install/pypo-initialize.py +++ b/python_apps/pypo/install/pypo-initialize.py @@ -102,12 +102,11 @@ try: print e sys.exit(1) - logging.basicConfig(format='%(asctime) %(message)s') - logger = logging.getLogger() + logging.basicConfig(format='%(message)s') #generate liquidsoap config file #access the DB and generate liquidsoap.cfg under /etc/airtime/ - ac = api_client.api_client_factory(config, logger) + ac = api_client.api_client_factory(config, logging.getLogger()) ss = ac.get_stream_setting() if ss is not None: From 39a3382157a531bbbf518d6ac470a94e150e27f5 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 30 Apr 2012 17:53:28 -0400 Subject: [PATCH 09/17] CC-3736: Full Install fail at Ubuntu 12.04: virtualenv problem -should be fixed --- install_full/ubuntu/airtime-full-install-nginx | 2 +- python_apps/pypo/airtime-playout-init-d | 4 ++-- python_apps/python-virtualenv/virtualenv-install.sh | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/install_full/ubuntu/airtime-full-install-nginx b/install_full/ubuntu/airtime-full-install-nginx index 049168739..c474f255d 100755 --- a/install_full/ubuntu/airtime-full-install-nginx +++ b/install_full/ubuntu/airtime-full-install-nginx @@ -38,7 +38,7 @@ apt-get update # Updated package list apt-get -y install tar gzip curl nginx php5-pgsql php5-fpm \ -php-pear php5-gd postgresql odbc-postgresql python2.6 libsoundtouch-ocaml \ +php-pear php5-gd postgresql odbc-postgresql python libsoundtouch-ocaml \ libtaglib-ocaml libao-ocaml libmad-ocaml ecasound \ libesd0 libportaudio2 libsamplerate0 rabbitmq-server patch \ php5-curl mpg123 monit python-virtualenv multitail libcamomile-ocaml-data \ diff --git a/python_apps/pypo/airtime-playout-init-d b/python_apps/pypo/airtime-playout-init-d index a640cd312..8cecf7c36 100755 --- a/python_apps/pypo/airtime-playout-init-d +++ b/python_apps/pypo/airtime-playout-init-d @@ -28,7 +28,7 @@ liquidsoap_start () { liquidsoap_stop () { monit unmonitor airtime-liquidsoap >/dev/null 2>&1 - /usr/lib/airtime/airtime_virtualenv/bin/python2.6 /usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_prepare_terminate.py + /usr/lib/airtime/airtime_virtualenv/bin/python /usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_prepare_terminate.py # Send TERM after 5 seconds, wait at most 30 seconds. start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE1 @@ -65,7 +65,7 @@ monit_restart() { start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE0 rm -f $PIDFILE0 - /usr/lib/airtime/airtime_virtualenv/bin/python2.6 /usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_prepare_terminate.py + /usr/lib/airtime/airtime_virtualenv/bin/python /usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_prepare_terminate.py start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE1 rm -f $PIDFILE1 diff --git a/python_apps/python-virtualenv/virtualenv-install.sh b/python_apps/python-virtualenv/virtualenv-install.sh index 47769ba89..0d9a2e2b8 100755 --- a/python_apps/python-virtualenv/virtualenv-install.sh +++ b/python_apps/python-virtualenv/virtualenv-install.sh @@ -51,14 +51,17 @@ fi echo -e "\n*** Installing Python Libraries ***" /usr/lib/airtime/airtime_virtualenv/bin/pip install ${SCRIPTPATH}/airtime_virtual_env.pybundle || exit 1 +PYTHON_VERSION=$(python -c "import sys; print 'python%s.%s' % (sys.version_info[0], sys.version_info[1])") + echo -e "\n*** Patching Python Libraries ***" +echo " * Patching virtualenv libraries in /usr/lib/airtime/airtime_virtualenv/lib/$PYTHON_VERSION" PATCHES=${SCRIPTPATH}/patches/* for file in $(find $PATCHES -print); do if [ -d $file ]; then DIRNAME=$(basename $file) echo -e "\n ---Applying Patches for $DIRNAME---" else - patch -N -p7 -i $file -d /usr/lib/airtime/airtime_virtualenv/lib/python2.7/ + patch -N -p7 -i $file -d /usr/lib/airtime/airtime_virtualenv/lib/$PYTHON_VERSION fi done exit 0 From 6f3b1bc7c2af1fba7804e932049482f90efb304c Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 30 Apr 2012 21:06:26 -0400 Subject: [PATCH 10/17] Remove 2 second sleep after pushing to Liquidsoap queue --- python_apps/pypo/pypopush.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/python_apps/pypo/pypopush.py b/python_apps/pypo/pypopush.py index 0b66e7a08..6e8592c68 100644 --- a/python_apps/pypo/pypopush.py +++ b/python_apps/pypo/pypopush.py @@ -57,6 +57,7 @@ class PypoPush(Thread): next_media_item_chain = None media_schedule = None time_until_next_play = None + chains = None while True: try: @@ -65,10 +66,11 @@ class PypoPush(Thread): else: media_schedule = self.queue.get(block=True, timeout=time_until_next_play) + chains = self.get_all_chains(media_schedule) + #We get to the following lines only if a schedule was received. liquidsoap_queue_approx = self.get_queue_items_from_liquidsoap() - chains = self.get_all_chains(media_schedule) current_event_chain = self.get_current_chain(chains) if len(current_event_chain) > 0 and len(liquidsoap_queue_approx) == 0: #Something is scheduled but Liquidsoap is not playing anything! @@ -79,8 +81,10 @@ class PypoPush(Thread): else: media_chain = filter(lambda item: (item["type"] == "file"), current_event_chain) self.handle_new_media_schedule(media_schedule, liquidsoap_queue_approx, media_chain) - chains = self.get_all_chains(media_schedule) + + #chains = self.get_all_chains(media_schedule) next_media_item_chain = self.get_next_schedule_chain(chains) + self.logger.debug("Next schedule chain: %s", next_media_item_chain) if next_media_item_chain is not None: tnow = datetime.utcnow() @@ -93,11 +97,9 @@ class PypoPush(Thread): except Empty, e: #We only get here when a new chain of tracks are ready to be played. self.push_to_liquidsoap(next_media_item_chain) + + chains.remove(next_media_item_chain) - #TODO - time.sleep(2) - - chains = self.get_all_chains(media_schedule) next_media_item_chain = self.get_next_schedule_chain(chains) if next_media_item_chain is not None: tnow = datetime.utcnow() From 0aa1ef6e469d46b9f17b9235788d961c02ecade0 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 30 Apr 2012 23:12:23 -0400 Subject: [PATCH 11/17] Don't overwrite airtime.conf if it already exists --- install_minimal/include/airtime-copy-files.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/install_minimal/include/airtime-copy-files.sh b/install_minimal/include/airtime-copy-files.sh index e173842d9..b46b1d621 100755 --- a/install_minimal/include/airtime-copy-files.sh +++ b/install_minimal/include/airtime-copy-files.sh @@ -35,9 +35,8 @@ AIRTIMEROOT=$SCRIPTPATH/../../ echo "* Creating /etc/airtime" mkdir -p /etc/airtime -#if [ ! -e /etc/airtime/airtime.conf ]; then -if [ "$DO_UPGRADE" -eq "0" ]; then - #We aren't doing an upgrade so simply overwrite the config files. +#if [ "$DO_UPGRADE" -eq "0" ]; then +if [ ! -e /etc/airtime/airtime.conf ]; then cp $AIRTIMEROOT/airtime_mvc/build/airtime.conf /etc/airtime fi From 3c53d5c7e61f5bf68ace5dd500e7a52d20f84f1a Mon Sep 17 00:00:00 2001 From: denise Date: Tue, 1 May 2012 10:51:28 -0400 Subject: [PATCH 12/17] CC-3737: ON AIR turns to grey from time to time, while the stream keeps playing -fixed --- airtime_mvc/public/js/airtime/dashboard/playlist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/public/js/airtime/dashboard/playlist.js b/airtime_mvc/public/js/airtime/dashboard/playlist.js index c61254857..a2d3d184e 100644 --- a/airtime_mvc/public/js/airtime/dashboard/playlist.js +++ b/airtime_mvc/public/js/airtime/dashboard/playlist.js @@ -91,7 +91,7 @@ function updateProgressBarValue(){ songPercentDone = 0; currentSong = null; } else { - if (currentSong.media_item_played == true && currentShow.length > 0){ + if (currentShow.length > 0){ scheduled_play_line_to_switch.attr("class", "line-to-switch on"); scheduled_play_div.addClass("ready") scheduled_play_source = true; From 0c337fe4306947893ff7334bac6c2ba0522d7e3c Mon Sep 17 00:00:00 2001 From: denise Date: Tue, 1 May 2012 12:39:56 -0400 Subject: [PATCH 13/17] CC-3747: Metadata popup should also show the filepath of the track -done --- airtime_mvc/application/models/StoredFile.php | 18 ++++++++++++++++-- .../library/get-file-meta-data.ajax.phtml | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index a63cf2703..3270000d2 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -45,7 +45,9 @@ class Application_Model_StoredFile { "mime" => "DbMime", "md5" => "DbMd5", "ftype" => "DbFtype", - "language" => "DbLanguage" + "language" => "DbLanguage", + "filepath" => "DbFilepath", + "directory" => "DbDirectory" ); public function __construct() @@ -223,7 +225,19 @@ class Application_Model_StoredFile { foreach ($c['user'] as $constant => $value) { if (preg_match('/^MDATA_KEY/', $constant)) { if (isset($this->_dbMD[$value])) { - $md[$constant] = $this->getDbColMetadataValue($value); + if ($value == 'filepath') { + $directoryPK = $this->getDbColMetadataValue('directory'); + if ($directoryPK == 1) { + $musicDir = Application_Model_MusicDir::getDirByPK($directoryPK); + $md[$constant] = $musicDir->getDirectory() . $this->getDbColMetadataValue($value); + } + else { + $md[$constant] = $this->getDbColMetadataValue($value); + } + } + else { + $md[$constant] = $this->getDbColMetadataValue($value); + } } } } diff --git a/airtime_mvc/application/views/scripts/library/get-file-meta-data.ajax.phtml b/airtime_mvc/application/views/scripts/library/get-file-meta-data.ajax.phtml index 4e0caf69d..76f62b86a 100644 --- a/airtime_mvc/application/views/scripts/library/get-file-meta-data.ajax.phtml +++ b/airtime_mvc/application/views/scripts/library/get-file-meta-data.ajax.phtml @@ -17,6 +17,7 @@
Isrc Number:md["MDATA_KEY_ISRC"]);?>
Website:md["MDATA_KEY_URL"]);?>
Language:md["MDATA_KEY_LANGUAGE"]);?>
+
File Path:md["MDATA_KEY_FILEPATH"]);?>
From 5b816d1fadc4d91a95809e932bd3591cde611d65 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 1 May 2012 16:42:23 -0400 Subject: [PATCH 14/17] CC-3751: Remove db.php requirement in the upgrade script - fixed --- .../upgrades/airtime-2.1.0/DbUpgrade.php | 2 +- .../airtime-2.1.0/common/UpgradeCommon.php | 53 +++++++------------ 2 files changed, 20 insertions(+), 35 deletions(-) diff --git a/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php b/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php index f3b00b8d9..9c08f51e0 100644 --- a/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php +++ b/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php @@ -15,7 +15,7 @@ class AirtimeDatabaseUpgrade{ UpgradeCommon::MigrateTablesToVersion(__DIR__, '20120411174904'); $sql = "INSERT INTO cc_pref(\"keystr\", \"valstr\") VALUES('scheduled_play_switch', 'on')"; - UpgradeCommon::nonSelectQueryDb($sql); + UpgradeCommon::queryDb($sql); } /* diff --git a/install_minimal/upgrades/airtime-2.1.0/common/UpgradeCommon.php b/install_minimal/upgrades/airtime-2.1.0/common/UpgradeCommon.php index cc8ee35e0..07e63db99 100644 --- a/install_minimal/upgrades/airtime-2.1.0/common/UpgradeCommon.php +++ b/install_minimal/upgrades/airtime-2.1.0/common/UpgradeCommon.php @@ -1,7 +1,4 @@ getMessage().PHP_EOL; - echo $CC_DBC->getUserInfo().PHP_EOL; + try { + $con = Propel::getConnection(); + } catch (Exception $e) { + echo $e->getMessage().PHP_EOL; echo "Database connection problem.".PHP_EOL; - echo "Check if database '{$CC_CONFIG['dsn']['database']}' exists". - " with corresponding permissions.".PHP_EOL; + echo "Check if database exists with corresponding permissions.".PHP_EOL; if ($p_exitOnError) { exit(1); } - } else { - $CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC); + return false; } + return true; } public static function DbTableExists($p_name) { - global $CC_DBC; - $sql = "SELECT * FROM ".$p_name; - $result = $CC_DBC->GetOne($sql); - if (PEAR::isError($result)) { + $con = Propel::getConnection(); + try { + $sql = "SELECT * FROM ".$p_name." LIMIT 1"; + $con->query($sql); + } catch (PDOException $e){ return false; } return true; @@ -238,27 +234,16 @@ class UpgradeCommon{ fclose($fp); } - public static function selectQueryDb($p_sql){ - global $CC_DBC; + public static function queryDb($p_sql){ + $con = Propel::getConnection(); - $result = $CC_DBC->getRow($p_sql, $fetchmode=DB_FETCHMODE_ASSOC); - if (PEAR::isError($result)) { - echo "Error executing $sql. Exiting."; + try { + $result = $con->exec($p_sql); + } catch (Exception $e) { + echo "Error executing $p_sql. Exiting."; exit(1); } - - return $result; - } - - public static function nonSelectQueryDb($p_sql){ - global $CC_DBC; - $result = $CC_DBC->query($p_sql); - if (PEAR::isError($result)) { - echo "Error executing $sql. Exiting."; - exit(1); - } - return $result; } } From 8a2b9e7221f71a71b98ca86577bb8cd588ac4efe Mon Sep 17 00:00:00 2001 From: James Date: Tue, 1 May 2012 17:05:18 -0400 Subject: [PATCH 15/17] CC-3746: Calendar: Duration of 24hrs show is 00h 00m - fixed --- .../application/controllers/ScheduleController.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index 9ce53ca02..9df1ddca2 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -909,7 +909,17 @@ class ScheduleController extends Zend_Controller_Action $duration = $UTCEndDateTime->diff($UTCStartDateTime); - $result = $duration->format('%r%Hh %Im'); + $day = intval($duration->format('%d')); + if($day > 0){ + $hour = intval($duration->format('%h')); + $min = intval($duration->format('%i')); + $hour += $day * 24; + $hour = min($hour, 99); + $sign = $duration->format('%r'); + $result = sprintf('%s%02dh %02dm', $sign, $hour, $min); + }else{ + $result = $duration->format('%r%Hh %Im'); + } }catch (Exception $e){ $result = "Invalid Date"; } From 576836ac18247f61e825f719712abbb2d53fb8c0 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 1 May 2012 17:24:22 -0400 Subject: [PATCH 16/17] CC-3751: Remove db.php requirement in the upgrade script - fixed --- install_minimal/include/airtime-upgrade.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/install_minimal/include/airtime-upgrade.php b/install_minimal/include/airtime-upgrade.php index 6eef3441c..fdbe4c175 100644 --- a/install_minimal/include/airtime-upgrade.php +++ b/install_minimal/include/airtime-upgrade.php @@ -5,8 +5,6 @@ * @copyright 2010 Sourcefabric O.P.S. * @license http://www.gnu.org/licenses/gpl.txt */ - -require_once('DB.php'); require_once(__DIR__.'/airtime-constants.php'); require_once(dirname(__FILE__).'/AirtimeIni.php'); require_once(dirname(__FILE__).'/AirtimeInstall.php'); From 9e4c311cf28580c37eb459ed86080d4d4cff3b58 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 1 May 2012 17:35:36 -0400 Subject: [PATCH 17/17] CC-3751: Remove db.php requirement in the upgrade script - added require_once of Propel --- install_minimal/upgrades/airtime-2.1.0/airtime-upgrade.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/install_minimal/upgrades/airtime-2.1.0/airtime-upgrade.php b/install_minimal/upgrades/airtime-2.1.0/airtime-upgrade.php index da60de58f..6ed58eb87 100644 --- a/install_minimal/upgrades/airtime-2.1.0/airtime-upgrade.php +++ b/install_minimal/upgrades/airtime-2.1.0/airtime-upgrade.php @@ -23,6 +23,9 @@ function get_conf_location(){ $conf_path = get_conf_location(); require_once $conf_path; +set_include_path(__DIR__.'/../../../airtime_mvc/library' . PATH_SEPARATOR . get_include_path()); + +require_once 'propel/runtime/lib/Propel.php'; require_once 'common/UpgradeCommon.php'; require_once 'ConfFileUpgrade.php'; require_once 'DbUpgrade.php';