From 22a12dd1a968e73f2778c2654fe3ade3b5c86705 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 29 Apr 2013 18:02:50 -0400 Subject: [PATCH 01/16] IM-629 -show only single show at a time --- airtime_mvc/public/js/airtime/schedule/schedule.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/public/js/airtime/schedule/schedule.js b/airtime_mvc/public/js/airtime/schedule/schedule.js index ac5e2dcc1..b474d30de 100644 --- a/airtime_mvc/public/js/airtime/schedule/schedule.js +++ b/airtime_mvc/public/js/airtime/schedule/schedule.js @@ -137,7 +137,7 @@ function findViewportDimensions() { }; } -function buildScheduleDialog (json) { +function buildScheduleDialog (json, instance_id) { var dialog = $(json.dialog), viewport = findViewportDimensions(), height = Math.floor(viewport.height * 0.96), @@ -179,6 +179,8 @@ function buildScheduleDialog (json) { //set the start end times so the builder datatables knows its time range. fnServer.start = json.start; fnServer.end = json.end; + fnServer.ops = {}; + fnServer.ops.showFilter = instance_id; AIRTIME.library.libraryInit(); AIRTIME.showbuilder.builderDataTable(); @@ -352,7 +354,7 @@ $(document).ready(function() { callback = function() { $.post(oItems.schedule.url, {format: "json", id: data.id}, function(json){ - buildScheduleDialog(json); + buildScheduleDialog(json, data.id); }); }; From 992e3c37ef899249bb4458b368a54eeb1f4be957 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Tue, 30 Apr 2013 11:16:33 -0400 Subject: [PATCH 02/16] IM-629 -add missing POST parameter --- airtime_mvc/public/js/airtime/schedule/schedule.js | 1 + 1 file changed, 1 insertion(+) diff --git a/airtime_mvc/public/js/airtime/schedule/schedule.js b/airtime_mvc/public/js/airtime/schedule/schedule.js index b474d30de..9a57c7eff 100644 --- a/airtime_mvc/public/js/airtime/schedule/schedule.js +++ b/airtime_mvc/public/js/airtime/schedule/schedule.js @@ -181,6 +181,7 @@ function buildScheduleDialog (json, instance_id) { fnServer.end = json.end; fnServer.ops = {}; fnServer.ops.showFilter = instance_id; + fnServer.ops.myShows = 0; AIRTIME.library.libraryInit(); AIRTIME.showbuilder.builderDataTable(); From af7b2d5347aa15a0f8e25f2caea7b6cb87eef9cf Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Tue, 30 Apr 2013 12:11:37 -0400 Subject: [PATCH 03/16] IM-629 -fix using instance id instead of show id --- airtime_mvc/public/js/airtime/schedule/schedule.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/public/js/airtime/schedule/schedule.js b/airtime_mvc/public/js/airtime/schedule/schedule.js index 9a57c7eff..add20984a 100644 --- a/airtime_mvc/public/js/airtime/schedule/schedule.js +++ b/airtime_mvc/public/js/airtime/schedule/schedule.js @@ -354,8 +354,8 @@ $(document).ready(function() { callback = function() { - $.post(oItems.schedule.url, {format: "json", id: data.id}, function(json){ - buildScheduleDialog(json, data.id); + $.post(oItems.schedule.url, {format: "json", id: data.showId}, function(json){ + buildScheduleDialog(json, data.showId); }); }; From bb36556bb901f36b944fb27ca98977e2418bddb8 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Tue, 30 Apr 2013 13:35:28 -0400 Subject: [PATCH 04/16] IM-629 -filter by using instance id instead of show id Conflicts: airtime_mvc/application/models/Schedule.php --- .../application/controllers/ShowbuilderController.php | 4 +++- airtime_mvc/application/models/Schedule.php | 10 ++++------ airtime_mvc/application/models/ShowBuilder.php | 5 ++++- airtime_mvc/public/js/airtime/schedule/schedule.js | 7 ++++--- airtime_mvc/public/js/airtime/showbuilder/builder.js | 1 + .../public/js/airtime/showbuilder/main_builder.js | 1 + 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/airtime_mvc/application/controllers/ShowbuilderController.php b/airtime_mvc/application/controllers/ShowbuilderController.php index 2c4fd4b16..91c47bb1b 100644 --- a/airtime_mvc/application/controllers/ShowbuilderController.php +++ b/airtime_mvc/application/controllers/ShowbuilderController.php @@ -269,7 +269,9 @@ class ShowbuilderController extends Zend_Controller_Action $startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC")); $endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC")); - $opts = array("myShows" => $my_shows, "showFilter" => $show_filter); + $opts = array("myShows" => $my_shows, + "showFilter" => $show_filter, + "showInstanceFilter" => $show_filter); $showBuilder = new Application_Model_ShowBuilder($startsDT, $endsDT, $opts); $data = $showBuilder->getItems(); diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 3759254d4..a8f31b620 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -309,13 +309,11 @@ SQL; * @return array $scheduledItems * */ - public static function GetScheduleDetailItems($p_start, $p_end, $p_shows) + public static function GetScheduleDetailItems($p_start, $p_end, $p_shows, $p_show_instances) { $p_start_str = $p_start->format("Y-m-d H:i:s"); $p_end_str = $p_end->format("Y-m-d H:i:s"); - $paramMap = array(); - //We need to search 24 hours before and after the show times so that that we //capture all of the show's contents. $p_track_start= $p_start->sub(new DateInterval("PT24H"))->format("Y-m-d H:i:s"); @@ -355,7 +353,7 @@ SQL; AND sched.ends >= :fj_ts_6)) ) SQL; - $map = array( + $paramMap = array( ":fj_ts_1" => $p_track_start, ":fj_ts_2" => $p_track_end, ":fj_ts_3" => $p_track_start, @@ -363,8 +361,6 @@ SQL; ":fj_ts_5" => $p_track_start, ":fj_ts_6" => $p_track_end, ); - $paramMap = $paramMap + $map; - $filesSql = str_replace("%%columns%%", $filesColumns, @@ -426,6 +422,8 @@ SQL; $showPredicate = " AND show_id IN (".implode(",", $params).")"; $paramMap = $paramMap + $map; + } else if (count($p_show_instances) > 0) { + $showPredicate = " AND si_id IN (".implode(",", $p_show_instances).")"; } $sql = <<opts["myShows"] === 1) { $shows = $this->getUsersShows(); } elseif ($this->opts["showFilter"] !== 0) { $shows[] = $this->opts["showFilter"]; + } elseif ($this->opts["showInstanceFilter"] !== 0) { + $showInstance[] = $this->opts["showInstanceFilter"]; } $scheduled_items = Application_Model_Schedule::GetScheduleDetailItems( - $this->startDT, $this->endDT, $shows); + $this->startDT, $this->endDT, $shows, $showInstance); for ($i = 0, $rows = count($scheduled_items); $i < $rows; $i++) { diff --git a/airtime_mvc/public/js/airtime/schedule/schedule.js b/airtime_mvc/public/js/airtime/schedule/schedule.js index add20984a..82531a726 100644 --- a/airtime_mvc/public/js/airtime/schedule/schedule.js +++ b/airtime_mvc/public/js/airtime/schedule/schedule.js @@ -180,7 +180,8 @@ function buildScheduleDialog (json, instance_id) { fnServer.start = json.start; fnServer.end = json.end; fnServer.ops = {}; - fnServer.ops.showFilter = instance_id; + fnServer.ops.showFilter = 0; + fnServer.ops.showInstanceFilter = instance_id; fnServer.ops.myShows = 0; AIRTIME.library.libraryInit(); @@ -354,8 +355,8 @@ $(document).ready(function() { callback = function() { - $.post(oItems.schedule.url, {format: "json", id: data.showId}, function(json){ - buildScheduleDialog(json, data.showId); + $.post(oItems.schedule.url, {format: "json", id: data.id}, function(json){ + buildScheduleDialog(json, data.id); }); }; diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js index 65826d643..30076dd67 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/builder.js +++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js @@ -359,6 +359,7 @@ var AIRTIME = (function(AIRTIME){ if (mod.fnServerData.hasOwnProperty("ops")) { aoData.push( { name: "myShows", value: mod.fnServerData.ops.myShows} ); aoData.push( { name: "showFilter", value: mod.fnServerData.ops.showFilter} ); + aoData.push( { name: "showInstanceFilter", value: mod.fnServerData.ops.showInstanceFilter} ); } $.ajax({ diff --git a/airtime_mvc/public/js/airtime/showbuilder/main_builder.js b/airtime_mvc/public/js/airtime/showbuilder/main_builder.js index ee19e85fd..38c3ef05a 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/main_builder.js +++ b/airtime_mvc/public/js/airtime/showbuilder/main_builder.js @@ -266,6 +266,7 @@ AIRTIME = (function(AIRTIME) { if (fn.hasOwnProperty("ops")) { data["myShows"] = fn.ops.myShows; data["showFilter"] = fn.ops.showFilter; + data["showFilter"] = fn.ops.showInstanceFilter; } $.ajax( { From b287409bfbe9cda97fc511aa7c3adb65084a1522 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Tue, 30 Apr 2013 13:56:00 -0400 Subject: [PATCH 05/16] IM-629 -not using show_instnace_filter POST param correctly --- airtime_mvc/application/controllers/ShowbuilderController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/controllers/ShowbuilderController.php b/airtime_mvc/application/controllers/ShowbuilderController.php index 91c47bb1b..ec34f68f2 100644 --- a/airtime_mvc/application/controllers/ShowbuilderController.php +++ b/airtime_mvc/application/controllers/ShowbuilderController.php @@ -264,6 +264,7 @@ class ShowbuilderController extends Zend_Controller_Action //default ends is 24 hours after starts. $ends_epoch = $request->getParam("end", $current_time + (60*60*24)); $show_filter = intval($request->getParam("showFilter", 0)); + $show_instance_filter = intval($request->getParam("showInstanceFilter", 0)); $my_shows = intval($request->getParam("myShows", 0)); $startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC")); @@ -271,7 +272,7 @@ class ShowbuilderController extends Zend_Controller_Action $opts = array("myShows" => $my_shows, "showFilter" => $show_filter, - "showInstanceFilter" => $show_filter); + "showInstanceFilter" => $show_instance_filter); $showBuilder = new Application_Model_ShowBuilder($startsDT, $endsDT, $opts); $data = $showBuilder->getItems(); From 5080807a21208b693b30912133280eb3d8b7aba8 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Tue, 30 Apr 2013 14:02:35 -0400 Subject: [PATCH 06/16] IM-629 -fix minor SQL syntax error --- airtime_mvc/application/models/Schedule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index a8f31b620..3ea36c099 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -423,7 +423,7 @@ SQL; $showPredicate = " AND show_id IN (".implode(",", $params).")"; $paramMap = $paramMap + $map; } else if (count($p_show_instances) > 0) { - $showPredicate = " AND si_id IN (".implode(",", $p_show_instances).")"; + $showPredicate = " AND si.id IN (".implode(",", $p_show_instances).")"; } $sql = << Date: Tue, 14 May 2013 22:16:30 -0400 Subject: [PATCH 07/16] CC-5126: Media Monitor: Exception happens when cuein value is 00:00:00 -fixed this be ensuring we're not writing cue-in/out values to the file. This should never have been allowed. --- python_apps/media-monitor2/media/monitor/metadata.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/python_apps/media-monitor2/media/monitor/metadata.py b/python_apps/media-monitor2/media/monitor/metadata.py index 09cec0750..d5dba3b51 100644 --- a/python_apps/media-monitor2/media/monitor/metadata.py +++ b/python_apps/media-monitor2/media/monitor/metadata.py @@ -45,8 +45,6 @@ airtime2mutagen = { "MDATA_KEY_URL" : "website", "MDATA_KEY_ISRC" : "isrc", "MDATA_KEY_COPYRIGHT" : "copyright", - "MDATA_KEY_CUE_IN" : "cuein", - "MDATA_KEY_CUE_OUT" : "cueout", } From 9ad42b2b2cb7b1d9f50e252ee1a70986ffaf1b1e Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Tue, 14 May 2013 22:26:48 -0400 Subject: [PATCH 08/16] CC-5126: Media Monitor: Exception happens when cuein value is 00:00:00 -also removed functions that query for cue-in/cue-out, since we don't care about these. --- .../media-monitor2/media/metadata/definitions.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/python_apps/media-monitor2/media/metadata/definitions.py b/python_apps/media-monitor2/media/metadata/definitions.py index 621449dd6..1e40c79f3 100644 --- a/python_apps/media-monitor2/media/metadata/definitions.py +++ b/python_apps/media-monitor2/media/metadata/definitions.py @@ -19,16 +19,6 @@ def load_definitions(): t.depends('length') t.translate(lambda k: format_length(k['length'])) - with md.metadata('MDATA_KEY_CUE_IN') as t: - t.default(u'0.0') - t.depends('cuein') - t.translate(lambda k: format_length(k['cuein'])) - - with md.metadata('MDATA_KEY_CUE_OUT') as t: - t.default(u'0.0') - t.depends('cueout') - t.translate(lambda k: format_length(k['cueout'])) - with md.metadata('MDATA_KEY_MIME') as t: t.default(u'') t.depends('mime') From 254ebb709e3cb7f306b135ad1f7df0a36ea03e42 Mon Sep 17 00:00:00 2001 From: denise Date: Wed, 15 May 2013 11:25:30 -0400 Subject: [PATCH 09/16] CC-5151: Calendar -> Remove all content -> Does not update scheduled flag in library --- .../application/services/SchedulerService.php | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/airtime_mvc/application/services/SchedulerService.php b/airtime_mvc/application/services/SchedulerService.php index c5eb0a504..b8403bcd0 100644 --- a/airtime_mvc/application/services/SchedulerService.php +++ b/airtime_mvc/application/services/SchedulerService.php @@ -289,23 +289,39 @@ class Application_Service_SchedulerService $ccShowInstance = CcShowInstancesQuery::create()->findPk($instanceId); $instances = array(); + $instanceIds = array(); if ($ccShowInstance->getCcShow()->isLinked()) { - $instanceIds = array(); foreach ($ccShowInstance->getCcShow()->getCcShowInstancess() as $instance) { $instanceIds[] = $instance->getDbId(); $instances[] = $instance; } - CcScheduleQuery::create() - ->filterByDbInstanceId($instanceIds, Criteria::IN) - ->delete(); } else { + $instanceIds[] = $ccShowInstance->getDbId(); $instances[] = $ccShowInstance; - CcScheduleQuery::create() - ->filterByDbInstanceId($ccShowInstance->getDbId()) - ->delete(); } + /* Update the is_scheduled flag in cc_files to false + * We need to do this before we delete the scheduled items + */ + $ccSchedules = CcScheduleQuery::create() + ->filterByDbInstanceId($instanceIds, Criteria::IN) + ->find(); + $fileIds = array(); + foreach ($ccSchedules as $ccSchedule) { + $fileIds[] = $ccSchedule->getDbFileId(); + } + $selectCriteria = new Criteria(); + $selectCriteria->add(CcFilesPeer::ID, $fileIds, Criteria::IN); + $updateCriteria = new Criteria(); + $updateCriteria->add(CcFilesPeer::IS_SCHEDULED, false); + BasePeer::doUpdate($selectCriteria, $updateCriteria, Propel::getConnection()); + + /* Clear out the schedule */ + CcScheduleQuery::create() + ->filterByDbInstanceId($instanceIds, Criteria::IN) + ->delete(); + Application_Model_RabbitMq::PushSchedule(); $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME); foreach ($instances as $instance) { From f3edc2bee6922bab77add3804466ddf7a97d86a1 Mon Sep 17 00:00:00 2001 From: denise Date: Wed, 15 May 2013 12:38:48 -0400 Subject: [PATCH 10/16] CC-5151: Calendar -> Remove all content -> Does not update scheduled flag in library Fixed so it doesn't update files that are scheduled in other shows --- .../application/services/SchedulerService.php | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/airtime_mvc/application/services/SchedulerService.php b/airtime_mvc/application/services/SchedulerService.php index b8403bcd0..7cfac160d 100644 --- a/airtime_mvc/application/services/SchedulerService.php +++ b/airtime_mvc/application/services/SchedulerService.php @@ -301,27 +301,41 @@ class Application_Service_SchedulerService $instances[] = $ccShowInstance; } - /* Update the is_scheduled flag in cc_files to false - * We need to do this before we delete the scheduled items + /* Get the file ids of the tracks we are about to delete + * from cc_schedule. We need these so we can update the + * is_scheduled flag in cc_files */ $ccSchedules = CcScheduleQuery::create() ->filterByDbInstanceId($instanceIds, Criteria::IN) + ->setDistinct(CcSchedulePeer::FILE_ID) ->find(); $fileIds = array(); foreach ($ccSchedules as $ccSchedule) { $fileIds[] = $ccSchedule->getDbFileId(); } - $selectCriteria = new Criteria(); - $selectCriteria->add(CcFilesPeer::ID, $fileIds, Criteria::IN); - $updateCriteria = new Criteria(); - $updateCriteria->add(CcFilesPeer::IS_SCHEDULED, false); - BasePeer::doUpdate($selectCriteria, $updateCriteria, Propel::getConnection()); /* Clear out the schedule */ CcScheduleQuery::create() ->filterByDbInstanceId($instanceIds, Criteria::IN) ->delete(); + /* Now that the schedule has been cleared we need to make + * sure we do not update the is_scheduled flag for tracks + * that are scheduled in other shows + */ + $futureScheduledFiles = Application_Model_Schedule::getAllFutureScheduledFiles(); + foreach ($fileIds as $k => $v) { + if (in_array($v, $futureScheduledFiles)) { + unset($fileIds[$k]); + } + } + + $selectCriteria = new Criteria(); + $selectCriteria->add(CcFilesPeer::ID, $fileIds, Criteria::IN); + $updateCriteria = new Criteria(); + $updateCriteria->add(CcFilesPeer::IS_SCHEDULED, false); + BasePeer::doUpdate($selectCriteria, $updateCriteria, Propel::getConnection()); + Application_Model_RabbitMq::PushSchedule(); $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME); foreach ($instances as $instance) { From 80686b70631927d4d34595221456e72aee9d2837 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 15 May 2013 13:06:16 -0400 Subject: [PATCH 11/16] add parameter parsing to airtime-liquidsoap script. -Allow us to prevent running as daemon --- python_apps/pypo/airtime-liquidsoap | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/python_apps/pypo/airtime-liquidsoap b/python_apps/pypo/airtime-liquidsoap index 0812bd47d..def0aaae1 100755 --- a/python_apps/pypo/airtime-liquidsoap +++ b/python_apps/pypo/airtime-liquidsoap @@ -1,11 +1,38 @@ #!/bin/bash -e +debug="f" + +showhelp () { + echo "Usage: airtime-liquidsoap [options] +--help|-h Displays usage information. +--debug|-d Print error messages to console" +} + +set -- $(getopt -l help,debug "hd" "$@") +while [ $# -gt 0 ] +do + case "$1" in + (-h|--help) showhelp; exit 0;; + (-d|--debug) debug="t";; + + (--) shift; break;; + (-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;; + (*) break;; + esac + shift +done + + virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/" . ${virtualenv_bin}activate export HOME="/var/tmp/airtime/pypo/" api_client_path="/usr/lib/airtime/" -ls_path="/usr/bin/airtime-liquidsoap --verbose -f -d" +if [ $debug = "t" ]; then + ls_path="/usr/bin/airtime-liquidsoap --verbose -f" +else + ls_path="/usr/bin/airtime-liquidsoap --verbose -f -d" +fi ls_param="/usr/lib/airtime/pypo/bin/liquidsoap_scripts/ls_script.liq" export PYTHONPATH=${api_client_path} From ba3703b556db859c42c758038ea16c7370592974 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 15 May 2013 13:10:56 -0400 Subject: [PATCH 12/16] Revert "CC-5126:" This reverts commit a2b500729c8a6a826b313868bcc8eefac196aaa0. --- python_apps/media-monitor2/media/monitor/metadata.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python_apps/media-monitor2/media/monitor/metadata.py b/python_apps/media-monitor2/media/monitor/metadata.py index d5dba3b51..09cec0750 100644 --- a/python_apps/media-monitor2/media/monitor/metadata.py +++ b/python_apps/media-monitor2/media/monitor/metadata.py @@ -45,6 +45,8 @@ airtime2mutagen = { "MDATA_KEY_URL" : "website", "MDATA_KEY_ISRC" : "isrc", "MDATA_KEY_COPYRIGHT" : "copyright", + "MDATA_KEY_CUE_IN" : "cuein", + "MDATA_KEY_CUE_OUT" : "cueout", } From 4a82fe2e52ac0bfa9471d4ad73bb2c8c860f247d Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 15 May 2013 13:13:37 -0400 Subject: [PATCH 13/16] Revert "CC-5126: Media Monitor: Exception happens when cuein value is 00:00:00" This reverts commit 9ad42b2b2cb7b1d9f50e252ee1a70986ffaf1b1e. --- .../media-monitor2/media/metadata/definitions.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/python_apps/media-monitor2/media/metadata/definitions.py b/python_apps/media-monitor2/media/metadata/definitions.py index 1e40c79f3..621449dd6 100644 --- a/python_apps/media-monitor2/media/metadata/definitions.py +++ b/python_apps/media-monitor2/media/metadata/definitions.py @@ -19,6 +19,16 @@ def load_definitions(): t.depends('length') t.translate(lambda k: format_length(k['length'])) + with md.metadata('MDATA_KEY_CUE_IN') as t: + t.default(u'0.0') + t.depends('cuein') + t.translate(lambda k: format_length(k['cuein'])) + + with md.metadata('MDATA_KEY_CUE_OUT') as t: + t.default(u'0.0') + t.depends('cueout') + t.translate(lambda k: format_length(k['cueout'])) + with md.metadata('MDATA_KEY_MIME') as t: t.default(u'') t.depends('mime') From 8545803dbf9b39ef46446f0c45a6668845814104 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 15 May 2013 13:19:29 -0400 Subject: [PATCH 14/16] CC-5126: Media Monitor: Exception happens when cuein value is 00:00:00 -slightly better way of not writing cue-in/cue-out --- python_apps/media-monitor2/media/monitor/metadata.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python_apps/media-monitor2/media/monitor/metadata.py b/python_apps/media-monitor2/media/monitor/metadata.py index 09cec0750..bf5eb7333 100644 --- a/python_apps/media-monitor2/media/monitor/metadata.py +++ b/python_apps/media-monitor2/media/monitor/metadata.py @@ -49,6 +49,8 @@ airtime2mutagen = { "MDATA_KEY_CUE_OUT" : "cueout", } +#doesn't make sense for us to write these values to a track's metadata +mutagen_do_not_write = ["MDATA_KEY_CUE_IN", "MDATA_KEY_CUE_OUT"] # Some airtime attributes are special because they must use the mutagen object # itself to calculate the value that they need. The lambda associated with each @@ -113,7 +115,8 @@ class Metadata(Loggable): song_file = mutagen.File(path, easy=True) exceptions = [] # for bad keys for airtime_k, airtime_v in md.iteritems(): - if airtime_k in airtime2mutagen: + if airtime_k in airtime2mutagen and \ + airtime_k not in mutagen_do_not_write: # The unicode cast here is mostly for integers that need to be # strings if airtime_v is None: continue From 658fd82e1f3c1ee48bd28941e75c919cadd9917b Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 15 May 2013 13:55:21 -0400 Subject: [PATCH 15/16] version number change necessary for nightly build scripts --- gen-snapshot.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gen-snapshot.sh b/gen-snapshot.sh index 682069e34..41e38cd22 100755 --- a/gen-snapshot.sh +++ b/gen-snapshot.sh @@ -2,7 +2,7 @@ # Script for generating nightly Airtime snapshot packages # Run from the directory containg the files checked out from git -VERSION=2.3.0~$(date "+%Y%m%d") +VERSION=2.4.0~$(date "+%Y%m%d") BUILDDEST=/tmp/airtime-${VERSION}/ DEBDIR=`pwd`/debian @@ -23,7 +23,7 @@ cd ${BUILDDEST} || exit # Set the version of the snapshot package -sed -i "1s:(2.3.0-1):(${VERSION}):g" debian/changelog +sed -i "1s:(2.4.0-1):(${VERSION}):g" debian/changelog # FIXES for 2.3.0 ############# From 491ea6a32c0c1f863ecca6e35ef6376b1322a4e0 Mon Sep 17 00:00:00 2001 From: denise Date: Wed, 15 May 2013 15:32:29 -0400 Subject: [PATCH 16/16] CC-5138: Linked Show: Time limitation exceeds when adding 24 hours smart block into daily repeating & linked shows Made some small optimizations. Still needs more work. --- airtime_mvc/application/models/Scheduler.php | 70 ++++++++++++-------- 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/airtime_mvc/application/models/Scheduler.php b/airtime_mvc/application/models/Scheduler.php index fc3aabb01..7cfe72908 100644 --- a/airtime_mvc/application/models/Scheduler.php +++ b/airtime_mvc/application/models/Scheduler.php @@ -249,6 +249,8 @@ class Application_Model_Scheduler $files[] = $data; } } else { + $defaultFadeIn = Application_Model_Preference::GetDefaultFadeIn(); + $defaultFadeOut = Application_Model_Preference::GetDefaultFadeOut(); $dynamicFiles = $bl->getListOfFilesUnderLimit(); foreach ($dynamicFiles as $f) { $fileId = $f['id']; @@ -263,8 +265,8 @@ class Application_Model_Scheduler $data["cliplength"] = Application_Common_DateHelper::secondsToPlaylistTime($cueout - $cuein); //fade is in format SS.uuuuuu - $data["fadein"] = Application_Model_Preference::GetDefaultFadeIn(); - $data["fadeout"] = Application_Model_Preference::GetDefaultFadeOut(); + $data["fadein"] = $defaultFadeIn; + $data["fadeout"] = $defaultFadeOut; $data["type"] = 0; $files[] = $data; @@ -306,6 +308,8 @@ class Application_Model_Scheduler $files[] = $data; } } else { + $defaultFadeIn = Application_Model_Preference::GetDefaultFadeIn(); + $defaultFadeOut = Application_Model_Preference::GetDefaultFadeOut(); $dynamicFiles = $bl->getListOfFilesUnderLimit(); foreach ($dynamicFiles as $f) { $fileId = $f['id']; @@ -320,8 +324,8 @@ class Application_Model_Scheduler $data["cliplength"] = Application_Common_DateHelper::secondsToPlaylistTime($cueout - $cuein); //fade is in format SS.uuuuuu - $data["fadein"] = Application_Model_Preference::GetDefaultFadeIn(); - $data["fadeout"] = Application_Model_Preference::GetDefaultFadeOut(); + $data["fadein"] = $defaultFadeIn; + $data["fadeout"] = $defaultFadeOut; $data["type"] = 0; $files[] = $data; @@ -508,12 +512,15 @@ class Application_Model_Scheduler $temp = array(); $instance = null; + /* Items in shows are ordered by position number. We need to know * the position when adding/moving items in linked shows so they are * added or moved in the correct position */ $pos = 0; + $linked = false; + foreach ($scheduleItems as $schedule) { $id = intval($schedule["id"]); @@ -524,10 +531,11 @@ class Application_Model_Scheduler * of inserted items */ if ($id != 0) { - $ccSchedule = CcScheduleQuery::create()->findPk($schedule["id"]); + $ccSchedule = CcScheduleQuery::create()->findPk($id); $ccShowInstance = CcShowInstancesQuery::create()->findPk($ccSchedule->getDbInstanceId()); $ccShow = $ccShowInstance->getCcShow(); - if ($ccShow->isLinked()) { + $linked = $ccShow->isLinked(); + if ($linked) { $unique = $ccShow->getDbId() . $ccSchedule->getDbPosition(); if (!in_array($unique, $temp)) { $temp[] = $unique; @@ -538,7 +546,8 @@ class Application_Model_Scheduler } else { $ccShowInstance = CcShowInstancesQuery::create()->findPk($schedule["instance"]); $ccShow = $ccShowInstance->getccShow(); - if ($ccShow->isLinked()) { + $linked = $ccShow->isLinked(); + if ($linked) { $unique = $ccShow->getDbId() . "a"; if (!in_array($unique, $temp)) { $temp[] = $unique; @@ -552,23 +561,25 @@ class Application_Model_Scheduler * we need to insert the items for each linked instance belonging * to that show */ - $instances = $this->getInstances($schedule["instance"]); - foreach($instances as $instance) { - $linked = $instance->getCcShow()->isLinked(); + if ($linked) { + $instances = $ccShow->getCcShowInstancess(); + } else { + $instances = array($ccShowInstance); + } + foreach($instances as &$instance) { + $instanceId = $instance->getDbId(); if ($id !== 0) { - $schedItem = CcScheduleQuery::create()->findPK($id, $this->con); /* We use the selected cursor's position to find the same * positions in every other linked instance */ - $pos = $schedItem->getDbPosition(); + $pos = $ccSchedule->getDbPosition(); - $ccSchedule = CcScheduleQuery::create() - ->filterByDbInstanceId($instance->getDbId()) + $linkCcSchedule = CcScheduleQuery::create() + ->filterByDbInstanceId($instanceId) ->filterByDbPosition($pos) ->findOne(); - //$schedItemEndDT = $schedItem->getDbEnds(null); - $schedItemEndDT = $ccSchedule->getDbEnds(null); + $schedItemEndDT = $linkCcSchedule->getDbEnds(null); $nextStartDT = $this->findNextStartTime($schedItemEndDT, $instance); $pos++; @@ -583,7 +594,7 @@ class Application_Model_Scheduler } if (!in_array($instance->getDbId(), $affectedShowInstances)) { - $affectedShowInstances[] = $instance->getDbId(); + $affectedShowInstances[] = $instanceId; } /* @@ -604,11 +615,12 @@ class Application_Model_Scheduler if (is_null($filesToInsert)) { $filesToInsert = array(); foreach ($mediaItems as $media) { - $filesToInsert = array_merge($filesToInsert, $this->retrieveMediaFiles($media["id"], $media["type"])); + $filesToInsert = array_merge($filesToInsert, + $this->retrieveMediaFiles($media["id"], $media["type"])); } } - foreach ($filesToInsert as $file) { + foreach ($filesToInsert as &$file) { //item existed previously and is being moved. //need to keep same id for resources if we want REST. if (isset($file['sched_id'])) { @@ -628,7 +640,7 @@ class Application_Model_Scheduler */ if ($linked && $moveAction) { $sched = CcScheduleQuery::create() - ->filterByDbInstanceId($instance->getDbId()) + ->filterByDbInstanceId($instanceId) ->filterByDbPosition($originalPosition) ->findOne(); } @@ -657,9 +669,9 @@ class Application_Model_Scheduler ->setDbFadeOut($file['fadeout']) ->setDbClipLength($file['cliplength']) ->setDbPosition($pos); - //->setDbInstanceId($instance->getDbId()); + if (!$moveAction) { - $sched->setDbInstanceId($instance->getDbId()); + $sched->setDbInstanceId($instanceId); } switch ($file["type"]) { @@ -686,11 +698,17 @@ class Application_Model_Scheduler }//all files have been inserted/moved // update is_scheduled flag for each cc_file - foreach ($filesToInsert as $file) { - $db_file = CcFilesQuery::create()->findPk($file['id'], $this->con); - $db_file->setDbIsScheduled(true); - $db_file->save($this->con); + $fileIds = array(); + foreach ($filesToInsert as &$file) { + $fileIds[] = $file["id"]; } + $selectCriteria = new Criteria(); + $selectCriteria->add(CcFilesPeer::ID, $fileIds, Criteria::IN); + $selectCriteria->addAnd(CcFilesPeer::IS_SCHEDULED, false); + $updateCriteria = new Criteria(); + $updateCriteria->add(CcFilesPeer::IS_SCHEDULED, true); + BasePeer::doUpdate($selectCriteria, $updateCriteria, $this->con); + /* Reset files to insert so we can get a new set of files. We have * to do this in case we are inserting a dynamic block */