From 9be6f1bd0e954e754f6c162a39fcac6a7552d4c2 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Sat, 17 Mar 2012 14:53:15 -0400 Subject: [PATCH] CC-3464: Playout forward cache should be configurable -Done --- airtime_mvc/application/configs/conf.php | 2 ++ airtime_mvc/application/models/Schedule.php | 12 +++++++++++- airtime_mvc/build/airtime.conf | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/configs/conf.php b/airtime_mvc/application/configs/conf.php index dc3e03a2b..fcdece4bc 100644 --- a/airtime_mvc/application/configs/conf.php +++ b/airtime_mvc/application/configs/conf.php @@ -62,6 +62,8 @@ class Config { $CC_CONFIG['baseUrl'] = $values['general']['base_url']; $CC_CONFIG['basePort'] = $values['general']['base_port']; + $CC_CONFIG['cache_ahead_hours'] = $values['general']['cache_ahead_hours']; + // Database config $CC_CONFIG['dsn']['username'] = $values['database']['dbuser']; $CC_CONFIG['dsn']['password'] = $values['database']['dbpass']; diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 2fe7b576f..204d5d983 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -609,7 +609,17 @@ class Application_Model_Schedule { } if (is_null($p_fromDateTime)) { $t2 = new DateTime("@".time()); - $t2->add(new DateInterval("PT30M")); + + $cache_ahead_hours = $CC_CONFIG["cache_ahead_hours"]; + + if (is_numeric($cache_ahead_hours)){ + //make sure we are not dealing with a float + $cache_ahead_hours = intval($cache_ahead_hours); + } else { + $cache_ahead_hours = 1; + } + + $t2->add(new DateInterval("PT".$cache_ahead_hours."H")); $range_end = $t2->format("Y-m-d H:i:s"); } else { $range_end = Application_Model_Schedule::PypoTimeToAirtimeTime($p_toDateTime); diff --git a/airtime_mvc/build/airtime.conf b/airtime_mvc/build/airtime.conf index b11e672ce..2c36648ed 100644 --- a/airtime_mvc/build/airtime.conf +++ b/airtime_mvc/build/airtime.conf @@ -18,6 +18,10 @@ airtime_dir = x base_url = localhost base_port = 80 +#How many hours ahead of time should Airtime playout engine (PYPO) +#cache scheduled media files. +cache_ahead_hours = 1 + [soundcloud] connection_retries = 3 time_between_retries = 60