Merge branch 'master' of dev.sourcefabric.org:airtime

This commit is contained in:
Martin Konecny 2013-05-02 17:31:42 -04:00
commit 1e25d786ee
4 changed files with 34 additions and 23 deletions

View File

@ -351,7 +351,7 @@ class ApiController extends Zend_Controller_Action
$data = Application_Model_Schedule::getSchedule(); $data = Application_Model_Schedule::getSchedule();
header("Content-Type: application/json"); header("Content-Type: application/json");
echo json_encode($data, JSON_FORCE_OBJECT); $data = json_encode($data, JSON_FORCE_OBJECT);
$this->_helper->json->sendJson($data, false, true); $this->_helper->json->sendJson($data, false, true);
} }

View File

@ -155,7 +155,14 @@ class CcShow extends BaseCcShow {
*/ */
public function getCcShowInstancess($criteria = null, PropelPDO $con = null) public function getCcShowInstancess($criteria = null, PropelPDO $con = null)
{ {
if(null === $this->collCcShowInstancess || null !== $criteria) { return CcShowInstancesQuery::create(null, $criteria)
->filterByCcShow($this)
->filterByDbModifiedInstance(false)
->filterByDbEnds(gmdate("Y-m-d H:i:s"), criteria::GREATER_THAN)
->orderByDbId()
->find($con);
/*if(null === $this->collCcShowInstancess || null !== $criteria) {
if ($this->isNew() && null === $this->collCcShowInstancess) { if ($this->isNew() && null === $this->collCcShowInstancess) {
// return empty collection // return empty collection
$this->initCcShowInstancess(); $this->initCcShowInstancess();
@ -172,7 +179,7 @@ class CcShow extends BaseCcShow {
$this->collCcShowInstancess = $collCcShowInstancess; $this->collCcShowInstancess = $collCcShowInstancess;
} }
} }
return $this->collCcShowInstancess; return $this->collCcShowInstancess;*/
} }
public function getInstanceIds() { public function getInstanceIds() {

View File

@ -183,6 +183,9 @@ class Application_Service_ShowService
if (is_null($this->ccShow)) { if (is_null($this->ccShow)) {
$ccShowDays = $this->getShowDaysInRange($populateUntil, $end); $ccShowDays = $this->getShowDaysInRange($populateUntil, $end);
if (count($ccShowDays) > 0) {
$this->ccShow = $ccShowDays[0]->getCcShow();
}
} else { } else {
$ccShowDays = $this->ccShow->getCcShowDays(); $ccShowDays = $this->ccShow->getCcShowDays();
} }
@ -198,22 +201,26 @@ class Application_Service_ShowService
break; break;
case REPEAT_WEEKLY: case REPEAT_WEEKLY:
$this->createRepeatingInstances($day, $populateUntil, REPEAT_WEEKLY, $this->createRepeatingInstances($day, $populateUntil, REPEAT_WEEKLY,
new DateInterval("P7D"), $daysAdded, $fillInstances); new DateInterval("P7D"), $daysAdded);
break; break;
case REPEAT_BI_WEEKLY: case REPEAT_BI_WEEKLY:
$this->createRepeatingInstances($day, $populateUntil, REPEAT_BI_WEEKLY, $this->createRepeatingInstances($day, $populateUntil, REPEAT_BI_WEEKLY,
new DateInterval("P14D"), $daysAdded, $fillInstances); new DateInterval("P14D"), $daysAdded);
break; break;
case REPEAT_MONTHLY_MONTHLY: case REPEAT_MONTHLY_MONTHLY:
$this->createMonthlyMonthlyRepeatInstances($day, $populateUntil, $fillInstances); $this->createMonthlyMonthlyRepeatInstances($day, $populateUntil);
break; break;
case REPEAT_MONTHLY_WEEKLY: case REPEAT_MONTHLY_WEEKLY:
$this->createRepeatingInstances($day, $populateUntil, REPEAT_MONTHLY_WEEKLY, $this->createRepeatingInstances($day, $populateUntil, REPEAT_MONTHLY_WEEKLY,
null, $daysAdded, $fillInstances); null, $daysAdded);
break; break;
} }
} }
if (isset($this->ccShow) && ($this->isUpdate || $fillInstances)) {
Application_Service_SchedulerService::fillLinkedShows(
$this->ccShow);
}
return $this->ccShow; return $this->ccShow;
} }
@ -230,6 +237,7 @@ class Application_Service_ShowService
$c = new Criteria(); $c = new Criteria();
$c->add(CcShowDaysPeer::FIRST_SHOW, $endTimeString, Criteria::LESS_THAN); $c->add(CcShowDaysPeer::FIRST_SHOW, $endTimeString, Criteria::LESS_THAN);
$c->addAnd(CcShowDaysPeer::LAST_SHOW, $startTimeString, Criteria::GREATER_THAN); $c->addAnd(CcShowDaysPeer::LAST_SHOW, $startTimeString, Criteria::GREATER_THAN);
$c->addAnd(CcShowDaysPeer::REPEAT_TYPE, -1, Criteria::NOT_EQUAL);
$c->addOr(CcShowDaysPeer::LAST_SHOW, null, Criteria::ISNULL); $c->addOr(CcShowDaysPeer::LAST_SHOW, null, Criteria::ISNULL);
return CcShowDaysPeer::doSelect($c); return CcShowDaysPeer::doSelect($c);
@ -789,6 +797,7 @@ SQL;
if ($this->isUpdate) { if ($this->isUpdate) {
$ccShowInstance = $this->getInstance($utcStartDateTime); $ccShowInstance = $this->getInstance($utcStartDateTime);
} }
$ccShowInstance->setDbShowId($this->ccShow->getDbId()); $ccShowInstance->setDbShowId($this->ccShow->getDbId());
$ccShowInstance->setDbStarts($utcStartDateTime); $ccShowInstance->setDbStarts($utcStartDateTime);
$ccShowInstance->setDbEnds($utcEndDateTime); $ccShowInstance->setDbEnds($utcEndDateTime);
@ -815,7 +824,7 @@ SQL;
* @param unknown_type $isRebroadcast * @param unknown_type $isRebroadcast
*/ */
private function createRepeatingInstances($showDay, $populateUntil, private function createRepeatingInstances($showDay, $populateUntil,
$repeatType, $repeatInterval, $daysAdded=null, $fillInstances) $repeatType, $repeatInterval, $daysAdded=null)
{ {
$show_id = $showDay->getDbShowId(); $show_id = $showDay->getDbShowId();
$first_show = $showDay->getDbFirstShow(); //non-UTC $first_show = $showDay->getDbFirstShow(); //non-UTC
@ -899,11 +908,6 @@ SQL;
$utcStartDateTime->setTimezone(new DateTimeZone(Application_Model_Preference::GetTimezone())); $utcStartDateTime->setTimezone(new DateTimeZone(Application_Model_Preference::GetTimezone()));
$nextDate = $utcStartDateTime->add($repeatInterval); $nextDate = $utcStartDateTime->add($repeatInterval);
$this->setNextRepeatingShowDate($nextDate->format("Y-m-d"), $day, $show_id); $this->setNextRepeatingShowDate($nextDate->format("Y-m-d"), $day, $show_id);
if ($fillInstances) {
Application_Service_SchedulerService::fillLinkedShows(
$showDay->getCcShow());
}
} }
private function createMonthlyMonthlyRepeatInstances($showDay, $populateUntil) private function createMonthlyMonthlyRepeatInstances($showDay, $populateUntil)

View File

@ -126,12 +126,12 @@ def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, de
%include "mp3.liq" %include "mp3.liq"
elsif type == "ogg" then elsif type == "ogg" then
%include "ogg.liq" %include "ogg.liq"
elsif type == "opus" then #elsif type == "opus" then
%include "opus.liq" # %include "opus.liq"
elsif type == "aac" then #elsif type == "aac" then
%include "aac.liq" # %include "aac.liq"
else #else
%include "aacplus.liq" # %include "aacplus.liq"
end end
else else
user_ref = ref user user_ref = ref user
@ -165,10 +165,10 @@ def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, de
if type == "mp3" then if type == "mp3" then
%include "mp3.liq" %include "mp3.liq"
elsif type == "aac" then #elsif type == "aac" then
%include "aac.liq" # %include "aac.liq"
else #else
%include "aacplus.liq" # %include "aacplus.liq"
end end
end end
end end