Merge branch 'master' into CC-2301
This commit is contained in:
commit
92ef0608d6
12
CREDITS
12
CREDITS
|
@ -22,6 +22,18 @@ Mikayel Karapetian (michael.karapetian@sourcefabric.org)
|
|||
Daniel James (daniel.james@sourcefabric.org)
|
||||
Role: Documentor & QA
|
||||
|
||||
Localizations:
|
||||
|
||||
Albert (French)
|
||||
Helmut Müller, Christoph Rombach, Micz Flor (German)
|
||||
Claudia Cruz (Spanish)
|
||||
Katerina Michailidis (Greek)
|
||||
Erich Pöttinger (Austrian)
|
||||
Luba Sirina (Russian)
|
||||
Luciano De Fazio (Brazilian Portuguese)
|
||||
Sebastian Matuszewski (Polish)
|
||||
Staff Pingu (Italian)
|
||||
|
||||
Version 2.2.1
|
||||
-------------
|
||||
Martin Konecny (martin.konecny@sourcefabric.org)
|
||||
|
|
|
@ -266,7 +266,7 @@ class Application_Common_DateHelper
|
|||
|
||||
public static function ConvertToLocalDateTime($p_dateString){
|
||||
$dateTime = new DateTime($p_dateString, new DateTimeZone("UTC"));
|
||||
$dateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
$dateTime->setTimezone(new DateTimeZone(Application_Model_Preference::GetTimezone()));
|
||||
|
||||
return $dateTime;
|
||||
}
|
||||
|
|
|
@ -64,13 +64,8 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
public function versionAction()
|
||||
{
|
||||
// disable the view and the layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$jsonStr = json_encode( array(
|
||||
$this->_helper->json->sendJson( array(
|
||||
"version" => Application_Model_Preference::GetAirtimeVersion()));
|
||||
echo $jsonStr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -79,9 +74,6 @@ class ApiController extends Zend_Controller_Action
|
|||
*/
|
||||
public function calendarInitAction()
|
||||
{
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
if (is_null(Zend_Auth::getInstance()->getStorage()->read())) {
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
print _('You are not allowed to access this resource.');
|
||||
|
@ -96,6 +88,8 @@ class ApiController extends Zend_Controller_Action
|
|||
"timeInterval" => Application_Model_Preference::GetCalendarTimeInterval(),
|
||||
"weekStartDay" => Application_Model_Preference::GetWeekStartDay()
|
||||
);
|
||||
|
||||
$this->_helper->json->sendJson(array());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -106,13 +100,9 @@ class ApiController extends Zend_Controller_Action
|
|||
*/
|
||||
public function getMediaAction()
|
||||
{
|
||||
// disable the view and the layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$fileId = $this->_getParam("file");
|
||||
|
||||
$media = Application_Model_StoredFile::Recall($fileId);
|
||||
$media = Application_Model_StoredFile::RecallById($fileId);
|
||||
if ($media != null) {
|
||||
|
||||
$filepath = $media->getFilePath();
|
||||
|
@ -150,7 +140,7 @@ class ApiController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
return;
|
||||
$this->_helper->json->sendJson(array());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -358,21 +348,15 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
public function scheduleAction()
|
||||
{
|
||||
// disable the view and the layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$data = Application_Model_Schedule::getSchedule();
|
||||
header("Content-Type: application/json");
|
||||
|
||||
echo json_encode($data, JSON_FORCE_OBJECT);
|
||||
$this->_helper->json->sendJson($data, false, true);
|
||||
}
|
||||
|
||||
public function notifyMediaItemStartPlayAction()
|
||||
{
|
||||
// disable the view and the layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$media_id = $this->_getParam("media_id");
|
||||
Logging::debug("Received notification of new media item start: $media_id");
|
||||
Application_Model_Schedule::UpdateMediaPlayedStatus($media_id);
|
||||
|
@ -385,7 +369,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$file_id = Application_Model_Schedule::GetFileId($media_id);
|
||||
if (!is_null($file_id)) {
|
||||
//we are dealing with a file not a stream
|
||||
$file = Application_Model_StoredFile::Recall($file_id);
|
||||
$file = Application_Model_StoredFile::RecallById($file_id);
|
||||
$now = new DateTime("now", new DateTimeZone("UTC"));
|
||||
$file->setLastPlayedTime($now);
|
||||
}
|
||||
|
@ -402,7 +386,7 @@ class ApiController extends Zend_Controller_Action
|
|||
Logging::info($e);
|
||||
}
|
||||
|
||||
echo json_encode(array("status"=>1, "message"=>""));
|
||||
$this->_helper->json->sendJson(array("status"=>1, "message"=>""));
|
||||
}
|
||||
|
||||
public function recordedShowsAction()
|
||||
|
@ -460,7 +444,7 @@ class ApiController extends Zend_Controller_Action
|
|||
public function uploadRecordedActionParam($show_instance_id, $file_id)
|
||||
{
|
||||
$showCanceled = false;
|
||||
$file = Application_Model_StoredFile::Recall($file_id);
|
||||
$file = Application_Model_StoredFile::RecallById($file_id);
|
||||
//$show_instance = $this->_getParam('show_instance');
|
||||
|
||||
try {
|
||||
|
@ -490,10 +474,6 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
public function mediaMonitorSetupAction()
|
||||
{
|
||||
// disable the view and the layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$this->view->stor = Application_Model_MusicDir::getStorDir()->getDirectory();
|
||||
|
||||
$watchedDirs = Application_Model_MusicDir::getWatchedDirs();
|
||||
|
@ -508,81 +488,88 @@ class ApiController extends Zend_Controller_Action
|
|||
{
|
||||
$return_hash = array();
|
||||
Application_Model_Preference::SetImportTimestamp();
|
||||
//Logging::info("--->Mode: $mode || file: {$md['MDATA_KEY_FILEPATH']} ");
|
||||
//Logging::info( $md );
|
||||
|
||||
// create also modifies the file if it exists
|
||||
if ($mode == "create") {
|
||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||
$filepath = Application_Common_OsPath::normpath($filepath);
|
||||
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
|
||||
if (is_null($file)) {
|
||||
$file = Application_Model_StoredFile::Insert($md);
|
||||
} else {
|
||||
// If the file already exists we will update and make sure that
|
||||
// it's marked as 'exists'.
|
||||
$file->setFileExistsFlag(true);
|
||||
$file->setFileHiddenFlag(false);
|
||||
$file->setMetadata($md);
|
||||
}
|
||||
if ($md['is_record'] != 0) {
|
||||
$this->uploadRecordedActionParam($md['MDATA_KEY_TRACKNUMBER'], $file->getId());
|
||||
}
|
||||
|
||||
} elseif ($mode == "modify") {
|
||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
|
||||
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME);
|
||||
$con->beginTransaction();
|
||||
try {
|
||||
// create also modifies the file if it exists
|
||||
if ($mode == "create") {
|
||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||
$filepath = Application_Common_OsPath::normpath($filepath);
|
||||
$file = Application_Model_StoredFile::RecallByFilepath($filepath, $con);
|
||||
if (is_null($file)) {
|
||||
$file = Application_Model_StoredFile::Insert($md, $con);
|
||||
} else {
|
||||
// If the file already exists we will update and make sure that
|
||||
// it's marked as 'exists'.
|
||||
$file->setFileExistsFlag(true);
|
||||
$file->setFileHiddenFlag(false);
|
||||
$file->setMetadata($md);
|
||||
}
|
||||
if ($md['is_record'] != 0) {
|
||||
$this->uploadRecordedActionParam($md['MDATA_KEY_TRACKNUMBER'], $file->getId());
|
||||
}
|
||||
|
||||
} elseif ($mode == "modify") {
|
||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||
$file = Application_Model_StoredFile::RecallByFilepath($filepath, $con);
|
||||
|
||||
//File is not in database anymore.
|
||||
if (is_null($file)) {
|
||||
$return_hash['error'] = _("File does not exist in Airtime.");
|
||||
//File is not in database anymore.
|
||||
if (is_null($file)) {
|
||||
$return_hash['error'] = _("File does not exist in Airtime.");
|
||||
|
||||
return $return_hash;
|
||||
}
|
||||
//Updating a metadata change.
|
||||
else {
|
||||
$file->setMetadata($md);
|
||||
}
|
||||
} elseif ($mode == "moved") {
|
||||
$file = Application_Model_StoredFile::RecallByFilepath(
|
||||
$md['MDATA_KEY_ORIGINAL_PATH']);
|
||||
return $return_hash;
|
||||
}
|
||||
//Updating a metadata change.
|
||||
else {
|
||||
$file->setMetadata($md);
|
||||
}
|
||||
} elseif ($mode == "moved") {
|
||||
$file = Application_Model_StoredFile::RecallByFilepath(
|
||||
$md['MDATA_KEY_ORIGINAL_PATH'], $con);
|
||||
|
||||
if (is_null($file)) {
|
||||
$return_hash['error'] = _('File does not exist in Airtime');
|
||||
} else {
|
||||
if (is_null($file)) {
|
||||
$return_hash['error'] = _('File does not exist in Airtime');
|
||||
} else {
|
||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||
//$filepath = str_replace("\\", "", $filepath);
|
||||
$file->setFilePath($filepath);
|
||||
}
|
||||
} elseif ($mode == "delete") {
|
||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||
$filepath = str_replace("\\", "", $filepath);
|
||||
$file = Application_Model_StoredFile::RecallByFilepath($filepath, $con);
|
||||
|
||||
if (is_null($file)) {
|
||||
$return_hash['error'] = _("File doesn't exist in Airtime.");
|
||||
Logging::warn("Attempt to delete file that doesn't exist.
|
||||
Path: '$filepath'");
|
||||
|
||||
return $return_hash;
|
||||
} else {
|
||||
$file->deleteByMediaMonitor();
|
||||
}
|
||||
} elseif ($mode == "delete_dir") {
|
||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||
//$filepath = str_replace("\\", "", $filepath);
|
||||
$file->setFilePath($filepath);
|
||||
}
|
||||
} elseif ($mode == "delete") {
|
||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||
$filepath = str_replace("\\", "", $filepath);
|
||||
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
|
||||
$files = Application_Model_StoredFile::RecallByPartialFilepath($filepath, $con);
|
||||
|
||||
if (is_null($file)) {
|
||||
$return_hash['error'] = _("File doesn't exist in Airtime.");
|
||||
Logging::warn("Attempt to delete file that doesn't exist.
|
||||
Path: '$filepath'");
|
||||
foreach ($files as $file) {
|
||||
$file->deleteByMediaMonitor();
|
||||
}
|
||||
$return_hash['success'] = 1;
|
||||
|
||||
return $return_hash;
|
||||
} else {
|
||||
$file->deleteByMediaMonitor();
|
||||
}
|
||||
} elseif ($mode == "delete_dir") {
|
||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||
//$filepath = str_replace("\\", "", $filepath);
|
||||
$files = Application_Model_StoredFile::RecallByPartialFilepath($filepath);
|
||||
|
||||
foreach ($files as $file) {
|
||||
$file->deleteByMediaMonitor();
|
||||
}
|
||||
$return_hash['success'] = 1;
|
||||
|
||||
return $return_hash;
|
||||
$return_hash['fileid'] = is_null($file) ? '-1' : $file->getId();
|
||||
$con->commit();
|
||||
} catch (Exception $e) {
|
||||
Logging::warn("rolling back");
|
||||
Logging::warn($e->getMessage());
|
||||
$con->rollback();
|
||||
$return_hash['error'] = $e->getMessage();
|
||||
}
|
||||
|
||||
$return_hash['fileid'] = is_null($file) ? '-1' : $file->getId();
|
||||
|
||||
return $return_hash;
|
||||
}
|
||||
|
||||
|
@ -601,6 +588,7 @@ class ApiController extends Zend_Controller_Action
|
|||
// least 1 digit
|
||||
if ( !preg_match('/^md\d+$/', $k) ) { continue; }
|
||||
$info_json = json_decode($raw_json, $assoc = true);
|
||||
|
||||
// Log invalid requests
|
||||
if ( !array_key_exists('mode', $info_json) ) {
|
||||
Logging::info("Received bad request(key=$k), no 'mode' parameter. Bad request is:");
|
||||
|
@ -624,7 +612,12 @@ class ApiController extends Zend_Controller_Action
|
|||
// Removing 'mode' key from $info_json might not be necessary...
|
||||
$mode = $info_json['mode'];
|
||||
unset( $info_json['mode'] );
|
||||
$response = $this->dispatchMetadata($info_json, $mode);
|
||||
try {
|
||||
$response = $this->dispatchMetadata($info_json, $mode);
|
||||
} catch (Exception $e) {
|
||||
Logging::warn($e->getMessage());
|
||||
Logging::warn(gettype($e));
|
||||
}
|
||||
// We tack on the 'key' back to every request in case the would like to associate
|
||||
// his requests with particular responses
|
||||
$response['key'] = $k;
|
||||
|
@ -726,7 +719,7 @@ class ApiController extends Zend_Controller_Action
|
|||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$msg = $request->getParam('msg');
|
||||
$msg = $request->getParam('msg_post');
|
||||
$stream_id = $request->getParam('stream_id');
|
||||
$boot_time = $request->getParam('boot_time');
|
||||
|
||||
|
@ -922,72 +915,72 @@ class ApiController extends Zend_Controller_Action
|
|||
* out a message to pypo that a potential change has been made. */
|
||||
public function getFilesWithoutReplayGainAction()
|
||||
{
|
||||
// disable the view and the layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$dir_id = $this->_getParam('dir_id');
|
||||
|
||||
//connect to db and get get sql
|
||||
$rows = Application_Model_StoredFile::listAllFiles2($dir_id, 100);
|
||||
|
||||
echo json_encode($rows);
|
||||
$this->_helper->json->sendJson($rows);
|
||||
}
|
||||
|
||||
public function getFilesWithoutSilanValueAction()
|
||||
{
|
||||
// disable the view and the layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
//connect to db and get get sql
|
||||
$rows = Application_Model_StoredFile::getAllFilesWithoutSilan();
|
||||
|
||||
echo json_encode($rows);
|
||||
$this->_helper->json->sendJson($rows);
|
||||
}
|
||||
|
||||
public function updateReplayGainValueAction()
|
||||
{
|
||||
// disable the view and the layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
$data = json_decode($request->getParam('data'));
|
||||
|
||||
foreach ($data as $pair) {
|
||||
list($id, $gain) = $pair;
|
||||
// TODO : move this code into model -- RG
|
||||
$file = Application_Model_StoredFile::Recall($p_id = $id)->getPropelOrm();
|
||||
$file = Application_Model_StoredFile::RecallById($p_id = $id)->getPropelOrm();
|
||||
$file->setDbReplayGain($gain);
|
||||
$file->save();
|
||||
}
|
||||
|
||||
$this->view->msg = "OK";
|
||||
$this->_helper->json->sendJson(array());
|
||||
}
|
||||
|
||||
public function updateCueValuesBySilanAction()
|
||||
{
|
||||
// disable the view and the layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
$data = json_decode($request->getParam('data'));
|
||||
$data = json_decode($request->getParam('data'), $assoc = true);
|
||||
|
||||
foreach ($data as $pair) {
|
||||
list($id, $info) = $pair;
|
||||
// TODO : move this code into model -- RG
|
||||
$cuein = $info->cuein;
|
||||
$cueout = $info->cueout;
|
||||
$file = Application_Model_StoredFile::Recall($p_id = $id)->getPropelOrm();
|
||||
$file = Application_Model_StoredFile::RecallById($p_id = $id)->getPropelOrm();
|
||||
|
||||
//What we are doing here is setting a more accurate length that was
|
||||
//calculated with silan by actually scanning the entire file. This
|
||||
//process takes a really long time, and so we only do it in the background
|
||||
//after the file has already been imported -MK
|
||||
$length = $file->getDbLength();
|
||||
if (isset($info['length'])) {
|
||||
$length = $info['length'];
|
||||
//length decimal number in seconds. Need to convert it to format
|
||||
//HH:mm:ss to get around silly PHP limitations.
|
||||
$length = Application_Common_DateHelper::secondsToPlaylistTime($length);
|
||||
|
||||
$file->setDbLength($length);
|
||||
}
|
||||
|
||||
$cuein = isset($info['cuein']) ? $info['cuein'] : 0;
|
||||
$cueout = isset($info['cueout']) ? $info['cueout'] : $length;
|
||||
|
||||
$file->setDbCuein($cuein);
|
||||
$file->setDbCueout($cueout);
|
||||
$file->setDbSilanCheck(true);
|
||||
$file->save();
|
||||
}
|
||||
|
||||
echo json_encode(array());
|
||||
$this->_helper->json->sendJson(array());
|
||||
}
|
||||
|
||||
public function notifyWebstreamDataAction()
|
||||
|
@ -1056,5 +1049,4 @@ class ApiController extends Zend_Controller_Action
|
|||
Application_Model_StreamSetting::SetListenerStatError($k, $v);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ class AudiopreviewController extends Zend_Controller_Action
|
|||
|
||||
if ($type == "audioclip") {
|
||||
$uri = $baseUrl."api/get-media/file/".$audioFileID;
|
||||
$media = Application_Model_StoredFile::Recall($audioFileID);
|
||||
$media = Application_Model_StoredFile::RecallById($audioFileID);
|
||||
$mime = $media->getPropelOrm()->getDbMime();
|
||||
} elseif ($type == "stream") {
|
||||
$webstream = CcWebstreamQuery::create()->findPk($audioFileID);
|
||||
|
|
|
@ -90,10 +90,6 @@ class DashboardController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
public function switchOffSource()
|
||||
{
|
||||
}
|
||||
|
||||
public function streamPlayerAction()
|
||||
{
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
|
|
|
@ -195,7 +195,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
if ($type === "audioclip") {
|
||||
|
||||
$file = Application_Model_StoredFile::Recall($id);
|
||||
$file = Application_Model_StoredFile::RecallById($id);
|
||||
|
||||
$menu["play"]["mime"] = $file->getPropelOrm()->getDbMime();
|
||||
|
||||
|
@ -353,7 +353,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
foreach ($files as $id) {
|
||||
|
||||
$file = Application_Model_StoredFile::Recall($id);
|
||||
$file = Application_Model_StoredFile::RecallById($id);
|
||||
|
||||
if (isset($file)) {
|
||||
try {
|
||||
|
@ -425,7 +425,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
$request = $this->getRequest();
|
||||
|
||||
$file_id = $this->_getParam('id', null);
|
||||
$file = Application_Model_StoredFile::Recall($file_id);
|
||||
$file = Application_Model_StoredFile::RecallById($file_id);
|
||||
|
||||
if (!$isAdminOrPM && $file->getFileOwnerId() != $user->getId()) {
|
||||
return;
|
||||
|
@ -467,7 +467,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
try {
|
||||
if ($type == "audioclip") {
|
||||
$file = Application_Model_StoredFile::Recall($id);
|
||||
$file = Application_Model_StoredFile::RecallById($id);
|
||||
$this->view->type = $type;
|
||||
$md = $file->getMetadata();
|
||||
|
||||
|
@ -551,7 +551,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
$this->view->error_code = $file->getSoundCloudErrorCode();
|
||||
$this->view->error_msg = $file->getSoundCloudErrorMsg();
|
||||
} elseif ($type == "file") {
|
||||
$file = Application_Model_StoredFile::Recall($id);
|
||||
$file = Application_Model_StoredFile::RecallById($id);
|
||||
$this->view->sc_id = $file->getSoundCloudId();
|
||||
$this->view->error_code = $file->getSoundCloudErrorCode();
|
||||
$this->view->error_msg = $file->getSoundCloudErrorMsg();
|
||||
|
|
|
@ -165,16 +165,25 @@ class PreferenceController extends Zend_Controller_Action
|
|||
foreach ($temp as $t) {
|
||||
$setting[$t['keyname']] = $t['value'];
|
||||
}
|
||||
|
||||
$name_map = array('ogg' => 'Ogg Vorbis',
|
||||
'aacplus' => 'AAC+',
|
||||
'aac' => 'AAC',
|
||||
'opus' => 'Opus',
|
||||
'mp3' => 'MP3'
|
||||
);
|
||||
|
||||
// get predefined type and bitrate from pref table
|
||||
$temp_types = Application_Model_Preference::GetStreamType();
|
||||
$stream_types = array();
|
||||
foreach ($temp_types as $type) {
|
||||
if (trim($type) == "ogg") {
|
||||
$temp = "OGG/VORBIS";
|
||||
$type = strtolower(trim($type));
|
||||
if (isset($name_map[$type])) {
|
||||
$name = $name_map[$type];
|
||||
} else {
|
||||
$temp = strtoupper(trim($type));
|
||||
$name = $type;
|
||||
}
|
||||
$stream_types[trim($type)] = $temp;
|
||||
$stream_types[$type] = $name;
|
||||
}
|
||||
|
||||
$temp_bitrate = Application_Model_Preference::GetStreamBitrate();
|
||||
|
|
|
@ -16,21 +16,21 @@ class ScheduleController extends Zend_Controller_Action
|
|||
->addActionContext('edit-show', 'json')
|
||||
->addActionContext('move-show', 'json')
|
||||
->addActionContext('resize-show', 'json')
|
||||
->addActionContext('delete-show', 'json')
|
||||
->addActionContext('delete-show-instance', 'json')
|
||||
->addActionContext('show-content-dialog', 'json')
|
||||
->addActionContext('clear-show', 'json')
|
||||
->addActionContext('get-current-playlist', 'json')
|
||||
->addActionContext('remove-group', 'json')
|
||||
->addActionContext('populate-show-form', 'json')
|
||||
->addActionContext('populate-show-instance-form', 'json')
|
||||
->addActionContext('cancel-show', 'json')
|
||||
->addActionContext('populate-repeating-show-instance-form', 'json')
|
||||
->addActionContext('delete-show', 'json')
|
||||
->addActionContext('cancel-current-show', 'json')
|
||||
->addActionContext('get-form', 'json')
|
||||
->addActionContext('upload-to-sound-cloud', 'json')
|
||||
->addActionContext('content-context-menu', 'json')
|
||||
->addActionContext('set-time-scale', 'json')
|
||||
->addActionContext('set-time-interval', 'json')
|
||||
->addActionContext('edit-show-instance', 'json')
|
||||
->addActionContext('edit-repeating-show-instance', 'json')
|
||||
->addActionContext('dj-edit-show', 'json')
|
||||
->addActionContext('calculate-duration', 'json')
|
||||
->addActionContext('get-current-show', 'json')
|
||||
|
@ -90,13 +90,14 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$this->view->headLink()->appendStylesheet($baseUrl.'css/showbuilder.css?'.$CC_CONFIG['airtime_version']);
|
||||
//End Show builder JS/CSS requirements
|
||||
|
||||
$this->createShowFormAction(true);
|
||||
|
||||
Application_Model_Schedule::createNewFormSections($this->view);
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
$this->view->preloadShowForm = true;
|
||||
}
|
||||
|
||||
$this->view->addNewShow = true;
|
||||
$this->view->headScript()->appendScript(
|
||||
"var calendarPref = {};\n".
|
||||
"calendarPref.weekStart = ".Application_Model_Preference::GetWeekStartDay().";\n".
|
||||
|
@ -111,16 +112,17 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
public function eventFeedAction()
|
||||
{
|
||||
$service_user = new Application_Service_UserService();
|
||||
$currentUser = $service_user->getCurrentUser();
|
||||
|
||||
$start = new DateTime($this->_getParam('start', null));
|
||||
$start->setTimezone(new DateTimeZone("UTC"));
|
||||
$end = new DateTime($this->_getParam('end', null));
|
||||
$end->setTimezone(new DateTimeZone("UTC"));
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
$editable = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||
$events = &Application_Model_Show::getFullCalendarEvents($start, $end,
|
||||
$currentUser->isAdminOrPM());
|
||||
|
||||
$events = &Application_Model_Show::getFullCalendarEvents($start, $end, $editable);
|
||||
$this->view->events = $events;
|
||||
}
|
||||
|
||||
|
@ -161,22 +163,16 @@ class ScheduleController extends Zend_Controller_Action
|
|||
{
|
||||
$deltaDay = $this->_getParam('day');
|
||||
$deltaMin = $this->_getParam('min');
|
||||
$showInstanceId = $this->_getParam('showInstanceId');
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
try {
|
||||
$showInstance = new Application_Model_ShowInstance($showInstanceId);
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
$error = $showInstance->moveShow($deltaDay, $deltaMin);
|
||||
try {
|
||||
$service_calendar = new Application_Service_CalendarService(
|
||||
$this->_getParam('showInstanceId'));
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
$error = $service_calendar->moveShow($deltaDay, $deltaMin);
|
||||
if (isset($error)) {
|
||||
$this->view->error = $error;
|
||||
}
|
||||
|
@ -207,28 +203,17 @@ class ScheduleController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
public function deleteShowAction()
|
||||
public function deleteShowInstanceAction()
|
||||
{
|
||||
$showInstanceId = $this->_getParam('id');
|
||||
$instanceId = $this->_getParam('id');
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
$service_show = new Application_Service_ShowService();
|
||||
$showId = $service_show->deleteShow($instanceId, true);
|
||||
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
|
||||
try {
|
||||
$showInstance = new Application_Model_ShowInstance($showInstanceId);
|
||||
} catch (Exception $e) {
|
||||
Logging::info($e->getMessage());
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$showInstance->delete();
|
||||
|
||||
$this->view->show_id = $showInstance->getShowId();
|
||||
if (!$showId) {
|
||||
$this->view->show_error = true;
|
||||
}
|
||||
$this->view->show_id = $showId;
|
||||
}
|
||||
|
||||
public function uploadToSoundCloudAction()
|
||||
|
@ -251,124 +236,23 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
public function makeContextMenuAction()
|
||||
{
|
||||
$id = $this->_getParam('id');
|
||||
$menu = array();
|
||||
$epochNow = time();
|
||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||
$instanceId = $this->_getParam('instanceId');
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
try {
|
||||
$instance = new Application_Model_ShowInstance($id);
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
$service_calendar = new Application_Service_CalendarService($instanceId);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||
$isDJ = $user->isHostOfShow($instance->getShowId());
|
||||
|
||||
$showStartLocalDT = Application_Common_DateHelper::ConvertToLocalDateTime($instance->getShowInstanceStart());
|
||||
$showEndLocalDT = Application_Common_DateHelper::ConvertToLocalDateTime($instance->getShowInstanceEnd());
|
||||
|
||||
if ($instance->isRecorded() && $epochNow > $showEndLocalDT->getTimestamp()) {
|
||||
|
||||
$file = $instance->getRecordedFile();
|
||||
$fileId = $file->getId();
|
||||
|
||||
$menu["view_recorded"] = array("name" => _("View Recorded File Metadata"), "icon" => "overview",
|
||||
"url" => $baseUrl."library/edit-file-md/id/".$fileId);
|
||||
}
|
||||
|
||||
if ($epochNow < $showStartLocalDT->getTimestamp()) {
|
||||
if ( ($isAdminOrPM || $isDJ)
|
||||
&& !$instance->isRecorded()
|
||||
&& !$instance->isRebroadcast()) {
|
||||
|
||||
$menu["schedule"] = array("name"=> _("Add / Remove Content"), "icon" => "add-remove-content",
|
||||
"url" => $baseUrl."showbuilder/builder-dialog/");
|
||||
|
||||
$menu["clear"] = array("name"=> _("Remove All Content"), "icon" => "remove-all-content",
|
||||
"url" => $baseUrl."schedule/clear-show");
|
||||
}
|
||||
}
|
||||
|
||||
if (!$instance->isRecorded()) {
|
||||
|
||||
$menu["content"] = array("name"=> _("Show Content"), "icon" => "overview", "url" => $baseUrl."schedule/show-content-dialog");
|
||||
}
|
||||
|
||||
if ($showEndLocalDT->getTimestamp() <= $epochNow
|
||||
&& $instance->isRecorded()
|
||||
&& Application_Model_Preference::GetUploadToSoundcloudOption()) {
|
||||
|
||||
$file = $instance->getRecordedFile();
|
||||
$fileId = $file->getId();
|
||||
$scid = $instance->getSoundCloudFileId();
|
||||
|
||||
if ($scid > 0) {
|
||||
$url = $file->getSoundCloudLinkToFile();
|
||||
$menu["soundcloud_view"] = array("name" => _("View on Soundcloud"), "icon" => "soundcloud", "url" => $url);
|
||||
}
|
||||
|
||||
$text = is_null($scid) ? _('Upload to SoundCloud') : _('Re-upload to SoundCloud');
|
||||
$menu["soundcloud_upload"] = array("name"=> $text, "icon" => "soundcloud");
|
||||
}
|
||||
|
||||
if ($showStartLocalDT->getTimestamp() <= $epochNow &&
|
||||
$epochNow < $showEndLocalDT->getTimestamp() && $isAdminOrPM) {
|
||||
|
||||
if ($instance->isRecorded()) {
|
||||
$menu["cancel_recorded"] = array("name"=> _("Cancel Current Show"), "icon" => "delete");
|
||||
} else {
|
||||
|
||||
if (!$instance->isRebroadcast()) {
|
||||
$menu["edit"] = array("name"=> _("Edit Show"), "icon" => "edit", "_type"=>"all", "url" => $baseUrl."Schedule/populate-show-form");
|
||||
}
|
||||
|
||||
$menu["cancel"] = array("name"=> _("Cancel Current Show"), "icon" => "delete");
|
||||
}
|
||||
}
|
||||
|
||||
if ($epochNow < $showStartLocalDT->getTimestamp()) {
|
||||
|
||||
if (!$instance->isRebroadcast() && $isAdminOrPM) {
|
||||
$menu["edit"] = array("name"=> _("Edit Show"), "icon" => "edit", "_type"=>"all", "url" => $baseUrl."Schedule/populate-show-form");
|
||||
}
|
||||
|
||||
if ($instance->getShow()->isRepeating() && $isAdminOrPM) {
|
||||
|
||||
//create delete sub menu.
|
||||
$menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "items" => array());
|
||||
|
||||
$menu["del"]["items"]["single"] = array("name"=> _("Delete This Instance"), "icon" => "delete", "url" => $baseUrl."schedule/delete-show");
|
||||
|
||||
$menu["del"]["items"]["following"] = array("name"=> _("Delete This Instance and All Following"), "icon" => "delete", "url" => $baseUrl."schedule/cancel-show");
|
||||
} elseif ($isAdminOrPM) {
|
||||
|
||||
$menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."schedule/delete-show");
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->items = $menu;
|
||||
$this->view->items = $service_calendar->makeContextMenu();
|
||||
}
|
||||
|
||||
public function clearShowAction()
|
||||
{
|
||||
$showInstanceId = $this->_getParam('id');
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
try {
|
||||
$show = new Application_Model_ShowInstance($showInstanceId);
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
$instanceId = $this->_getParam('id');
|
||||
|
||||
$service_scheduler = new Application_Service_SchedulerService();
|
||||
|
||||
if (!$service_scheduler->emptyShowContent($instanceId)) {
|
||||
$this->view->show_error = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)) || $user->isHostOfShow($show->getShowId()))
|
||||
$show->clearShow();
|
||||
}
|
||||
|
||||
public function getCurrentPlaylistAction()
|
||||
|
@ -416,32 +300,6 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$this->view->show_name = isset($show[0])?$show[0]["name"]:"";
|
||||
}
|
||||
|
||||
public function removeGroupAction()
|
||||
{
|
||||
$showInstanceId = $this->sched_sess->showInstanceId;
|
||||
$group_id = $this->_getParam('groupId');
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
try {
|
||||
$show = new Application_Model_ShowInstance($showInstanceId);
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)) || $user->isHostOfShow($show->getShowId())) {
|
||||
$show->removeGroupFromShow($group_id);
|
||||
}
|
||||
|
||||
$this->view->showContent = $show->getShowContent();
|
||||
$this->view->timeFilled = $show->getTimeScheduled();
|
||||
$this->view->percentFilled = $show->getPercentScheduled();
|
||||
$this->view->chosen = $this->view->render('schedule/scheduled-content.phtml');
|
||||
unset($this->view->showContent);
|
||||
}
|
||||
|
||||
public function showContentDialogAction()
|
||||
{
|
||||
$showInstanceId = $this->_getParam('id');
|
||||
|
@ -484,256 +342,66 @@ class ScheduleController extends Zend_Controller_Action
|
|||
unset($this->view->showContent);
|
||||
}
|
||||
|
||||
// we removed edit show instance option in menu item
|
||||
// this feature is disabled in 2.1 and should be back in 2.2
|
||||
/*public function populateShowInstanceFormAction(){
|
||||
$formWhat = new Application_Form_AddShowWhat();
|
||||
$formWho = new Application_Form_AddShowWho();
|
||||
$formWhen = new Application_Form_AddShowWhen();
|
||||
$formRepeats = new Application_Form_AddShowRepeats();
|
||||
$formStyle = new Application_Form_AddShowStyle();
|
||||
$formLive = new Application_Form_AddShowLiveStream();
|
||||
public function populateRepeatingShowInstanceFormAction()
|
||||
{
|
||||
$showId = $this->_getParam('showId');
|
||||
$instanceId = $this->_getParam('instanceId');
|
||||
$service_showForm = new Application_Service_ShowFormService($showId, $instanceId);
|
||||
|
||||
$formWhat->removeDecorator('DtDdWrapper');
|
||||
$formWho->removeDecorator('DtDdWrapper');
|
||||
$formWhen->removeDecorator('DtDdWrapper');
|
||||
$formRepeats->removeDecorator('DtDdWrapper');
|
||||
$formStyle->removeDecorator('DtDdWrapper');
|
||||
$forms = $this->createShowFormAction();
|
||||
|
||||
$service_showForm->delegateShowInstanceFormPopulation($forms);
|
||||
|
||||
$this->view->what = $formWhat;
|
||||
$this->view->when = $formWhen;
|
||||
$this->view->repeats = $formRepeats;
|
||||
$this->view->who = $formWho;
|
||||
$this->view->style = $formStyle;
|
||||
$this->view->live = $formLive;
|
||||
$this->view->addNewShow = false;
|
||||
|
||||
$showInstanceId = $this->_getParam('id');
|
||||
|
||||
$show_instance = CcShowInstancesQuery::create()->findPK($showInstanceId);
|
||||
$show = new Application_Model_Show($show_instance->getDbShowId());
|
||||
|
||||
$starts_string = $show_instance->getDbStarts();
|
||||
$ends_string = $show_instance->getDbEnds();
|
||||
|
||||
$starts_datetime = new DateTime($starts_string, new DateTimeZone("UTC"));
|
||||
$ends_datetime = new DateTime($ends_string, new DateTimeZone("UTC"));
|
||||
|
||||
$starts_datetime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
$ends_datetime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
|
||||
$instance_duration = $starts_datetime->diff($ends_datetime);
|
||||
|
||||
$formWhat->populate(array('add_show_id' => $show->getId(),
|
||||
'add_show_instance_id' => $showInstanceId,
|
||||
'add_show_name' => $show->getName(),
|
||||
'add_show_url' => $show->getUrl(),
|
||||
'add_show_genre' => $show->getGenre(),
|
||||
'add_show_description' => $show->getDescription()));
|
||||
|
||||
$formWhen->populate(array('add_show_start_date' => $starts_datetime->format("Y-m-d"),
|
||||
'add_show_start_time' => $starts_datetime->format("H:i"),
|
||||
'add_show_end_date_no_repeat' => $ends_datetime->format("Y-m-d"),
|
||||
'add_show_end_time' => $ends_datetime->format("H:i"),
|
||||
'add_show_duration' => $instance_duration->format("%h")));
|
||||
|
||||
$formWhat->disable();
|
||||
$formWho->disable();
|
||||
$formWhen->disableRepeatCheckbox();
|
||||
$formRepeats->disable();
|
||||
$formStyle->disable();
|
||||
|
||||
//$formRecord->disable();
|
||||
//$formAbsoluteRebroadcast->disable();
|
||||
//$formRebroadcast->disable();
|
||||
|
||||
$this->view->action = "edit-show-instance";
|
||||
$this->view->action = "edit-repeating-show-instance";
|
||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||
}*/
|
||||
}
|
||||
|
||||
public function populateShowFormAction()
|
||||
{
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
$service_user = new Application_Service_UserService();
|
||||
$currentUser = $service_user->getCurrentUser();
|
||||
|
||||
$showInstanceId = $this->_getParam('id');
|
||||
|
||||
$this->view->action = "edit-show";
|
||||
try {
|
||||
$showInstance = new Application_Model_ShowInstance($showInstanceId);
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||
$isDJ = $user->isHostOfShow($showInstance->getShowId());
|
||||
|
||||
if (!($isAdminOrPM || $isDJ)) {
|
||||
return;
|
||||
}
|
||||
$showId = $this->_getParam('showId');
|
||||
$instanceId = $this->_getParam('instanceId');
|
||||
$service_showForm = new Application_Service_ShowFormService($showId, $instanceId);
|
||||
|
||||
$isAdminOrPM = $currentUser->isAdminOrPM();
|
||||
/*$isHostOfShow = $currentUser->isHostOfShow($showId);
|
||||
// in case a user was once a dj and had been assigned to a show
|
||||
// but was then changed to an admin user we need to allow
|
||||
// the user to edit the show as an admin (CC-4925)
|
||||
if ($isDJ && !$isAdminOrPM) {
|
||||
if ($isHostOfShow && !$isAdminOrPM) {
|
||||
$this->view->action = "dj-edit-show";
|
||||
}
|
||||
}*/
|
||||
|
||||
$formWhat = new Application_Form_AddShowWhat();
|
||||
$formWho = new Application_Form_AddShowWho();
|
||||
$formWhen = new Application_Form_AddShowWhen();
|
||||
$formRepeats = new Application_Form_AddShowRepeats();
|
||||
$formStyle = new Application_Form_AddShowStyle();
|
||||
$formLive = new Application_Form_AddShowLiveStream();
|
||||
$forms = $this->createShowFormAction();
|
||||
|
||||
$formWhat->removeDecorator('DtDdWrapper');
|
||||
$formWho->removeDecorator('DtDdWrapper');
|
||||
$formWhen->removeDecorator('DtDdWrapper');
|
||||
$formRepeats->removeDecorator('DtDdWrapper');
|
||||
$formStyle->removeDecorator('DtDdWrapper');
|
||||
|
||||
$this->view->what = $formWhat;
|
||||
$this->view->when = $formWhen;
|
||||
$this->view->repeats = $formRepeats;
|
||||
$this->view->who = $formWho;
|
||||
$this->view->style = $formStyle;
|
||||
$this->view->live = $formLive;
|
||||
$this->view->addNewShow = false;
|
||||
|
||||
$show = new Application_Model_Show($showInstance->getShowId());
|
||||
|
||||
$formWhat->populate(array('add_show_id' => $show->getId(),
|
||||
'add_show_instance_id' => $showInstanceId,
|
||||
'add_show_name' => $show->getName(),
|
||||
'add_show_url' => $show->getUrl(),
|
||||
'add_show_genre' => $show->getGenre(),
|
||||
'add_show_description' => $show->getDescription()));
|
||||
|
||||
$startsDateTime = new DateTime($show->getStartDate()." ".$show->getStartTime(), new DateTimeZone("UTC"));
|
||||
$endsDateTime = new DateTime($show->getEndDate()." ".$show->getEndTime(), new DateTimeZone("UTC"));
|
||||
|
||||
$startsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
$endsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
|
||||
$formWhen->populate(array('add_show_start_date' => $startsDateTime->format("Y-m-d"),
|
||||
'add_show_start_time' => $startsDateTime->format("H:i"),
|
||||
'add_show_end_date_no_repeat' => $endsDateTime->format("Y-m-d"),
|
||||
'add_show_end_time' => $endsDateTime->format("H:i"),
|
||||
'add_show_duration' => $show->getDuration(true),
|
||||
'add_show_repeats' => $show->isRepeating() ? 1 : 0));
|
||||
|
||||
if ($show->isStartDateTimeInPast()) {
|
||||
// for a non-repeating show, we should never allow user to change the start time.
|
||||
// for the repeating show, we should allow because the form works as repeating template form
|
||||
if (!$showInstance->getShow()->isRepeating()) {
|
||||
$formWhen->disableStartDateAndTime();
|
||||
} else {
|
||||
$nextFutureRepeatShow = $show->getNextFutureRepeatShowTime();
|
||||
$formWhen->getElement('add_show_start_date')->setValue($nextFutureRepeatShow["starts"]->format("Y-m-d"));
|
||||
$formWhen->getElement('add_show_start_time')->setValue($nextFutureRepeatShow["starts"]->format("H:i"));
|
||||
$formWhen->getElement('add_show_end_date_no_repeat')->setValue($nextFutureRepeatShow["ends"]->format("Y-m-d"));
|
||||
$formWhen->getElement('add_show_end_time')->setValue($nextFutureRepeatShow["ends"]->format("H:i"));
|
||||
}
|
||||
}
|
||||
|
||||
//need to get the days of the week in the php timezone (for the front end).
|
||||
$days = array();
|
||||
$showDays = CcShowDaysQuery::create()->filterByDbShowId($showInstance->getShowId())->find();
|
||||
foreach ($showDays as $showDay) {
|
||||
$showStartDay = new DateTime($showDay->getDbFirstShow(), new DateTimeZone($showDay->getDbTimezone()));
|
||||
$showStartDay->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
array_push($days, $showStartDay->format('w'));
|
||||
}
|
||||
|
||||
$displayedEndDate = new DateTime($show->getRepeatingEndDate(), new DateTimeZone($showDays[0]->getDbTimezone()));
|
||||
$displayedEndDate->sub(new DateInterval("P1D"));//end dates are stored non-inclusively.
|
||||
$displayedEndDate->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
|
||||
$formRepeats->populate(array('add_show_repeat_type' => $show->getRepeatType(),
|
||||
'add_show_day_check' => $days,
|
||||
'add_show_end_date' => $displayedEndDate->format("Y-m-d"),
|
||||
'add_show_no_end' => ($show->getRepeatingEndDate() == '')));
|
||||
|
||||
$hosts = array();
|
||||
$showHosts = CcShowHostsQuery::create()->filterByDbShow($showInstance->getShowId())->find();
|
||||
foreach ($showHosts as $showHost) {
|
||||
array_push($hosts, $showHost->getDbHost());
|
||||
}
|
||||
$formWho->populate(array('add_show_hosts' => $hosts));
|
||||
$formStyle->populate(array('add_show_background_color' => $show->getBackgroundColor(),
|
||||
'add_show_color' => $show->getColor()));
|
||||
|
||||
$formLive->populate($show->getLiveStreamInfo());
|
||||
|
||||
$formRecord = new Application_Form_AddShowRR();
|
||||
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
||||
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
||||
|
||||
$formRecord->removeDecorator('DtDdWrapper');
|
||||
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
||||
$formRebroadcast->removeDecorator('DtDdWrapper');
|
||||
|
||||
$this->view->rr = $formRecord;
|
||||
$this->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||
$this->view->rebroadcast = $formRebroadcast;
|
||||
|
||||
$formRecord->populate(array('add_show_record' => $show->isRecorded(),
|
||||
'add_show_rebroadcast' => $show->isRebroadcast()));
|
||||
|
||||
$formRecord->getElement('add_show_record')->setOptions(array('disabled' => true));
|
||||
|
||||
|
||||
|
||||
$rebroadcastsRelative = $show->getRebroadcastsRelative();
|
||||
$rebroadcastFormValues = array();
|
||||
$i = 1;
|
||||
foreach ($rebroadcastsRelative as $rebroadcast) {
|
||||
$rebroadcastFormValues["add_show_rebroadcast_date_$i"] = $rebroadcast['day_offset'];
|
||||
$rebroadcastFormValues["add_show_rebroadcast_time_$i"] = Application_Common_DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
|
||||
$i++;
|
||||
}
|
||||
$formRebroadcast->populate($rebroadcastFormValues);
|
||||
|
||||
$rebroadcastsAbsolute = $show->getRebroadcastsAbsolute();
|
||||
$rebroadcastAbsoluteFormValues = array();
|
||||
$i = 1;
|
||||
foreach ($rebroadcastsAbsolute as $rebroadcast) {
|
||||
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_date_absolute_$i"] = $rebroadcast['start_date'];
|
||||
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_time_absolute_$i"] = $rebroadcast['start_time'];
|
||||
$i++;
|
||||
}
|
||||
$formAbsoluteRebroadcast->populate($rebroadcastAbsoluteFormValues);
|
||||
if (!$isAdminOrPM) {
|
||||
$formRecord->disable();
|
||||
$formAbsoluteRebroadcast->disable();
|
||||
$formRebroadcast->disable();
|
||||
}
|
||||
$service_showForm->delegateShowFormPopulation($forms);
|
||||
|
||||
if (!$isAdminOrPM) {
|
||||
$formWhat->disable();
|
||||
$formWho->disable();
|
||||
$formWhen->disable();
|
||||
$formRepeats->disable();
|
||||
$formStyle->disable();
|
||||
foreach ($forms as $form) {
|
||||
$form->disable();
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->action = "edit-show";
|
||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||
$this->view->entries = 5;
|
||||
}
|
||||
|
||||
public function getFormAction()
|
||||
{
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
$service_user = new Application_Service_UserService();
|
||||
$currentUser = $service_user->getCurrentUser();
|
||||
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
Application_Model_Schedule::createNewFormSections($this->view);
|
||||
if ($currentUser->isAdminOrPM()) {
|
||||
$this->createShowFormAction(true);
|
||||
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
||||
}
|
||||
}
|
||||
|
||||
public function djEditShowAction()
|
||||
/*public function djEditShowAction()
|
||||
{
|
||||
$js = $this->_getParam('data');
|
||||
$data = array();
|
||||
|
@ -751,30 +419,9 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$show->setCustomPassword($data["custom_password"]);
|
||||
|
||||
$this->view->edit = true;
|
||||
}
|
||||
|
||||
/*public function editShowInstanceAction(){
|
||||
$js = $this->_getParam('data');
|
||||
$data = array();
|
||||
|
||||
//need to convert from serialized jQuery array.
|
||||
foreach ($js as $j) {
|
||||
$data[$j["name"]] = $j["value"];
|
||||
}
|
||||
|
||||
$success = Application_Model_Schedule::updateShowInstance($data, $this);
|
||||
if ($success) {
|
||||
$this->view->addNewShow = true;
|
||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||
} else {
|
||||
$this->view->addNewShow = false;
|
||||
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
||||
}
|
||||
}*/
|
||||
|
||||
public function editShowAction()
|
||||
{
|
||||
//1) Get add_show_start_date since it might not have been sent
|
||||
public function editRepeatingShowInstanceAction(){
|
||||
$js = $this->_getParam('data');
|
||||
$data = array();
|
||||
|
||||
|
@ -783,6 +430,53 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$data[$j["name"]] = $j["value"];
|
||||
}
|
||||
|
||||
$data['add_show_hosts'] = $this->_getParam('hosts');
|
||||
|
||||
$service_showForm = new Application_Service_ShowFormService(
|
||||
$data["add_show_id"], $data["add_show_instance_id"]);
|
||||
$service_show = new Application_Service_ShowService(null, $data);
|
||||
|
||||
$forms = $this->createShowFormAction();
|
||||
|
||||
list($data, $validateStartDate, $validateStartTime, $originalShowStartDateTime) =
|
||||
$service_showForm->preEditShowValidationCheck($data);
|
||||
|
||||
if ($service_showForm->validateShowForms($forms, $data, $validateStartDate,
|
||||
$originalShowStartDateTime, true, $data["add_show_instance_id"])) {
|
||||
|
||||
$service_show->createShowFromRepeatingInstance($data);
|
||||
|
||||
$this->view->addNewShow = true;
|
||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||
} else {
|
||||
if (!$validateStartDate) {
|
||||
$this->view->when->getElement('add_show_start_date')->setOptions(array('disabled' => true));
|
||||
}
|
||||
if (!$validateStartTime) {
|
||||
$this->view->when->getElement('add_show_start_time')->setOptions(array('disabled' => true));
|
||||
}
|
||||
$this->view->rr->getElement('add_show_record')->setOptions(array('disabled' => true));
|
||||
$this->view->addNewShow = false;
|
||||
$this->view->action = "edit-show";
|
||||
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
||||
}
|
||||
}
|
||||
|
||||
public function editShowAction()
|
||||
{
|
||||
$js = $this->_getParam('data');
|
||||
$data = array();
|
||||
|
||||
//need to convert from serialized jQuery array.
|
||||
foreach ($js as $j) {
|
||||
$data[$j["name"]] = $j["value"];
|
||||
}
|
||||
|
||||
$service_showForm = new Application_Service_ShowFormService(
|
||||
$data["add_show_id"]);
|
||||
$service_show = new Application_Service_ShowService(null, $data, true);
|
||||
|
||||
//TODO: move this to js
|
||||
$data['add_show_hosts'] = $this->_getParam('hosts');
|
||||
$data['add_show_day_check'] = $this->_getParam('days');
|
||||
|
||||
|
@ -790,43 +484,16 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$data['add_show_day_check'] = null;
|
||||
}
|
||||
|
||||
$show = new Application_Model_Show($data['add_show_id']);
|
||||
$forms = $this->createShowFormAction();
|
||||
|
||||
$validateStartDate = true;
|
||||
$validateStartTime = true;
|
||||
if (!array_key_exists('add_show_start_date', $data)) {
|
||||
//Changing the start date was disabled, since the
|
||||
//array key does not exist. We need to repopulate this entry from the db.
|
||||
//The start date will be returned in UTC time, so lets convert it to local time.
|
||||
$dt = Application_Common_DateHelper::ConvertToLocalDateTime($show->getStartDateAndTime());
|
||||
$data['add_show_start_date'] = $dt->format("Y-m-d");
|
||||
list($data, $validateStartDate, $validateStartTime, $originalShowStartDateTime) =
|
||||
$service_showForm->preEditShowValidationCheck($data);
|
||||
|
||||
if (!array_key_exists('add_show_start_time', $data)) {
|
||||
$data['add_show_start_time'] = $dt->format("H:i");
|
||||
$validateStartTime = false;
|
||||
}
|
||||
$validateStartDate = false;
|
||||
}
|
||||
$data['add_show_record'] = $show->isRecorded();
|
||||
if ($service_showForm->validateShowForms($forms, $data, $validateStartDate,
|
||||
$originalShowStartDateTime, true, $data["add_show_instance_id"])) {
|
||||
|
||||
if ($show->isRepeating()) {
|
||||
$nextFutureRepeatShow = $show->getNextFutureRepeatShowTime();
|
||||
$originalShowStartDateTime = $nextFutureRepeatShow["starts"];
|
||||
} else {
|
||||
$originalShowStartDateTime = Application_Common_DateHelper::ConvertToLocalDateTime(
|
||||
$show->getStartDateAndTime());
|
||||
}
|
||||
$service_show->addUpdateShow($data);
|
||||
|
||||
$success = Application_Model_Schedule::addUpdateShow($data, $this,
|
||||
$validateStartDate, $originalShowStartDateTime, true,
|
||||
$data['add_show_instance_id']);
|
||||
|
||||
if ($success) {
|
||||
$scheduler = new Application_Model_Scheduler();
|
||||
$showInstances = CcShowInstancesQuery::create()->filterByDbShowId($data['add_show_id'])->find();
|
||||
foreach ($showInstances as $si) {
|
||||
$scheduler->removeGaps($si->getDbId());
|
||||
}
|
||||
$this->view->addNewShow = true;
|
||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||
} else {
|
||||
|
@ -845,6 +512,9 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
public function addShowAction()
|
||||
{
|
||||
$service_showForm = new Application_Service_ShowFormService(null);
|
||||
//$service_show = new Application_Service_ShowService();
|
||||
|
||||
$js = $this->_getParam('data');
|
||||
$data = array();
|
||||
|
||||
|
@ -853,6 +523,9 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$data[$j["name"]] = $j["value"];
|
||||
}
|
||||
|
||||
$service_show = new Application_Service_ShowService(null, $data);
|
||||
|
||||
// TODO: move this to js
|
||||
$data['add_show_hosts'] = $this->_getParam('hosts');
|
||||
$data['add_show_day_check'] = $this->_getParam('days');
|
||||
|
||||
|
@ -860,42 +533,60 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$data['add_show_day_check'] = null;
|
||||
}
|
||||
|
||||
$validateStartDate = true;
|
||||
$success = Application_Model_Schedule::addUpdateShow($data, $this,
|
||||
$validateStartDate);
|
||||
$forms = $this->createShowFormAction();
|
||||
|
||||
$this->view->addNewShow = true;
|
||||
|
||||
if ($service_showForm->validateShowForms($forms, $data)) {
|
||||
$service_show->addUpdateShow($data);
|
||||
|
||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||
//send new show forms to the user
|
||||
$this->createShowFormAction(true);
|
||||
|
||||
if ($success) {
|
||||
$this->view->addNewShow = true;
|
||||
$this->view->newForm = $this->view->render(
|
||||
'schedule/add-show-form.phtml');
|
||||
Logging::debug("Show creation succeeded");
|
||||
} else {
|
||||
$this->view->addNewShow = true;
|
||||
$this->view->form = $this->view->render(
|
||||
'schedule/add-show-form.phtml');
|
||||
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
||||
Logging::debug("Show creation failed");
|
||||
}
|
||||
}
|
||||
|
||||
public function cancelShowAction()
|
||||
public function createShowFormAction($populateDefaults=false)
|
||||
{
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
$service_showForm = new Application_Service_ShowFormService();
|
||||
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
$showInstanceId = $this->_getParam('id');
|
||||
$forms = $service_showForm->createShowForms();
|
||||
|
||||
try {
|
||||
$showInstance = new Application_Model_ShowInstance($showInstanceId);
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
$show = new Application_Model_Show($showInstance->getShowId());
|
||||
|
||||
$show->cancelShow($showInstance->getShowInstanceStart());
|
||||
$this->view->show_id = $showInstance->getShowId();
|
||||
// populate forms with default values
|
||||
if ($populateDefaults) {
|
||||
$service_showForm->populateNewShowForms(
|
||||
$forms["what"], $forms["when"], $forms["repeats"]);
|
||||
}
|
||||
|
||||
$this->view->what = $forms["what"];
|
||||
$this->view->when = $forms["when"];
|
||||
$this->view->repeats = $forms["repeats"];
|
||||
$this->view->live = $forms["live"];
|
||||
$this->view->rr = $forms["record"];
|
||||
$this->view->absoluteRebroadcast = $forms["abs_rebroadcast"];
|
||||
$this->view->rebroadcast = $forms["rebroadcast"];
|
||||
$this->view->who = $forms["who"];
|
||||
$this->view->style = $forms["style"];
|
||||
|
||||
return $forms;
|
||||
}
|
||||
|
||||
public function deleteShowAction()
|
||||
{
|
||||
$instanceId = $this->_getParam('id');
|
||||
|
||||
$service_show = new Application_Service_ShowService();
|
||||
$showId = $service_show->deleteShow($instanceId);
|
||||
|
||||
if (!$showId) {
|
||||
$this->view->show_error = true;
|
||||
}
|
||||
$this->view->show_id = $showId;
|
||||
}
|
||||
|
||||
public function cancelCurrentShowAction()
|
||||
|
@ -931,7 +622,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$id = $this->_getParam('id');
|
||||
|
||||
$file_id = $this->_getParam('id', null);
|
||||
$file = Application_Model_StoredFile::Recall($file_id);
|
||||
$file = Application_Model_StoredFile::RecallById($file_id);
|
||||
|
||||
$baseUrl = $this->getRequest()->getBaseUrl();
|
||||
$url = $file->getRelativeFileUrl($baseUrl).'download/true';
|
||||
|
@ -962,32 +653,9 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
public function calculateDurationAction()
|
||||
{
|
||||
$startParam = $this->_getParam('startTime');
|
||||
$endParam = $this->_getParam('endTime');
|
||||
|
||||
try {
|
||||
$startDateTime = new DateTime($startParam);
|
||||
$endDateTime = new DateTime($endParam);
|
||||
|
||||
$UTCStartDateTime = $startDateTime->setTimezone(new DateTimeZone('UTC'));
|
||||
$UTCEndDateTime = $endDateTime->setTimezone(new DateTimeZone('UTC'));
|
||||
|
||||
$duration = $UTCEndDateTime->diff($UTCStartDateTime);
|
||||
|
||||
$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";
|
||||
}
|
||||
$service_showForm = new Application_Service_ShowFormService();
|
||||
$result = $service_showForm->calculateDuration($this->_getParam('startTime'),
|
||||
$this->_getParam('endTime'));
|
||||
|
||||
echo Zend_Json::encode($result);
|
||||
exit();
|
||||
|
|
|
@ -40,6 +40,14 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
|
|||
}
|
||||
}
|
||||
|
||||
public function isValid($formData) {
|
||||
if (parent::isValid($formData)) {
|
||||
return $this->checkReliantFields($formData);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function checkReliantFields($formData)
|
||||
{
|
||||
$noError = true;
|
||||
|
|
|
@ -45,6 +45,14 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
|
|||
}
|
||||
}
|
||||
|
||||
public function isValid($formData) {
|
||||
if (parent::isValid($formData)) {
|
||||
return $this->checkReliantFields($formData);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function checkReliantFields($formData)
|
||||
{
|
||||
$noError = true;
|
||||
|
|
|
@ -5,6 +5,11 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
|
|||
|
||||
public function init()
|
||||
{
|
||||
|
||||
$linked = new Zend_Form_Element_Checkbox("add_show_linked");
|
||||
$linked->setLabel(_("Link:"));
|
||||
$this->addElement($linked);
|
||||
|
||||
//Add type select
|
||||
$this->addElement('select', 'add_show_repeat_type', array(
|
||||
'required' => true,
|
||||
|
@ -35,6 +40,15 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
|
|||
),
|
||||
));
|
||||
|
||||
$repeatMonthlyType = new Zend_Form_Element_Radio("add_show_monthly_repeat_type");
|
||||
$repeatMonthlyType
|
||||
->setLabel(_("Repeat By:"))
|
||||
->setRequired(true)
|
||||
->setMultiOptions(
|
||||
array(2 => _("day of the month"), 3 => _("day of the week")))
|
||||
->setValue(2);
|
||||
$this->addElement($repeatMonthlyType);
|
||||
|
||||
// Add end date element
|
||||
$this->addElement('text', 'add_show_end_date', array(
|
||||
'label' => _('Date End:'),
|
||||
|
@ -66,6 +80,14 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
|
|||
}
|
||||
}
|
||||
|
||||
public function isValid($formData) {
|
||||
if (parent::isValid($formData)) {
|
||||
return $this->checkReliantFields($formData);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function checkReliantFields($formData)
|
||||
{
|
||||
if (!$formData['add_show_no_end']) {
|
||||
|
|
|
@ -87,6 +87,16 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
|
||||
}
|
||||
|
||||
public function isWhenFormValid($formData, $validateStartDate, $originalStartDate,
|
||||
$update, $instanceId) {
|
||||
if (parent::isValid($formData)) {
|
||||
return self::checkReliantFields($formData, $validateStartDate,
|
||||
$originalStartDate, $update, $instanceId);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function checkReliantFields($formData, $validateStartDate, $originalStartDate=null, $update=false, $instanceId=null)
|
||||
{
|
||||
$valid = true;
|
||||
|
@ -285,7 +295,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
$rebroadcastShowStart->setTimezone(new DateTimeZone('UTC'));
|
||||
$rebroadcastShowEnd = clone $rebroadcastShowStart;
|
||||
$rebroadcastShowEnd->add(new DateInterval($durationToAdd));
|
||||
$overlapping = Application_Model_Schedule::checkOverlappingShows($rebroadcastShowStart, $rebroadcastShowEnd, $update, $instanceId);
|
||||
$overlapping = Application_Model_Schedule::checkOverlappingShows($rebroadcastShowStart,
|
||||
$rebroadcastShowEnd, $update, null, $formData["add_show_id"]);
|
||||
if ($overlapping) {
|
||||
$valid = false;
|
||||
$this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows')));
|
||||
|
|
|
@ -69,6 +69,22 @@ class Logging {
|
|||
$logger->warn("[$file : $function() : line $line] - "
|
||||
. self::toString($p_msg));
|
||||
}
|
||||
|
||||
public static function error($p_msg)
|
||||
{
|
||||
$bt = debug_backtrace();
|
||||
|
||||
$caller = array_shift($bt);
|
||||
$file = basename($caller['file']);
|
||||
$line = $caller['line'];
|
||||
|
||||
$caller = array_shift($bt);
|
||||
$function = $caller['function'];
|
||||
|
||||
$logger = self::getLogger();
|
||||
$logger->err("[$file : $function() : line $line] - "
|
||||
. self::toString($p_msg));
|
||||
}
|
||||
|
||||
public static function debug($p_msg)
|
||||
{
|
||||
|
|
|
@ -385,6 +385,7 @@ SELECT showt.name AS show_name,
|
|||
showt.color AS show_color,
|
||||
showt.background_color AS show_background_color,
|
||||
showt.id AS show_id,
|
||||
showt.linked AS linked,
|
||||
si.starts AS si_starts,
|
||||
si.ends AS si_ends,
|
||||
si.time_filled AS si_time_filled,
|
||||
|
@ -838,6 +839,7 @@ SQL;
|
|||
{
|
||||
$utcTimeZone = new DateTimeZone("UTC");
|
||||
$items = self::getItems($range_start, $range_end);
|
||||
|
||||
foreach ($items as $item) {
|
||||
$showEndDateTime = new DateTime($item["show_end"], $utcTimeZone);
|
||||
|
||||
|
@ -859,7 +861,7 @@ SQL;
|
|||
if (!is_null($item['file_id'])) {
|
||||
//row is from "file"
|
||||
$media_id = $item['file_id'];
|
||||
$storedFile = Application_Model_StoredFile::Recall($media_id);
|
||||
$storedFile = Application_Model_StoredFile::RecallById($media_id);
|
||||
$uri = $storedFile->getFilePath();
|
||||
self::createFileScheduleEvent($data, $item, $media_id, $uri);
|
||||
} elseif (!is_null($item['stream_id'])) {
|
||||
|
@ -960,7 +962,7 @@ SQL;
|
|||
Application_Common_Database::prepareAndExecute($sql, array(':file_id'=>$fileId), 'execute');
|
||||
}
|
||||
|
||||
public static function createNewFormSections($p_view)
|
||||
/*public static function createNewFormSections($p_view)
|
||||
{
|
||||
$formWhat = new Application_Form_AddShowWhat();
|
||||
$formWho = new Application_Form_AddShowWho();
|
||||
|
@ -1005,7 +1007,7 @@ SQL;
|
|||
$p_view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||
$p_view->rebroadcast = $formRebroadcast;
|
||||
$p_view->addNewShow = true;
|
||||
}
|
||||
}*/
|
||||
|
||||
/* This function is responsible for handling the case where an individual
|
||||
* show instance in a repeating show was edited (via the context menu in the Calendar).
|
||||
|
@ -1088,7 +1090,7 @@ SQL;
|
|||
* Another clean-up is to move all the form manipulation to the proper form class.....
|
||||
* -Martin
|
||||
*/
|
||||
public static function addUpdateShow($data, $controller, $validateStartDate,
|
||||
/*public static function addUpdateShow($data, $controller, $validateStartDate,
|
||||
$originalStartDate=null, $update=false, $instanceId=null)
|
||||
{
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
@ -1140,13 +1142,13 @@ SQL;
|
|||
|
||||
$data["add_show_duration"] = $hValue.":".$mValue;
|
||||
|
||||
$formRecord = new Application_Form_AddShowRR();
|
||||
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
||||
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
||||
$formRecord = new Application_Form_AddShowRR();
|
||||
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
||||
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
||||
|
||||
$formRecord->removeDecorator('DtDdWrapper');
|
||||
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
||||
$formRebroadcast->removeDecorator('DtDdWrapper');
|
||||
$formRecord->removeDecorator('DtDdWrapper');
|
||||
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
||||
$formRebroadcast->removeDecorator('DtDdWrapper');
|
||||
|
||||
|
||||
$record = $formRecord->isValid($data);
|
||||
|
@ -1156,18 +1158,18 @@ SQL;
|
|||
if ($repeats) {
|
||||
$repeats = $formRepeats->checkReliantFields($data);
|
||||
}
|
||||
$formAbsoluteRebroadcast->reset();
|
||||
//make it valid, results don't matter anyways.
|
||||
$rebroadAb = 1;
|
||||
$formAbsoluteRebroadcast->reset();
|
||||
//make it valid, results don't matter anyways.
|
||||
$rebroadAb = 1;
|
||||
|
||||
if ($data["add_show_rebroadcast"]) {
|
||||
$rebroad = $formRebroadcast->isValid($data);
|
||||
if ($rebroad) {
|
||||
$rebroad = $formRebroadcast->checkReliantFields($data);
|
||||
}
|
||||
} else {
|
||||
$rebroad = 1;
|
||||
if ($data["add_show_rebroadcast"]) {
|
||||
$rebroad = $formRebroadcast->isValid($data);
|
||||
if ($rebroad) {
|
||||
$rebroad = $formRebroadcast->checkReliantFields($data);
|
||||
}
|
||||
} else {
|
||||
$rebroad = 1;
|
||||
}
|
||||
} else {
|
||||
$repeats = 1;
|
||||
$formRebroadcast->reset();
|
||||
|
@ -1220,15 +1222,14 @@ SQL;
|
|||
$controller->view->who = $formWho;
|
||||
$controller->view->style = $formStyle;
|
||||
$controller->view->live = $formLive;
|
||||
|
||||
$controller->view->rr = $formRecord;
|
||||
$controller->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||
$controller->view->rebroadcast = $formRebroadcast;
|
||||
$controller->view->rr = $formRecord;
|
||||
$controller->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||
$controller->view->rebroadcast = $formRebroadcast;
|
||||
//$controller->view->addNewShow = !$editShow;
|
||||
//$controller->view->form = $controller->view->render('schedule/add-show-form.phtml');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public static function checkOverlappingShows($show_start, $show_end,
|
||||
$update=false, $instanceId=null, $showId=null)
|
||||
|
@ -1257,19 +1258,19 @@ WHERE (ends <= :show_end1
|
|||
AND date(starts) >= (date(:show_end3) - INTERVAL '2 days')
|
||||
AND modified_instance = FALSE
|
||||
SQL;
|
||||
if (is_null($showId)) {
|
||||
$sql .= <<<SQL
|
||||
if (is_null($showId)) {
|
||||
$sql .= <<<SQL
|
||||
AND id != :instanceId
|
||||
ORDER BY ends
|
||||
SQL;
|
||||
$params[':instanceId'] = $instanceId;
|
||||
} else {
|
||||
$sql .= <<<SQL
|
||||
$params[':instanceId'] = $instanceId;
|
||||
} else {
|
||||
$sql .= <<<SQL
|
||||
AND show_id != :showId
|
||||
ORDER BY ends
|
||||
SQL;
|
||||
$params[':showId'] = $showId;
|
||||
}
|
||||
$params[':showId'] = $showId;
|
||||
}
|
||||
$rows = Application_Common_Database::prepareAndExecute($sql, $params, 'all');
|
||||
} else {
|
||||
$sql = <<<SQL
|
||||
|
|
|
@ -45,13 +45,40 @@ class Application_Model_Scheduler
|
|||
$this->checkUserPermissions = $value;
|
||||
}
|
||||
|
||||
private function validateItemMove($itemsToMove, $destination)
|
||||
{
|
||||
$destinationInstanceId = $destination["instance"];
|
||||
$destinationCcShowInstance = CcShowInstancesQuery::create()
|
||||
->findPk($destinationInstanceId);
|
||||
$isDestinationLinked = $destinationCcShowInstance->getCcShow()->isLinked();
|
||||
|
||||
foreach ($itemsToMove as $itemToMove) {
|
||||
$sourceInstanceId = $itemToMove["instance"];
|
||||
$ccShowInstance = CcShowInstancesQuery::create()
|
||||
->findPk($sourceInstanceId);
|
||||
|
||||
//does the item being moved belong to a linked show
|
||||
$isSourceLinked = $ccShowInstance->getCcShow()->isLinked();
|
||||
|
||||
if ($isDestinationLinked && !$isSourceLinked) {
|
||||
throw new Exception("Cannot move items into linked shows");
|
||||
} elseif (!$isDestinationLinked && $isSourceLinked) {
|
||||
throw new Exception("Cannot move items out of linked shows");
|
||||
} elseif ($isSourceLinked && $sourceInstanceId != $destinationInstanceId) {
|
||||
throw new Exception(_("Cannot move items out of linked shows"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* make sure any incoming requests for scheduling are ligit.
|
||||
*
|
||||
* @param array $items, an array containing pks of cc_schedule items.
|
||||
*/
|
||||
private function validateRequest($items)
|
||||
private function validateRequest($items, $addAction=false)
|
||||
{
|
||||
//$items is where tracks get inserted (they are schedule locations)
|
||||
|
||||
$nowEpoch = floatval($this->nowDT->format("U.u"));
|
||||
|
||||
for ($i = 0; $i < count($items); $i++) {
|
||||
|
@ -59,9 +86,11 @@ class Application_Model_Scheduler
|
|||
|
||||
//could be added to the beginning of a show, which sends id = 0;
|
||||
if ($id > 0) {
|
||||
//schedule_id of where we are inserting after?
|
||||
$schedInfo[$id] = $items[$i]["instance"];
|
||||
}
|
||||
|
||||
//format is instance_id => timestamp
|
||||
$instanceInfo[$items[$i]["instance"]] = $items[$i]["timestamp"];
|
||||
}
|
||||
|
||||
|
@ -104,7 +133,7 @@ class Application_Model_Scheduler
|
|||
if ($this->checkUserPermissions && $this->user->canSchedule($show->getDbId()) === false) {
|
||||
throw new Exception(sprintf(_("You are not allowed to schedule show %s."), $show->getDbName()));
|
||||
}
|
||||
|
||||
|
||||
if ($instance->getDbRecord()) {
|
||||
throw new Exception(_("You cannot add files to recording shows."));
|
||||
}
|
||||
|
@ -121,6 +150,28 @@ class Application_Model_Scheduler
|
|||
Logging::info("ts {$ts} last sched {$lastSchedTs}");
|
||||
throw new OutDatedScheduleException(sprintf(_("The show %s has been previously updated!"), $show->getDbName()));
|
||||
}
|
||||
|
||||
/*
|
||||
* Does the afterItem belong to a show that is linked AND
|
||||
* currently playing?
|
||||
* If yes, throw an exception
|
||||
*/
|
||||
if ($addAction) {
|
||||
$ccShow = $instance->getCcShow();
|
||||
if ($ccShow->isLinked()) {
|
||||
//get all the linked shows instances and check if
|
||||
//any of them are currently playing
|
||||
$ccShowInstances = $ccShow->getCcShowInstancess();
|
||||
$timeNowUTC = gmdate("Y-m-d H:i:s");
|
||||
foreach ($ccShowInstances as $ccShowInstance) {
|
||||
|
||||
if ($ccShowInstance->getDbStarts() <= $timeNowUTC &&
|
||||
$ccShowInstance->getDbEnds() > $timeNowUTC) {
|
||||
throw new Exception(_("Content in linked shows must be scheduled before or after any one is broadcasted"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,7 +187,7 @@ class Application_Model_Scheduler
|
|||
|
||||
if ($type === "audioclip") {
|
||||
$file = CcFilesQuery::create()->findPK($id, $this->con);
|
||||
$storedFile = new Application_Model_StoredFile($file->getDbId());
|
||||
$storedFile = new Application_Model_StoredFile($file, $this->con);
|
||||
|
||||
if (is_null($file) || !$file->visible()) {
|
||||
throw new Exception(_("A selected File does not exist!"));
|
||||
|
@ -380,135 +431,227 @@ class Application_Model_Scheduler
|
|||
$schedule->save($this->con);
|
||||
}
|
||||
|
||||
/*
|
||||
* @param array $scheduledIds
|
||||
* @param array $fileIds
|
||||
* @param array $playlistIds
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
* @param $scheduleItems
|
||||
* cc_schedule items, where the items get inserted after
|
||||
* @param $filesToInsert
|
||||
* array of schedule item info, what gets inserted into cc_schedule
|
||||
* @param $adjustSched
|
||||
*/
|
||||
private function insertAfter($scheduleItems, $schedFiles, $adjustSched = true, $mediaItems = null)
|
||||
private function insertAfter($scheduleItems, $mediaItems, $filesToInsert=null, $adjustSched=true, $moveAction=false)
|
||||
{
|
||||
try {
|
||||
$affectedShowInstances = array();
|
||||
|
||||
//dont want to recalculate times for moved items.
|
||||
|
||||
//dont want to recalculate times for moved items
|
||||
//only moved items have a sched_id
|
||||
$excludeIds = array();
|
||||
foreach ($schedFiles as $file) {
|
||||
if (isset($file["sched_id"])) {
|
||||
$excludeIds[] = intval($file["sched_id"]);
|
||||
}
|
||||
}
|
||||
|
||||
$startProfile = microtime(true);
|
||||
|
||||
$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;
|
||||
|
||||
foreach ($scheduleItems as $schedule) {
|
||||
$id = intval($schedule["id"]);
|
||||
|
||||
// if mediaItmes is passed in, we want to create contents
|
||||
// at the time of insert. This is for dyanmic blocks or
|
||||
// playlist that contains dynamic blocks
|
||||
if ($mediaItems != null) {
|
||||
$schedFiles = array();
|
||||
foreach ($mediaItems as $media) {
|
||||
$schedFiles = array_merge($schedFiles, $this->retrieveMediaFiles($media["id"], $media["type"]));
|
||||
|
||||
/* Find out if the show where the cursor position (where an item will
|
||||
* be inserted) is located is linked or not. If the show is linked,
|
||||
* we need to make sure there isn't another cursor selection in one of it's
|
||||
* linked shows. If there is that will cause a duplication, in the least,
|
||||
* of inserted items
|
||||
*/
|
||||
if ($id != 0) {
|
||||
$ccSchedule = CcScheduleQuery::create()->findPk($schedule["id"]);
|
||||
$ccShowInstance = CcShowInstancesQuery::create()->findPk($ccSchedule->getDbInstanceId());
|
||||
$ccShow = $ccShowInstance->getCcShow();
|
||||
if ($ccShow->isLinked()) {
|
||||
$unique = $ccShow->getDbId() . $ccSchedule->getDbPosition();
|
||||
if (!in_array($unique, $temp)) {
|
||||
$temp[] = $unique;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$ccShowInstance = CcShowInstancesQuery::create()->findPk($schedule["instance"]);
|
||||
$ccShow = $ccShowInstance->getccShow();
|
||||
if ($ccShow->isLinked()) {
|
||||
$unique = $ccShow->getDbId() . "a";
|
||||
if (!in_array($unique, $temp)) {
|
||||
$temp[] = $unique;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($id !== 0) {
|
||||
$schedItem = CcScheduleQuery::create()->findPK($id, $this->con);
|
||||
$instance = $schedItem->getCcShowInstances($this->con);
|
||||
|
||||
$schedItemEndDT = $schedItem->getDbEnds(null);
|
||||
$nextStartDT = $this->findNextStartTime($schedItemEndDT, $instance);
|
||||
}
|
||||
//selected empty row to add after
|
||||
else {
|
||||
/* If the show where the cursor position is located is linked
|
||||
* we need to insert the items for each linked instance belonging
|
||||
* to that show
|
||||
*/
|
||||
$instances = $this->getInstances($schedule["instance"]);
|
||||
foreach($instances as $instance) {
|
||||
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();
|
||||
|
||||
$instance = CcShowInstancesQuery::create()->findPK($schedule["instance"], $this->con);
|
||||
$ccSchedule = CcScheduleQuery::create()
|
||||
->filterByDbInstanceId($instance->getDbId())
|
||||
->filterByDbPosition($pos)
|
||||
->findOne();
|
||||
|
||||
$showStartDT = $instance->getDbStarts(null);
|
||||
$nextStartDT = $this->findNextStartTime($showStartDT, $instance);
|
||||
}
|
||||
//$schedItemEndDT = $schedItem->getDbEnds(null);
|
||||
$schedItemEndDT = $ccSchedule->getDbEnds(null);
|
||||
$nextStartDT = $this->findNextStartTime($schedItemEndDT, $instance);
|
||||
|
||||
if (!in_array($instance->getDbId(), $affectedShowInstances)) {
|
||||
$affectedShowInstances[] = $instance->getDbId();
|
||||
}
|
||||
$pos++;
|
||||
}
|
||||
//selected empty row to add after
|
||||
else {
|
||||
$showStartDT = $instance->getDbStarts(null);
|
||||
$nextStartDT = $this->findNextStartTime($showStartDT, $instance);
|
||||
|
||||
if ($adjustSched === true) {
|
||||
|
||||
$pstart = microtime(true);
|
||||
|
||||
$followingSchedItems = CcScheduleQuery::create()
|
||||
->filterByDBStarts($nextStartDT->format("Y-m-d H:i:s.u"), Criteria::GREATER_EQUAL)
|
||||
->filterByDbInstanceId($instance->getDbId())
|
||||
->filterByDbId($excludeIds, Criteria::NOT_IN)
|
||||
->orderByDbStarts()
|
||||
->find($this->con);
|
||||
|
||||
$pend = microtime(true);
|
||||
Logging::debug("finding all following items.");
|
||||
Logging::debug(floatval($pend) - floatval($pstart));
|
||||
}
|
||||
|
||||
foreach ($schedFiles as $file) {
|
||||
$endTimeDT = $this->findEndTime($nextStartDT, $file['cliplength']);
|
||||
|
||||
//item existed previously and is being moved.
|
||||
//need to keep same id for resources if we want REST.
|
||||
if (isset($file['sched_id'])) {
|
||||
$sched = CcScheduleQuery::create()->findPK($file['sched_id'], $this->con);
|
||||
} else {
|
||||
$sched = new CcSchedule();
|
||||
//show is empty so start position counter at 0
|
||||
$pos = 0;
|
||||
}
|
||||
|
||||
// default fades are in seconds
|
||||
// we need to convert to '00:00:00' format
|
||||
$file['fadein'] = Application_Common_DateHelper::secondsToPlaylistTime($file['fadein']);
|
||||
$file['fadeout'] = Application_Common_DateHelper::secondsToPlaylistTime($file['fadeout']);
|
||||
|
||||
$sched->setDbStarts($nextStartDT)
|
||||
->setDbEnds($endTimeDT)
|
||||
->setDbCueIn($file['cuein'])
|
||||
->setDbCueOut($file['cueout'])
|
||||
->setDbFadeIn($file['fadein'])
|
||||
->setDbFadeOut($file['fadeout'])
|
||||
->setDbClipLength($file['cliplength'])
|
||||
->setDbInstanceId($instance->getDbId());
|
||||
|
||||
switch ($file["type"]) {
|
||||
case 0:
|
||||
$sched->setDbFileId($file['id']);
|
||||
break;
|
||||
case 1:
|
||||
$sched->setDbStreamId($file['id']);
|
||||
break;
|
||||
default: break;
|
||||
if (!in_array($instance->getDbId(), $affectedShowInstances)) {
|
||||
$affectedShowInstances[] = $instance->getDbId();
|
||||
}
|
||||
|
||||
$sched->save($this->con);
|
||||
/*
|
||||
* $adjustSched is true if there are schedule items
|
||||
* following the item just inserted, per show instance
|
||||
*/
|
||||
if ($adjustSched === true) {
|
||||
|
||||
$nextStartDT = $endTimeDT;
|
||||
}
|
||||
$pstart = microtime(true);
|
||||
|
||||
if ($adjustSched === true) {
|
||||
$initalStartDT = clone $nextStartDT;
|
||||
|
||||
$pstart = microtime(true);
|
||||
$pend = microtime(true);
|
||||
Logging::debug("finding all following items.");
|
||||
Logging::debug(floatval($pend) - floatval($pstart));
|
||||
}
|
||||
|
||||
//recalculate the start/end times after the inserted items.
|
||||
foreach ($followingSchedItems as $item) {
|
||||
if (is_null($filesToInsert)) {
|
||||
$filesToInsert = array();
|
||||
foreach ($mediaItems as $media) {
|
||||
$filesToInsert = array_merge($filesToInsert, $this->retrieveMediaFiles($media["id"], $media["type"]));
|
||||
}
|
||||
}
|
||||
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'])) {
|
||||
$sched = CcScheduleQuery::create()->findPk($file["sched_id"]);
|
||||
|
||||
$endTimeDT = $this->findEndTime($nextStartDT, $item->getDbClipLength());
|
||||
$excludeIds[] = intval($sched->getDbId());
|
||||
|
||||
$file["cliplength"] = $sched->getDbClipLength();
|
||||
$file["cuein"] = $sched->getDbCueIn();
|
||||
$file["cueout"] = $sched->getDbCueOut();
|
||||
$file["fadein"] = $sched->getDbFadeIn();
|
||||
$file["fadeout"] = $sched->getDbFadeOut();
|
||||
} else {
|
||||
$sched = new CcSchedule();
|
||||
}
|
||||
|
||||
$endTimeDT = $this->findEndTime($nextStartDT, $file['cliplength']);
|
||||
// default fades are in seconds
|
||||
// we need to convert to '00:00:00' format
|
||||
$file['fadein'] = Application_Common_DateHelper::secondsToPlaylistTime($file['fadein']);
|
||||
$file['fadeout'] = Application_Common_DateHelper::secondsToPlaylistTime($file['fadeout']);
|
||||
|
||||
$sched->setDbStarts($nextStartDT)
|
||||
->setDbEnds($endTimeDT)
|
||||
->setDbCueIn($file['cuein'])
|
||||
->setDbCueOut($file['cueout'])
|
||||
->setDbFadeIn($file['fadein'])
|
||||
->setDbFadeOut($file['fadeout'])
|
||||
->setDbClipLength($file['cliplength'])
|
||||
->setDbPosition($pos);
|
||||
//->setDbInstanceId($instance->getDbId());
|
||||
if (!$moveAction) {
|
||||
$sched->setDbInstanceId($instance->getDbId());
|
||||
}
|
||||
|
||||
switch ($file["type"]) {
|
||||
case 0:
|
||||
$sched->setDbFileId($file['id']);
|
||||
break;
|
||||
case 1:
|
||||
$sched->setDbStreamId($file['id']);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
$sched->save($this->con);
|
||||
|
||||
$item->setDbStarts($nextStartDT);
|
||||
$item->setDbEnds($endTimeDT);
|
||||
$item->save($this->con);
|
||||
$nextStartDT = $endTimeDT;
|
||||
$pos++;
|
||||
|
||||
}//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);
|
||||
}
|
||||
/* 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
|
||||
*/
|
||||
if (!$moveAction) {
|
||||
$filesToInsert = null;
|
||||
}
|
||||
|
||||
$pend = microtime(true);
|
||||
Logging::debug("adjusting all following items.");
|
||||
Logging::debug(floatval($pend) - floatval($pstart));
|
||||
}
|
||||
}
|
||||
/* If we are adjusting start and end times for items
|
||||
* after the insert location, we need to exclude the
|
||||
* schedule item we just inserted because it has correct
|
||||
* start and end times*/
|
||||
$excludeIds[] = $sched->getDbId();
|
||||
|
||||
if ($adjustSched === true) {
|
||||
$followingSchedItems = CcScheduleQuery::create()
|
||||
->filterByDBStarts($initalStartDT->format("Y-m-d H:i:s.u"), Criteria::GREATER_EQUAL)
|
||||
->filterByDbInstanceId($instance->getDbId())
|
||||
->filterByDbId($excludeIds, Criteria::NOT_IN)
|
||||
->orderByDbStarts()
|
||||
->find($this->con);
|
||||
|
||||
$pstart = microtime(true);
|
||||
|
||||
//recalculate the start/end times after the inserted items.
|
||||
foreach ($followingSchedItems as $item) {
|
||||
$endTimeDT = $this->findEndTime($nextStartDT, $item->getDbClipLength());
|
||||
|
||||
$item->setDbStarts($nextStartDT);
|
||||
$item->setDbEnds($endTimeDT);
|
||||
$item->setDbPosition($pos);
|
||||
$item->save($this->con);
|
||||
$nextStartDT = $endTimeDT;
|
||||
$pos++;
|
||||
}
|
||||
|
||||
$pend = microtime(true);
|
||||
Logging::debug("adjusting all following items.");
|
||||
Logging::debug(floatval($pend) - floatval($pstart));
|
||||
}
|
||||
}//for each instance
|
||||
|
||||
}//for each schedule location
|
||||
|
||||
$endProfile = microtime(true);
|
||||
Logging::debug("finished adding scheduled items.");
|
||||
|
@ -525,13 +668,6 @@ class Application_Model_Scheduler
|
|||
$instance->updateScheduleStatus($this->con);
|
||||
}
|
||||
|
||||
// update is_scheduled flag for each cc_file
|
||||
foreach ($schedFiles as $file) {
|
||||
$db_file = CcFilesQuery::create()->findPk($file['id'], $this->con);
|
||||
$db_file->setDbIsScheduled(true);
|
||||
$db_file->save($this->con);
|
||||
}
|
||||
|
||||
$endProfile = microtime(true);
|
||||
Logging::debug("updating show instances status.");
|
||||
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||
|
@ -552,46 +688,53 @@ class Application_Model_Scheduler
|
|||
}
|
||||
}
|
||||
|
||||
private function getInstances($instanceId)
|
||||
{
|
||||
$ccShowInstance = CcShowInstancesQuery::create()->findPk($instanceId);
|
||||
$ccShow = $ccShowInstance->getCcShow();
|
||||
if ($ccShow->isLinked()) {
|
||||
return $ccShow->getCcShowInstancess();
|
||||
} else {
|
||||
return array($ccShowInstance);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @param array $scheduleItems
|
||||
* @param array $mediaItems
|
||||
* @param array $scheduleItems (schedule_id and instance_id it belongs to)
|
||||
* @param array $mediaItems (file|block|playlist|webstream)
|
||||
*/
|
||||
public function scheduleAfter($scheduleItems, $mediaItems, $adjustSched = true)
|
||||
{
|
||||
$this->con->beginTransaction();
|
||||
|
||||
$schedFiles = array();
|
||||
|
||||
try {
|
||||
$this->validateRequest($scheduleItems, true);
|
||||
|
||||
$this->validateRequest($scheduleItems);
|
||||
|
||||
$requireDynamicContentCreation = false;
|
||||
|
||||
foreach ($mediaItems as $media) {
|
||||
if ($media['type'] == "playlist") {
|
||||
$pl = new Application_Model_Playlist($media['id']);
|
||||
if ($pl->hasDynamicBlock()) {
|
||||
$requireDynamicContentCreation = true;
|
||||
break;
|
||||
}
|
||||
} else if ($media['type'] == "block") {
|
||||
$bl = new Application_Model_Block($media['id']);
|
||||
if (!$bl->isStatic()) {
|
||||
$requireDynamicContentCreation = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($requireDynamicContentCreation) {
|
||||
$this->insertAfter($scheduleItems, $schedFiles, $adjustSched, $mediaItems);
|
||||
} else {
|
||||
foreach ($mediaItems as $media) {
|
||||
$schedFiles = array_merge($schedFiles, $this->retrieveMediaFiles($media["id"], $media["type"]));
|
||||
}
|
||||
$this->insertAfter($scheduleItems, $schedFiles, $adjustSched);
|
||||
}
|
||||
/*
|
||||
* create array of arrays
|
||||
* array of schedule item info
|
||||
* (sched_id is the cc_schedule id and is set if an item is being
|
||||
* moved because it is already in cc_schedule)
|
||||
* [0] = Array(
|
||||
* id => 1,
|
||||
* cliplength => 00:04:32,
|
||||
* cuein => 00:00:00,
|
||||
* cueout => 00:04:32,
|
||||
* fadein => 00.5,
|
||||
* fadeout => 00.5,
|
||||
* sched_id => ,
|
||||
* type => 0)
|
||||
* [1] = Array(
|
||||
* id => 2,
|
||||
* cliplength => 00:05:07,
|
||||
* cuein => 00:00:00,
|
||||
* cueout => 00:05:07,
|
||||
* fadein => 00.5,
|
||||
* fadeout => 00.5,
|
||||
* sched_id => ,
|
||||
* type => 0)
|
||||
*/
|
||||
$this->insertAfter($scheduleItems, $mediaItems, null, $adjustSched);
|
||||
|
||||
$this->con->commit();
|
||||
|
||||
|
@ -615,6 +758,7 @@ class Application_Model_Scheduler
|
|||
|
||||
try {
|
||||
|
||||
$this->validateItemMove($selectedItems, $afterItems[0]);
|
||||
$this->validateRequest($selectedItems);
|
||||
$this->validateRequest($afterItems);
|
||||
|
||||
|
@ -668,7 +812,7 @@ class Application_Model_Scheduler
|
|||
|
||||
$startProfile = microtime(true);
|
||||
|
||||
$this->insertAfter($afterItems, $movedData, $adjustSched);
|
||||
$this->insertAfter($afterItems, null, $movedData, $adjustSched, true);
|
||||
|
||||
$endProfile = microtime(true);
|
||||
Logging::debug("inserting after removing gaps.");
|
||||
|
@ -692,7 +836,7 @@ class Application_Model_Scheduler
|
|||
}
|
||||
}
|
||||
|
||||
public function removeItems($scheduledItems, $adjustSched = true)
|
||||
public function removeItems($scheduledItems, $adjustSched = true, $cancelShow=false)
|
||||
{
|
||||
$showInstances = array();
|
||||
$this->con->beginTransaction();
|
||||
|
@ -713,6 +857,31 @@ class Application_Model_Scheduler
|
|||
|
||||
$instance = $removedItem->getCcShowInstances($this->con);
|
||||
|
||||
//check if instance is linked and if so get the schedule items
|
||||
//for all linked instances so we can delete them too
|
||||
if (!$cancelShow && $instance->getCcShow()->isLinked()) {
|
||||
//returns all linked instances if linked
|
||||
$ccShowInstances = $this->getInstances($instance->getDbId());
|
||||
$instanceIds = array();
|
||||
foreach ($ccShowInstances as $ccShowInstance) {
|
||||
$instanceIds[] = $ccShowInstance->getDbId();
|
||||
}
|
||||
/*
|
||||
* Find all the schedule items that are in the same position
|
||||
* as the selected item by the user.
|
||||
* The position of each track is the same across each linked instance
|
||||
*/
|
||||
$itemsToDelete = CcScheduleQuery::create()
|
||||
->filterByDbPosition($removedItem->getDbPosition())
|
||||
->filterByDbInstanceId($instanceIds, Criteria::IN)
|
||||
->find();
|
||||
foreach ($itemsToDelete as $item) {
|
||||
if (!$removedItems->contains($item)) {
|
||||
$removedItems->append($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//check to truncate the currently playing item instead of deleting it.
|
||||
if ($removedItem->isCurrentItem($this->epochNow)) {
|
||||
|
||||
|
@ -816,7 +985,7 @@ class Application_Model_Scheduler
|
|||
$remove[$i]["id"] = $items[$i]->getDbId();
|
||||
}
|
||||
|
||||
$this->removeItems($remove, false);
|
||||
$this->removeItems($remove, false, true);
|
||||
}
|
||||
} else {
|
||||
$rebroadcasts = $instance->getCcShowInstancessRelatedByDbId(null, $this->con);
|
||||
|
|
|
@ -1113,11 +1113,13 @@ SQL;
|
|||
*/
|
||||
public static function create($data)
|
||||
{
|
||||
$startDateTime = new DateTime($data['add_show_start_date']." ".$data['add_show_start_time']);
|
||||
$utcStartDateTime = clone $startDateTime;
|
||||
$utcStartDateTime->setTimezone(new DateTimeZone('UTC'));
|
||||
/*$startDateTime = new DateTime($data['add_show_start_date']." ".$data['add_show_start_time']);*/
|
||||
|
||||
// these are not used
|
||||
/*$utcStartDateTime = clone $startDateTime;
|
||||
$utcStartDateTime->setTimezone(new DateTimeZone('UTC'));*/
|
||||
|
||||
if ($data['add_show_no_end']) {
|
||||
/*if ($data['add_show_no_end']) {
|
||||
$endDate = NULL;
|
||||
} elseif ($data['add_show_repeats']) {
|
||||
$endDateTime = new DateTime($data['add_show_end_date']);
|
||||
|
@ -1129,28 +1131,29 @@ SQL;
|
|||
//$endDateTime->setTimezone(new DateTimeZone('UTC'));
|
||||
$endDateTime->add(new DateInterval("P1D"));
|
||||
$endDate = $endDateTime->format("Y-m-d");
|
||||
}
|
||||
}*/
|
||||
|
||||
//What we are doing here is checking if the show repeats or if
|
||||
//any repeating days have been checked. If not, then by default
|
||||
//the "selected" DOW is the initial day.
|
||||
//DOW in local time.
|
||||
$startDow = date("w", $startDateTime->getTimestamp());
|
||||
/*$startDow = date("w", $startDateTime->getTimestamp());
|
||||
if (!$data['add_show_repeats']) {
|
||||
$data['add_show_day_check'] = array($startDow);
|
||||
} elseif ($data['add_show_repeats'] && $data['add_show_day_check'] == "") {
|
||||
$data['add_show_day_check'] = array($startDow);
|
||||
}
|
||||
}*/
|
||||
|
||||
//find repeat type or set to a non repeating show.
|
||||
$repeatType = ($data['add_show_repeats']) ? $data['add_show_repeat_type'] : -1;
|
||||
/*$repeatType = ($data['add_show_repeats']) ? $data['add_show_repeat_type'] : -1;*/
|
||||
|
||||
if ($data['add_show_id'] == -1) {
|
||||
/*if ($data['add_show_id'] == -1) {
|
||||
$ccShow = new CcShow();
|
||||
} else {
|
||||
$ccShow = CcShowQuery::create()->findPK($data['add_show_id']);
|
||||
}
|
||||
$ccShow->setDbName($data['add_show_name']);
|
||||
}*/
|
||||
|
||||
/*$ccShow->setDbName($data['add_show_name']);
|
||||
$ccShow->setDbDescription($data['add_show_description']);
|
||||
$ccShow->setDbUrl($data['add_show_url']);
|
||||
$ccShow->setDbGenre($data['add_show_genre']);
|
||||
|
@ -1160,25 +1163,26 @@ SQL;
|
|||
$ccShow->setDbLiveStreamUsingCustomAuth($data['cb_custom_auth'] == 1);
|
||||
$ccShow->setDbLiveStreamUser($data['custom_username']);
|
||||
$ccShow->setDbLiveStreamPass($data['custom_password']);
|
||||
$ccShow->save();
|
||||
$ccShow->save();*/
|
||||
|
||||
$showId = $ccShow->getDbId();
|
||||
/*$showId = $ccShow->getDbId();*/
|
||||
|
||||
$isRecorded = (isset($data['add_show_record']) && $data['add_show_record']) ? 1 : 0;
|
||||
/*$isRecorded = (isset($data['add_show_record']) && $data['add_show_record']) ? 1 : 0;*/
|
||||
|
||||
if ($data['add_show_id'] != -1) {
|
||||
/*if ($data['add_show_id'] != -1) {
|
||||
$show = new Application_Model_Show($showId);
|
||||
//CC-4150 CULPRIT
|
||||
$show->deletePossiblyInvalidInstances($data, $endDate, $isRecorded, $repeatType);
|
||||
}
|
||||
}*/
|
||||
|
||||
//check if we are adding or updating a show, and if updating
|
||||
//erase all the show's show_days information first.
|
||||
if ($data['add_show_id'] != -1) {
|
||||
/*if ($data['add_show_id'] != -1) {
|
||||
CcShowDaysQuery::create()->filterByDbShowId($data['add_show_id'])->delete();
|
||||
}
|
||||
}*/
|
||||
|
||||
//don't set day for monthly repeat type, it's invalid.
|
||||
if ($data['add_show_repeats'] && $data['add_show_repeat_type'] == 2) {
|
||||
/*if ($data['add_show_repeats'] && $data['add_show_repeat_type'] == 2) {
|
||||
$showDay = new CcShowDays();
|
||||
$showDay->setDbFirstShow($startDateTime->format("Y-m-d"));
|
||||
$showDay->setDbLastShow($endDate);
|
||||
|
@ -1215,19 +1219,19 @@ SQL;
|
|||
$showDay->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
//check if we are adding or updating a show, and if updating
|
||||
//erase all the show's future show_rebroadcast information first.
|
||||
if (($data['add_show_id'] != -1) && isset($data['add_show_rebroadcast']) && $data['add_show_rebroadcast']) {
|
||||
/*if (($data['add_show_id'] != -1) && isset($data['add_show_rebroadcast']) && $data['add_show_rebroadcast']) {
|
||||
CcShowRebroadcastQuery::create()
|
||||
->filterByDbShowId($data['add_show_id'])
|
||||
->delete();
|
||||
}
|
||||
}*/
|
||||
//adding rows to cc_show_rebroadcast
|
||||
/* TODO: Document magic constant 10 and define it properly somewhere
|
||||
--RG */
|
||||
if (($isRecorded && $data['add_show_rebroadcast']) && ($repeatType != -1)) {
|
||||
/*if (($isRecorded && $data['add_show_rebroadcast']) && ($repeatType != -1)) {
|
||||
for ($i=1; $i<=10; $i++) {
|
||||
if ($data['add_show_rebroadcast_date_'.$i]) {
|
||||
$showRebroad = new CcShowRebroadcast();
|
||||
|
@ -1264,14 +1268,14 @@ SQL;
|
|||
$showRebroad->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
//check if we are adding or updating a show, and if updating
|
||||
//erase all the show's show_rebroadcast information first.
|
||||
if ($data['add_show_id'] != -1) {
|
||||
/*if ($data['add_show_id'] != -1) {
|
||||
CcShowHostsQuery::create()->filterByDbShow($data['add_show_id'])->delete();
|
||||
}
|
||||
if (is_array($data['add_show_hosts'])) {
|
||||
}*/
|
||||
/*if (is_array($data['add_show_hosts'])) {
|
||||
//add selected hosts to cc_show_hosts table.
|
||||
foreach ($data['add_show_hosts'] as $host) {
|
||||
$showHost = new CcShowHosts();
|
||||
|
@ -1279,9 +1283,9 @@ SQL;
|
|||
$showHost->setDbHost($host);
|
||||
$showHost->save();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if ($data['add_show_id'] != -1) {
|
||||
/*if ($data['add_show_id'] != -1) {
|
||||
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
||||
$con->beginTransaction();
|
||||
|
||||
|
@ -1306,12 +1310,12 @@ SQL;
|
|||
Logging::info("Couldn't update schedule status.");
|
||||
Logging::info($e->getMessage());
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
Application_Model_Show::populateShowUntil($showId);
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
/*Application_Model_Show::populateShowUntil($showId);
|
||||
Application_Model_RabbitMq::PushSchedule();*/
|
||||
|
||||
return $showId;
|
||||
/*return $showId;*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1321,7 +1325,7 @@ SQL;
|
|||
*
|
||||
* @param int $p_showId
|
||||
*/
|
||||
public static function populateShowUntil($p_showId)
|
||||
/*public static function populateShowUntil($p_showId)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
$date = Application_Model_Preference::GetShowsPopulatedUntil();
|
||||
|
@ -1342,7 +1346,7 @@ SQL;
|
|||
foreach ($res as $showDaysRow) {
|
||||
Application_Model_Show::populateShow($showDaysRow, $p_populateUntilDateTime);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* We are going to use cc_show_days as a template, to generate Show Instances. This function
|
||||
|
@ -1355,7 +1359,7 @@ SQL;
|
|||
* @param DateTime $p_populateUntilDateTime
|
||||
* DateTime object in UTC time.
|
||||
*/
|
||||
private static function populateShow($p_showDaysRow, $p_populateUntilDateTime)
|
||||
/*private static function populateShow($p_showDaysRow, $p_populateUntilDateTime)
|
||||
{
|
||||
// TODO : use constants instead of int values here? or maybe php will
|
||||
// get enum types by the time somebody gets around to fix this. -- RG
|
||||
|
@ -1369,7 +1373,7 @@ SQL;
|
|||
Application_Model_Show::populateRepeatingShow($p_showDaysRow, $p_populateUntilDateTime, 'P1M');
|
||||
}
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Creates a single show instance. If the show is recorded, it may have multiple
|
||||
|
@ -1382,7 +1386,7 @@ SQL;
|
|||
*/
|
||||
private static function populateNonRepeatingShow($p_showRow, $p_populateUntilDateTime)
|
||||
{
|
||||
$show_id = $p_showRow["show_id"];
|
||||
/*$show_id = $p_showRow["show_id"];
|
||||
$first_show = $p_showRow["first_show"]; //non-UTC
|
||||
$start_time = $p_showRow["start_time"]; //non-UTC
|
||||
$duration = $p_showRow["duration"];
|
||||
|
@ -1393,41 +1397,42 @@ SQL;
|
|||
//start & end UTC DateTimes for the show.
|
||||
list($utcStartDateTime, $utcEndDateTime) = Application_Model_Show::createUTCStartEndDateTime($start, $duration, $timezone);
|
||||
if ($utcStartDateTime->getTimestamp() < $p_populateUntilDateTime->getTimestamp()) {
|
||||
$currentUtcTimestamp = gmdate("Y-m-d H:i:s");
|
||||
$currentUtcTimestamp = gmdate("Y-m-d H:i:s");*/
|
||||
|
||||
$show = new Application_Model_Show($show_id);
|
||||
/*$show = new Application_Model_Show($show_id);
|
||||
if ($show->hasInstance()) {
|
||||
$ccShowInstance = $show->getInstance();
|
||||
$newInstance = false;
|
||||
} else {
|
||||
}*/ /*else {
|
||||
$ccShowInstance = new CcShowInstances();
|
||||
$newInstance = true;
|
||||
}
|
||||
}*/
|
||||
|
||||
if ($newInstance || $ccShowInstance->getDbStarts() > $currentUtcTimestamp) {
|
||||
/*if ($newInstance || $ccShowInstance->getDbStarts() > $currentUtcTimestamp) {
|
||||
$ccShowInstance->setDbShowId($show_id);
|
||||
$ccShowInstance->setDbStarts($utcStartDateTime);
|
||||
$ccShowInstance->setDbEnds($utcEndDateTime);
|
||||
$ccShowInstance->setDbRecord($record);
|
||||
$ccShowInstance->save();
|
||||
}
|
||||
}*/
|
||||
|
||||
$show_instance_id = $ccShowInstance->getDbId();
|
||||
$showInstance = new Application_Model_ShowInstance($show_instance_id);
|
||||
/* $show_instance_id = $ccShowInstance->getDbId();
|
||||
$showInstance = new Application_Model_ShowInstance($show_instance_id);*/
|
||||
|
||||
if (!$newInstance) {
|
||||
/*if (!$newInstance) {
|
||||
$showInstance->correctScheduleStartTimes();
|
||||
}
|
||||
}*/
|
||||
|
||||
$sql = "SELECT * FROM cc_show_rebroadcast WHERE show_id=:show_id";
|
||||
/*$sql = "SELECT * FROM cc_show_rebroadcast WHERE show_id=:show_id";
|
||||
$rebroadcasts = Application_Common_Database::prepareAndExecute($sql,
|
||||
array( ':show_id' => $show_id ), 'all');
|
||||
array( ':show_id' => $show_id ), 'all');*/
|
||||
|
||||
if ($showInstance->isRecorded()) {
|
||||
/*if ($showInstance->isRecorded()) {
|
||||
//only do this for editing
|
||||
$showInstance->deleteRebroadcasts();
|
||||
self::createRebroadcastInstances($rebroadcasts, $currentUtcTimestamp, $show_id, $show_instance_id, $start, $duration, $timezone);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
/*}*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1444,7 +1449,7 @@ SQL;
|
|||
*/
|
||||
private static function populateRepeatingShow($p_showDaysRow, $p_populateUntilDateTime, $p_interval)
|
||||
{
|
||||
$show_id = $p_showDaysRow["show_id"];
|
||||
/*$show_id = $p_showDaysRow["show_id"];
|
||||
$next_pop_date = $p_showDaysRow["next_pop_date"];
|
||||
$first_show = $p_showDaysRow["first_show"]; //non-UTC
|
||||
$last_show = $p_showDaysRow["last_show"]; //non-UTC
|
||||
|
@ -1464,21 +1469,23 @@ SQL;
|
|||
|
||||
$utcStartDateTime = Application_Common_DateHelper::ConvertToUtcDateTime($start, $timezone);
|
||||
//convert $last_show into a UTC DateTime object, or null if there is no last show.
|
||||
$utcLastShowDateTime = $last_show ? Application_Common_DateHelper::ConvertToUtcDateTime($last_show, $timezone) : null;
|
||||
$utcLastShowDateTime = $last_show ? Application_Common_DateHelper::ConvertToUtcDateTime($last_show, $timezone) : null;*/
|
||||
|
||||
$sql = "SELECT * FROM cc_show_rebroadcast WHERE show_id=:show_id";
|
||||
/*$sql = "SELECT * FROM cc_show_rebroadcast WHERE show_id=:show_id";
|
||||
|
||||
$rebroadcasts = Application_Common_Database::prepareAndExecute( $sql,
|
||||
array( ':show_id' => $show_id ), 'all');
|
||||
|
||||
$show = new Application_Model_Show($show_id);
|
||||
$show = new Application_Model_Show($show_id);*/
|
||||
|
||||
while ($utcStartDateTime->getTimestamp() <= $p_populateUntilDateTime->getTimestamp()
|
||||
&& (is_null($utcLastShowDateTime) || $utcStartDateTime->getTimestamp() < $utcLastShowDateTime->getTimestamp())){
|
||||
/*while ($utcStartDateTime->getTimestamp() <= $p_populateUntilDateTime->getTimestamp()
|
||||
&& (is_null($utcLastShowDateTime) || $utcStartDateTime->getTimestamp() < $utcLastShowDateTime->getTimestamp())){*/
|
||||
|
||||
list($utcStartDateTime, $utcEndDateTime) = self::createUTCStartEndDateTime($start, $duration, $timezone);
|
||||
/*list($utcStartDateTime, $utcEndDateTime) = self::createUTCStartEndDateTime($start, $duration, $timezone);*/
|
||||
|
||||
if ($show->hasInstanceOnDate($utcStartDateTime)) {
|
||||
//determine if we are adding a new show
|
||||
//or editing a show
|
||||
/* if ($show->hasInstanceOnDate($utcStartDateTime)) {
|
||||
$ccShowInstance = $show->getInstanceOnDate($utcStartDateTime);
|
||||
|
||||
if ($ccShowInstance->getDbModifiedInstance()) {
|
||||
|
@ -1491,12 +1498,12 @@ SQL;
|
|||
} else {
|
||||
$ccShowInstance = new CcShowInstances();
|
||||
$newInstance = true;
|
||||
}
|
||||
}*/
|
||||
|
||||
/* When editing the start/end time of a repeating show, we don't want to
|
||||
* change shows that started in the past. So check the start time.
|
||||
*/
|
||||
if ($newInstance || $ccShowInstance->getDbStarts() > $currentUtcTimestamp) {
|
||||
/*if ($newInstance || $ccShowInstance->getDbStarts() > $currentUtcTimestamp) {
|
||||
$ccShowInstance->setDbShowId($show_id);
|
||||
$ccShowInstance->setDbStarts($utcStartDateTime);
|
||||
$ccShowInstance->setDbEnds($utcEndDateTime);
|
||||
|
@ -1506,21 +1513,22 @@ SQL;
|
|||
|
||||
|
||||
$show_instance_id = $ccShowInstance->getDbId();
|
||||
$showInstance = new Application_Model_ShowInstance($show_instance_id);
|
||||
$showInstance = new Application_Model_ShowInstance($show_instance_id);*/
|
||||
|
||||
/* If we are updating a show then make sure that the scheduled content within
|
||||
* the show is updated to the correct time. */
|
||||
if (!$newInstance) {
|
||||
// don't we already do this in deletePossiblyInvalidInstances???
|
||||
/*if (!$newInstance) {
|
||||
$showInstance->correctScheduleStartTimes();
|
||||
}
|
||||
}*/
|
||||
|
||||
$showInstance->deleteRebroadcasts();
|
||||
/*$showInstance->deleteRebroadcasts();
|
||||
self::createRebroadcastInstances($rebroadcasts, $currentUtcTimestamp, $show_id, $show_instance_id, $start, $duration, $timezone);
|
||||
list($start, $utcStartDateTime) = self::advanceRepeatingDate($p_interval, $start, $timezone);
|
||||
list($start, $utcStartDateTime) = self::advanceRepeatingDate($p_interval, $start, $timezone);*/
|
||||
|
||||
}
|
||||
/*}*/
|
||||
|
||||
Application_Model_Show::setNextPop($start, $show_id, $day);
|
||||
/*Application_Model_Show::setNextPop($start, $show_id, $day);*/
|
||||
}
|
||||
|
||||
private static function advanceRepeatingDate($p_interval, $start, $timezone)
|
||||
|
@ -1574,7 +1582,7 @@ SQL;
|
|||
*/
|
||||
private static function createUTCStartEndDateTime($p_start, $p_duration, $p_timezone=null, $p_offset=null)
|
||||
{
|
||||
$timezone = $p_timezone ? $p_timezone : date_default_timezone_get();
|
||||
/*$timezone = $p_timezone ? $p_timezone : date_default_timezone_get();
|
||||
|
||||
$startDateTime = new DateTime($p_start, new DateTimeZone($timezone));
|
||||
if (isset($p_offset)) {
|
||||
|
@ -1588,7 +1596,7 @@ SQL;
|
|||
list($hours, $mins) = array_slice($duration, 0, 2);
|
||||
$endDateTime->add(new DateInterval("PT{$hours}H{$mins}M"));
|
||||
|
||||
return array($startDateTime, $endDateTime);
|
||||
return array($startDateTime, $endDateTime);*/
|
||||
}
|
||||
|
||||
/* Create rebroadcast instances for a created show marked for recording
|
||||
|
@ -1614,7 +1622,7 @@ SQL;
|
|||
{
|
||||
//Y-m-d
|
||||
//use only the date part of the show start time stamp for the offsets to work properly.
|
||||
$date = explode(" ", $p_startTime);
|
||||
/*$date = explode(" ", $p_startTime);
|
||||
$start_date = $date[0];
|
||||
|
||||
foreach ($p_rebroadcasts as $rebroadcast) {
|
||||
|
@ -1636,7 +1644,7 @@ SQL;
|
|||
$newRebroadcastInstance->setDbOriginalShow($p_showInstanceId);
|
||||
$newRebroadcastInstance->save();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1656,7 +1664,8 @@ SQL;
|
|||
$showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil();
|
||||
//if application is requesting shows past our previous populated until date, generate shows up until this point.
|
||||
if (is_null($showsPopUntil) || $showsPopUntil->getTimestamp() < $end_timestamp->getTimestamp()) {
|
||||
Application_Model_Show::populateAllShowsInRange($showsPopUntil, $end_timestamp);
|
||||
$service_show = new Application_Service_ShowService();
|
||||
$ccShow = $service_show->delegateInstanceCreation(null, $end_timestamp, true);
|
||||
Application_Model_Preference::SetShowsPopulatedUntil($end_timestamp);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ class Application_Model_ShowBuilder
|
|||
private $contentDT;
|
||||
private $epoch_now;
|
||||
private $currentShow;
|
||||
private $currentShowId;
|
||||
|
||||
private $showInstances = array();
|
||||
|
||||
|
@ -27,6 +28,7 @@ class Application_Model_ShowBuilder
|
|||
"footer" => false,
|
||||
"empty" => false,
|
||||
"allowed" => false,
|
||||
"linked_allowed" => true,
|
||||
"id" => 0,
|
||||
"instance" => "",
|
||||
"starts" => "",
|
||||
|
@ -85,6 +87,18 @@ class Application_Model_ShowBuilder
|
|||
return;
|
||||
}
|
||||
|
||||
if ($this->currentShow) {
|
||||
$this->currentShowId = $p_item["show_id"];
|
||||
}
|
||||
|
||||
/* If any linked show instance is currently playing
|
||||
* we have to disable editing, or else the times
|
||||
* will not make sense for shows scheduled in the future
|
||||
*/
|
||||
if ($p_item["linked"] && $p_item["show_id"] == $this->currentShowId) {
|
||||
$row["linked_allowed"] = false;
|
||||
}
|
||||
|
||||
if ($this->user->canSchedule($p_item["show_id"]) == true) {
|
||||
$row["allowed"] = true;
|
||||
}
|
||||
|
@ -174,7 +188,7 @@ class Application_Model_ShowBuilder
|
|||
private function makeHeaderRow($p_item)
|
||||
{
|
||||
$row = $this->defaultRowArray;
|
||||
$this->isAllowed($p_item, $row);
|
||||
//$this->isAllowed($p_item, $row);
|
||||
$this->getRowTimestamp($p_item, $row);
|
||||
$this->getItemColor($p_item, $row);
|
||||
|
||||
|
@ -202,8 +216,7 @@ class Application_Model_ShowBuilder
|
|||
// at the time of creating on show, the recorded file is not in the DB yet.
|
||||
// therefore, 'si_file_id' is null. So we need to check it.
|
||||
if (Application_Model_Preference::GetUploadToSoundcloudOption() && isset($p_item['si_file_id'])) {
|
||||
$file = Application_Model_StoredFile::Recall(
|
||||
$p_item['si_file_id']);
|
||||
$file = Application_Model_StoredFile::RecallById($p_item['si_file_id']);
|
||||
if (isset($file)) {
|
||||
$sid = $file->getSoundCloudId();
|
||||
$row['soundcloud_id'] = $sid;
|
||||
|
@ -218,6 +231,8 @@ class Application_Model_ShowBuilder
|
|||
$this->currentShow = false;
|
||||
}
|
||||
|
||||
$this->isAllowed($p_item, $row);
|
||||
|
||||
$row["header"] = true;
|
||||
$row["starts"] = $showStartDT->format("Y-m-d H:i");
|
||||
$row["startDate"] = $showStartDT->format("Y-m-d");
|
||||
|
|
|
@ -113,13 +113,13 @@ SQL;
|
|||
|
||||
public function setSoundCloudFileId($p_soundcloud_id)
|
||||
{
|
||||
$file = Application_Model_StoredFile::Recall($this->_showInstance->getDbRecordedFile());
|
||||
$file = Application_Model_StoredFile::RecallById($this->_showInstance->getDbRecordedFile());
|
||||
$file->setSoundCloudFileId($p_soundcloud_id);
|
||||
}
|
||||
|
||||
public function getSoundCloudFileId()
|
||||
{
|
||||
$file = Application_Model_StoredFile::Recall($this->_showInstance->getDbRecordedFile());
|
||||
$file = Application_Model_StoredFile::RecallById($this->_showInstance->getDbRecordedFile());
|
||||
|
||||
return $file->getSoundCloudId();
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ SQL;
|
|||
$file_id = $this->_showInstance->getDbRecordedFile();
|
||||
|
||||
if (isset($file_id)) {
|
||||
$file = Application_Model_StoredFile::Recall($file_id);
|
||||
$file = Application_Model_StoredFile::RecallById($file_id);
|
||||
|
||||
if (isset($file) && file_exists($file->getFilePath())) {
|
||||
return $file;
|
||||
|
@ -391,7 +391,7 @@ SQL;
|
|||
* @param int $plId
|
||||
* Playlist ID.
|
||||
*/
|
||||
public function addPlaylistToShow($pl_id, $checkUserPerm = true)
|
||||
/*public function addPlaylistToShow($pl_id, $checkUserPerm = true)
|
||||
{
|
||||
$ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0;
|
||||
$id = $this->_showInstance->getDbId();
|
||||
|
@ -401,7 +401,7 @@ SQL;
|
|||
array(array("id" => 0, "instance" => $id, "timestamp" => $ts)),
|
||||
array(array("id" => $pl_id, "type" => "playlist"))
|
||||
);
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Add a media file as the last item in the show.
|
||||
|
@ -427,12 +427,12 @@ SQL;
|
|||
* @param array $plIds
|
||||
* An array of playlist IDs.
|
||||
*/
|
||||
public function scheduleShow($plIds)
|
||||
/*public function scheduleShow($plIds)
|
||||
{
|
||||
foreach ($plIds as $plId) {
|
||||
$this->addPlaylistToShow($plId);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public function clearShow()
|
||||
{
|
||||
|
|
|
@ -20,6 +20,11 @@ class Application_Model_StoredFile
|
|||
*/
|
||||
private $_file;
|
||||
|
||||
/**
|
||||
* @holds PDO object reference
|
||||
*/
|
||||
private $_con;
|
||||
|
||||
/**
|
||||
* array of db metadata -> propel
|
||||
*/
|
||||
|
@ -53,6 +58,11 @@ class Application_Model_StoredFile
|
|||
"cueout" => "DbCueOut",
|
||||
);
|
||||
|
||||
function __construct($file, $con) {
|
||||
$this->_file = $file;
|
||||
$this->_con = $con;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->_file->getDbId();
|
||||
|
@ -86,9 +96,8 @@ class Application_Model_StoredFile
|
|||
$this->_file->save();
|
||||
}
|
||||
|
||||
public static function createWithFile($f) {
|
||||
$storedFile = new Application_Model_StoredFile();
|
||||
$storedFile->_file = $f;
|
||||
public static function createWithFile($f, $con) {
|
||||
$storedFile = new Application_Model_StoredFile($f, $con);
|
||||
return $storedFile;
|
||||
}
|
||||
|
||||
|
@ -218,7 +227,7 @@ class Application_Model_StoredFile
|
|||
}
|
||||
|
||||
$this->_file->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||
$this->_file->save();
|
||||
$this->_file->save($this->_con);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -334,7 +343,7 @@ SQL;
|
|||
|
||||
if (is_array($ids) && count($ids) > 0) {
|
||||
return array_map( function ($id) {
|
||||
return Application_Model_Playlist::Recall($id);
|
||||
return Application_Model_Playlist::RecallById($id);
|
||||
}, $ids);
|
||||
} else {
|
||||
return array();
|
||||
|
@ -491,7 +500,7 @@ SQL;
|
|||
|
||||
$this->_file->setDbDirectory($musicDir->getId());
|
||||
$this->_file->setDbFilepath($path_info[1]);
|
||||
$this->_file->save();
|
||||
$this->_file->save($this->_con);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -544,7 +553,7 @@ SQL;
|
|||
return $baseUrl."api/get-media/file/".$this->getId().".".$this->getFileExtension();
|
||||
}
|
||||
|
||||
public static function Insert($md)
|
||||
public static function Insert($md, $con)
|
||||
{
|
||||
// save some work by checking if filepath is given right away
|
||||
if ( !isset($md['MDATA_KEY_FILEPATH']) ) {
|
||||
|
@ -556,8 +565,7 @@ SQL;
|
|||
$file->setDbUtime($now);
|
||||
$file->setDbMtime($now);
|
||||
|
||||
$storedFile = new Application_Model_StoredFile();
|
||||
$storedFile->_file = $file;
|
||||
$storedFile = new Application_Model_StoredFile($file, $con);
|
||||
|
||||
// removed "//" in the path. Always use '/' for path separator
|
||||
// TODO : it might be better to just call OsPath::normpath on the file
|
||||
|
@ -574,20 +582,19 @@ SQL;
|
|||
return $storedFile;
|
||||
}
|
||||
|
||||
public static function Recall($p_id=null, $p_gunid=null, $p_md5sum=null,
|
||||
$p_filepath=null) {
|
||||
if( isset($p_id ) ) {
|
||||
$f = CcFilesQuery::create()->findPK(intval($p_id));
|
||||
return is_null($f) ? null : self::createWithFile($f);
|
||||
} elseif ( isset($p_gunid) ) {
|
||||
throw new Exception("You should never use gunid ($gunid) anymore");
|
||||
} elseif ( isset($p_md5sum) ) {
|
||||
throw new Exception("Searching by md5($p_md5sum) is disabled");
|
||||
} elseif ( isset($p_filepath) ) {
|
||||
return is_null($f) ? null : self::createWithFile(
|
||||
Application_Model_StoredFile::RecallByFilepath($p_filepath));
|
||||
/* TODO: Callers of this function should use a Propel transaction. Start
|
||||
* by creating $con outside the function with beingTransaction() */
|
||||
public static function RecallById($p_id=null, $con=null) {
|
||||
//TODO
|
||||
if (is_null($con)) {
|
||||
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if (isset($p_id)) {
|
||||
$f = CcFilesQuery::create()->findPK(intval($p_id), $con);
|
||||
return is_null($f) ? null : self::createWithFile($f, $con);
|
||||
} else {
|
||||
throw new Exception("No arguments passsed to Recall");
|
||||
throw new Exception("No arguments passed to RecallById");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -603,7 +610,7 @@ SQL;
|
|||
* @param string $p_filepath path of file stored in Airtime.
|
||||
* @return Application_Model_StoredFile|NULL
|
||||
*/
|
||||
public static function RecallByFilepath($p_filepath)
|
||||
public static function RecallByFilepath($p_filepath, $con)
|
||||
{
|
||||
$path_info = Application_Model_MusicDir::splitFilePath($p_filepath);
|
||||
|
||||
|
@ -615,11 +622,11 @@ SQL;
|
|||
$file = CcFilesQuery::create()
|
||||
->filterByDbDirectory($music_dir->getId())
|
||||
->filterByDbFilepath($path_info[1])
|
||||
->findOne();
|
||||
return is_null($file) ? null : self::createWithFile($file);
|
||||
->findOne($con);
|
||||
return is_null($file) ? null : self::createWithFile($file, $con);
|
||||
}
|
||||
|
||||
public static function RecallByPartialFilepath($partial_path)
|
||||
public static function RecallByPartialFilepath($partial_path, $con)
|
||||
{
|
||||
$path_info = Application_Model_MusicDir::splitFilePath($partial_path);
|
||||
|
||||
|
@ -631,11 +638,10 @@ SQL;
|
|||
$files = CcFilesQuery::create()
|
||||
->filterByDbDirectory($music_dir->getId())
|
||||
->filterByDbFilepath("$path_info[1]%")
|
||||
->find();
|
||||
->find($con);
|
||||
$res = array();
|
||||
foreach ($files as $file) {
|
||||
$storedFile = new Application_Model_StoredFile();
|
||||
$storedFile->_file = $file;
|
||||
$storedFile = new Application_Model_StoredFile($file, $con);
|
||||
$res[] = $storedFile;
|
||||
}
|
||||
|
||||
|
@ -811,7 +817,7 @@ SQL;
|
|||
$row['bit_rate'] = $formatter->format();
|
||||
|
||||
//soundcloud status
|
||||
$file = Application_Model_StoredFile::Recall($row['id']);
|
||||
$file = Application_Model_StoredFile::RecallById($row['id']);
|
||||
$row['soundcloud_status'] = $file->getSoundCloudId();
|
||||
|
||||
// for audio preview
|
||||
|
@ -1011,6 +1017,9 @@ SQL;
|
|||
Logging::info("Successfully written identification file for
|
||||
uploaded '$audio_stor'");
|
||||
}
|
||||
//if the uploaded file is not UTF-8 encoded, let's encode it. Assuming source
|
||||
//encoding is ISO-8859-1
|
||||
$audio_stor = mb_detect_encoding($audio_stor, "UTF-8") == "UTF-8" ? $audio_stor : utf8_encode($audio_stor);
|
||||
Logging::info("copyFileToStor: moving file $audio_file to $audio_stor");
|
||||
// Martin K.: changed to rename: Much less load + quicker since this is
|
||||
// an atomic operation
|
||||
|
@ -1305,7 +1314,7 @@ SQL;
|
|||
|
||||
public static function setIsPlaylist($p_playlistItems, $p_type, $p_status) {
|
||||
foreach ($p_playlistItems as $item) {
|
||||
$file = self::Recall($item->getDbFileId());
|
||||
$file = self::RecallById($item->getDbFileId());
|
||||
$fileId = $file->_file->getDbId();
|
||||
if ($p_type == 'playlist') {
|
||||
// we have to check if the file is in another playlist before
|
||||
|
@ -1327,7 +1336,7 @@ SQL;
|
|||
} else {
|
||||
$fileId = $p_fileId;
|
||||
}
|
||||
$file = self::Recall($fileId);
|
||||
$file = self::RecallById($fileId);
|
||||
$updateIsScheduled = false;
|
||||
|
||||
if (!is_null($fileId) && !in_array($fileId, Application_Model_Schedule::getAllFutureScheduledFiles())) {
|
||||
|
|
|
@ -20,6 +20,8 @@ class CcFiles extends BaseCcFiles {
|
|||
|
||||
public function setDbLength($v)
|
||||
{
|
||||
//we are using DateTime instead of DateInterval because the latter doesn't
|
||||
//support subseconds :(
|
||||
if ($v instanceof DateTime) {
|
||||
$dt = $v;
|
||||
}
|
||||
|
|
|
@ -15,4 +15,171 @@
|
|||
*/
|
||||
class CcShow extends BaseCcShow {
|
||||
|
||||
public function getCcShowDays(){
|
||||
return CcShowDaysQuery::create()->filterByDbShowId($this->getDbId())->find();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of CcShowDays objects which contain a foreign key that references this object.
|
||||
*
|
||||
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||
* Otherwise the results are fetched from the database the first time, then cached.
|
||||
* Next time the same method is called without $criteria, the cached collection is returned.
|
||||
* If this CcShow is new, it will return
|
||||
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @return PropelCollection|array CcShowDays[] List of CcShowDays objects
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getFirstCcShowDay($criteria = null, PropelPDO $con = null)
|
||||
{
|
||||
if(null === $this->collCcShowDayss || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collCcShowDayss) {
|
||||
// return empty collection
|
||||
$this->initCcShowDayss();
|
||||
} else {
|
||||
$collCcShowDayss = CcShowDaysQuery::create(null, $criteria)
|
||||
->filterByCcShow($this)
|
||||
->orderByDbFirstShow()
|
||||
->limit(1)
|
||||
->find($con);
|
||||
if (null !== $criteria) {
|
||||
return $collCcShowDayss;
|
||||
}
|
||||
$this->collCcShowDayss = $collCcShowDayss;
|
||||
}
|
||||
}
|
||||
return $this->collCcShowDayss[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of CcShowInstances objects which contain a foreign key that references this object.
|
||||
*
|
||||
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||
* Otherwise the results are fetched from the database the first time, then cached.
|
||||
* Next time the same method is called without $criteria, the cached collection is returned.
|
||||
* If this CcShow is new, it will return
|
||||
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @return PropelCollection|array CcShowInstances[] List of CcShowInstances objects
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getFutureCcShowInstancess($criteria = null, PropelPDO $con = null)
|
||||
{
|
||||
if(null === $this->collCcShowInstancess || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collCcShowInstancess) {
|
||||
// return empty collection
|
||||
$this->initCcShowInstancess();
|
||||
} else {
|
||||
$collCcShowInstancess = CcShowInstancesQuery::create(null, $criteria)
|
||||
->filterByCcShow($this)
|
||||
->filterByDbStarts(gmdate("Y-m-d H:i:s"), Criteria::GREATER_THAN)
|
||||
->filterByDbModifiedInstance(false)
|
||||
->find($con);
|
||||
if (null !== $criteria) {
|
||||
return $collCcShowInstancess;
|
||||
}
|
||||
$this->collCcShowInstancess = $collCcShowInstancess;
|
||||
}
|
||||
}
|
||||
return $this->collCcShowInstancess;
|
||||
}
|
||||
|
||||
public function isRecorded()
|
||||
{
|
||||
$ccShowInstances = CcShowInstancesQuery::create()
|
||||
->filterByDbShowId($this->getDbId())
|
||||
->filterByDbRecord(1)
|
||||
->filterByDbModifiedInstance(false)
|
||||
->findOne();
|
||||
|
||||
return (!is_null($ccShowInstances));
|
||||
}
|
||||
|
||||
public function isRebroadcast()
|
||||
{
|
||||
$ccShowInstances = CcShowInstancesQuery::create()
|
||||
->filterByDbShowId($this->getDbId())
|
||||
->filterByDbRebroadcast(1)
|
||||
->filterByDbModifiedInstance(false)
|
||||
->findOne();
|
||||
|
||||
return (!is_null($ccShowInstances));
|
||||
}
|
||||
|
||||
public function getRebroadcastsRelative()
|
||||
{
|
||||
return CcShowRebroadcastQuery::create()
|
||||
->filterByDbShowId($this->getDbId())
|
||||
->orderByDbDayOffset()
|
||||
->find();
|
||||
}
|
||||
|
||||
public function getRebroadcastsAbsolute()
|
||||
{
|
||||
return CcShowInstancesQuery::create()
|
||||
->filterByDbShowId($this->getDbId())
|
||||
->filterByDbRebroadcast(1)
|
||||
->filterByDbModifiedInstance(false)
|
||||
->orderByDbStarts()
|
||||
->find();
|
||||
}
|
||||
|
||||
public function isLinked()
|
||||
{
|
||||
return $this->getDbLinked();
|
||||
}
|
||||
|
||||
public function isLinkable()
|
||||
{
|
||||
return $this->getDbIsLinkable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of CcShowInstances objects which contain a foreign key that references this object.
|
||||
*
|
||||
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||
* Otherwise the results are fetched from the database the first time, then cached.
|
||||
* Next time the same method is called without $criteria, the cached collection is returned.
|
||||
* If this CcShow is new, it will return
|
||||
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @return PropelCollection|array CcShowInstances[] List of CcShowInstances objects
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getCcShowInstancess($criteria = null, PropelPDO $con = null)
|
||||
{
|
||||
if(null === $this->collCcShowInstancess || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collCcShowInstancess) {
|
||||
// return empty collection
|
||||
$this->initCcShowInstancess();
|
||||
} else {
|
||||
$collCcShowInstancess = CcShowInstancesQuery::create(null, $criteria)
|
||||
->filterByCcShow($this)
|
||||
->filterByDbModifiedInstance(false)
|
||||
->filterByDbStarts(gmdate("Y-m-d H:i:s"), criteria::GREATER_THAN)
|
||||
->orderByDbId()
|
||||
->find($con);
|
||||
if (null !== $criteria) {
|
||||
return $collCcShowInstancess;
|
||||
}
|
||||
$this->collCcShowInstancess = $collCcShowInstancess;
|
||||
}
|
||||
}
|
||||
return $this->collCcShowInstancess;
|
||||
}
|
||||
|
||||
public function getInstanceIds() {
|
||||
$instanceIds = array();
|
||||
foreach ($this->getCcShowInstancess() as $ccShowInstance) {
|
||||
$instanceIds[] = $ccShowInstance->getDbId();
|
||||
}
|
||||
return $instanceIds;
|
||||
}
|
||||
} // CcShow
|
||||
|
|
|
@ -15,4 +15,54 @@
|
|||
*/
|
||||
class CcShowDays extends BaseCcShowDays {
|
||||
|
||||
public function isRepeating()
|
||||
{
|
||||
return $this->getDbRepeatType() != -1;
|
||||
}
|
||||
|
||||
public function getUTCStartDateAndTime()
|
||||
{
|
||||
$dt = new DateTime(
|
||||
"{$this->getDbFirstShow()} {$this->getDbStartTime()}",
|
||||
new DateTimeZone($this->getDbTimezone())
|
||||
);
|
||||
$dt->setTimezone(new DateTimeZone("UTC"));
|
||||
|
||||
return $dt;
|
||||
}
|
||||
|
||||
public function getLocalStartDateAndTime()
|
||||
{
|
||||
$dt = new DateTime(
|
||||
"{$this->getDbFirstShow()} {$this->getDbStartTime()}",
|
||||
new DateTimeZone($this->getDbTimezone())
|
||||
);
|
||||
|
||||
return $dt;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
* @param DateTime $startDateTime first show in user's local time
|
||||
*/
|
||||
public function getLocalEndDateAndTime($showStart)
|
||||
{
|
||||
$startDateTime = clone $showStart;
|
||||
$duration = explode(":", $this->getDbDuration());
|
||||
|
||||
return $startDateTime->add(new DateInterval('PT'.$duration[0].'H'.$duration[1].'M'));
|
||||
}
|
||||
|
||||
public function isShowStartInPast()
|
||||
{
|
||||
return $this->getUTCStartDateAndTime()->format("Y-m-d H:i:s") < gmdate("Y-m-d H:i:s");
|
||||
}
|
||||
|
||||
public function formatDuration()
|
||||
{
|
||||
$info = explode(':',$this->getDbDuration());
|
||||
|
||||
return str_pad(intval($info[0]),2,'0',STR_PAD_LEFT).'h '.str_pad(intval($info[1]),2,'0',STR_PAD_LEFT).'m';
|
||||
}
|
||||
} // CcShowDays
|
||||
|
|
|
@ -175,4 +175,20 @@ class CcShowInstances extends BaseCcShowInstances {
|
|||
return true;
|
||||
}
|
||||
|
||||
public function isRecorded()
|
||||
{
|
||||
return $this->getDbRecord() == 1 ? true : false;
|
||||
}
|
||||
|
||||
public function isRebroadcast()
|
||||
{
|
||||
return $this->getDbRebroadcast() == 1 ? true : false;
|
||||
}
|
||||
|
||||
public function getLocalStartDateTime()
|
||||
{
|
||||
$startDT = $this->getDbStarts(null);
|
||||
return $startDT->setTimezone(new DateTimeZone(Application_Model_Preference::GetTimezone()));
|
||||
}
|
||||
|
||||
} // CcShowInstances
|
||||
|
|
|
@ -15,4 +15,16 @@
|
|||
*/
|
||||
class CcSubjs extends BaseCcSubjs {
|
||||
|
||||
public function isAdminOrPM()
|
||||
{
|
||||
return $this->type === UTYPE_ADMIN || $this->type === UTYPE_PROGRAM_MANAGER;
|
||||
}
|
||||
|
||||
public function isHostOfShow($showId)
|
||||
{
|
||||
return CcShowHostsQuery::create()
|
||||
->filterByDbShow($showId)
|
||||
->filterByDbHost($this->getDbId())
|
||||
->count() > 0;
|
||||
}
|
||||
} // CcSubjs
|
||||
|
|
|
@ -52,6 +52,7 @@ class CcScheduleTableMap extends TableMap {
|
|||
$this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', true, null, null);
|
||||
$this->addColumn('PLAYOUT_STATUS', 'DbPlayoutStatus', 'SMALLINT', true, null, 1);
|
||||
$this->addColumn('BROADCASTED', 'DbBroadcasted', 'SMALLINT', true, null, 0);
|
||||
$this->addColumn('POSITION', 'DbPosition', 'INTEGER', true, null, 0);
|
||||
// validators
|
||||
} // initialize()
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'cc_schedule' table.
|
||||
* This class defines the structure of the 'cc_show_stamp' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
|
@ -14,12 +14,12 @@
|
|||
*
|
||||
* @package propel.generator.airtime.map
|
||||
*/
|
||||
class CcScheduleTableMap extends TableMap {
|
||||
class CcShowStampTableMap extends TableMap {
|
||||
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'airtime.map.CcScheduleTableMap';
|
||||
const CLASS_NAME = 'airtime.map.CcShowStampTableMap';
|
||||
|
||||
/**
|
||||
* Initialize the table attributes, columns and validators
|
||||
|
@ -31,25 +31,26 @@ class CcScheduleTableMap extends TableMap {
|
|||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('cc_schedule');
|
||||
$this->setPhpName('CcSchedule');
|
||||
$this->setClassname('CcSchedule');
|
||||
$this->setName('cc_show_stamp');
|
||||
$this->setPhpName('CcShowStamp');
|
||||
$this->setClassname('CcShowStamp');
|
||||
$this->setPackage('airtime');
|
||||
$this->setUseIdGenerator(true);
|
||||
$this->setPrimaryKeyMethodInfo('cc_schedule_id_seq');
|
||||
$this->setPrimaryKeyMethodInfo('cc_show_stamp_id_seq');
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
|
||||
$this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null);
|
||||
$this->addForeignKey('SHOW_ID', 'DbShowId', 'INTEGER', 'cc_show', 'ID', true, null, null);
|
||||
$this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', false, null, null);
|
||||
$this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
|
||||
$this->addForeignKey('STREAM_ID', 'DbStreamId', 'INTEGER', 'cc_webstream', 'ID', false, null, null);
|
||||
$this->addForeignKey('BLOCK_ID', 'DbBlockId', 'INTEGER', 'cc_block', 'ID', false, null, null);
|
||||
$this->addForeignKey('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', 'cc_playlist', 'ID', false, null, null);
|
||||
$this->addColumn('POSITION', 'DbPosition', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CLIP_LENGTH', 'DbClipLength', 'VARCHAR', false, null, '00:00:00');
|
||||
$this->addColumn('FADE_IN', 'DbFadeIn', 'TIME', false, null, '00:00:00');
|
||||
$this->addColumn('FADE_OUT', 'DbFadeOut', 'TIME', false, null, '00:00:00');
|
||||
$this->addColumn('CUE_IN', 'DbCueIn', 'VARCHAR', false, null, '00:00:00');
|
||||
$this->addColumn('CUE_OUT', 'DbCueOut', 'VARCHAR', false, null, '00:00:00');
|
||||
$this->addColumn('MEDIA_ITEM_PLAYED', 'DbMediaItemPlayed', 'BOOLEAN', false, null, false);
|
||||
$this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', true, null, null);
|
||||
$this->addColumn('PLAYOUT_STATUS', 'DbPlayoutStatus', 'SMALLINT', true, null, 1);
|
||||
$this->addColumn('FADE_IN', 'DbFadeIn', 'VARCHAR', false, null, '00:00:00');
|
||||
$this->addColumn('FADE_OUT', 'DbFadeOut', 'VARCHAR', false, null, '00:00:00');
|
||||
// validators
|
||||
} // initialize()
|
||||
|
||||
|
@ -58,8 +59,12 @@ class CcScheduleTableMap extends TableMap {
|
|||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('CcShow', 'CcShow', RelationMap::MANY_TO_ONE, array('show_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::MANY_TO_ONE, array('instance_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcWebstream', 'CcWebstream', RelationMap::MANY_TO_ONE, array('stream_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcBlock', 'CcBlock', RelationMap::MANY_TO_ONE, array('block_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::MANY_TO_ONE, array('playlist_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // CcScheduleTableMap
|
||||
} // CcShowStampTableMap
|
|
@ -49,6 +49,8 @@ class CcShowTableMap extends TableMap {
|
|||
$this->addColumn('LIVE_STREAM_USING_CUSTOM_AUTH', 'DbLiveStreamUsingCustomAuth', 'BOOLEAN', false, null, false);
|
||||
$this->addColumn('LIVE_STREAM_USER', 'DbLiveStreamUser', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('LIVE_STREAM_PASS', 'DbLiveStreamPass', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('LINKED', 'DbLinked', 'BOOLEAN', true, null, false);
|
||||
$this->addColumn('IS_LINKABLE', 'DbIsLinkable', 'BOOLEAN', true, null, true);
|
||||
// validators
|
||||
} // initialize()
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'cc_playlistcontents' table.
|
||||
* This class defines the structure of the 'cc_stamp_contents' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
|
@ -14,12 +14,12 @@
|
|||
*
|
||||
* @package propel.generator.airtime.map
|
||||
*/
|
||||
class CcPlaylistcontentsTableMap extends TableMap {
|
||||
class CcStampContentsTableMap extends TableMap {
|
||||
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'airtime.map.CcPlaylistcontentsTableMap';
|
||||
const CLASS_NAME = 'airtime.map.CcStampContentsTableMap';
|
||||
|
||||
/**
|
||||
* Initialize the table attributes, columns and validators
|
||||
|
@ -31,22 +31,25 @@ class CcPlaylistcontentsTableMap extends TableMap {
|
|||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('cc_playlistcontents');
|
||||
$this->setPhpName('CcPlaylistcontents');
|
||||
$this->setClassname('CcPlaylistcontents');
|
||||
$this->setName('cc_stamp_contents');
|
||||
$this->setPhpName('CcStampContents');
|
||||
$this->setClassname('CcStampContents');
|
||||
$this->setPackage('airtime');
|
||||
$this->setUseIdGenerator(true);
|
||||
$this->setPrimaryKeyMethodInfo('cc_playlistcontents_id_seq');
|
||||
$this->setPrimaryKeyMethodInfo('cc_stamp_contents_id_seq');
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', 'cc_playlist', 'ID', false, null, null);
|
||||
$this->addForeignKey('STAMP_ID', 'DbStampId', 'INTEGER', 'cc_stamp', 'ID', true, null, null);
|
||||
$this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
|
||||
$this->addForeignKey('STREAM_ID', 'DbStreamId', 'INTEGER', 'cc_webstream', 'ID', false, null, null);
|
||||
$this->addForeignKey('BLOCK_ID', 'DbBlockId', 'INTEGER', 'cc_block', 'ID', false, null, null);
|
||||
$this->addForeignKey('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', 'cc_playlist', 'ID', false, null, null);
|
||||
$this->addColumn('POSITION', 'DbPosition', 'INTEGER', false, null, null);
|
||||
$this->addColumn('CLIPLENGTH', 'DbCliplength', 'TIME', false, null, '00:00:00');
|
||||
$this->addColumn('CUEIN', 'DbCuein', 'TIME', false, null, '00:00:00');
|
||||
$this->addColumn('CUEOUT', 'DbCueout', 'TIME', false, null, '00:00:00');
|
||||
$this->addColumn('FADEIN', 'DbFadein', 'TIME', false, null, '00:00:00');
|
||||
$this->addColumn('FADEOUT', 'DbFadeout', 'TIME', false, null, '00:00:00');
|
||||
$this->addColumn('CLIP_LENGTH', 'DbClipLength', 'VARCHAR', false, null, '00:00:00');
|
||||
$this->addColumn('CUE_IN', 'DbCueIn', 'VARCHAR', false, null, '00:00:00');
|
||||
$this->addColumn('CUE_OUT', 'DbCueOut', 'VARCHAR', false, null, '00:00:00');
|
||||
$this->addColumn('FADE_IN', 'DbFadeIn', 'VARCHAR', false, null, '00:00:00');
|
||||
$this->addColumn('FADE_OUT', 'DbFadeOut', 'VARCHAR', false, null, '00:00:00');
|
||||
// validators
|
||||
} // initialize()
|
||||
|
||||
|
@ -55,8 +58,11 @@ class CcPlaylistcontentsTableMap extends TableMap {
|
|||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('CcStamp', 'CcStamp', RelationMap::MANY_TO_ONE, array('stamp_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcWebstream', 'CcWebstream', RelationMap::MANY_TO_ONE, array('stream_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcBlock', 'CcBlock', RelationMap::MANY_TO_ONE, array('block_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::MANY_TO_ONE, array('playlist_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // CcPlaylistcontentsTableMap
|
||||
} // CcStampContentsTableMap
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'cc_show_rebroadcast' table.
|
||||
* This class defines the structure of the 'cc_stamp' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
|
@ -14,12 +14,12 @@
|
|||
*
|
||||
* @package propel.generator.airtime.map
|
||||
*/
|
||||
class CcShowRebroadcastTableMap extends TableMap {
|
||||
class CcStampTableMap extends TableMap {
|
||||
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'airtime.map.CcShowRebroadcastTableMap';
|
||||
const CLASS_NAME = 'airtime.map.CcStampTableMap';
|
||||
|
||||
/**
|
||||
* Initialize the table attributes, columns and validators
|
||||
|
@ -31,17 +31,17 @@ class CcShowRebroadcastTableMap extends TableMap {
|
|||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('cc_show_rebroadcast');
|
||||
$this->setPhpName('CcShowRebroadcast');
|
||||
$this->setClassname('CcShowRebroadcast');
|
||||
$this->setName('cc_stamp');
|
||||
$this->setPhpName('CcStamp');
|
||||
$this->setClassname('CcStamp');
|
||||
$this->setPackage('airtime');
|
||||
$this->setUseIdGenerator(true);
|
||||
$this->setPrimaryKeyMethodInfo('cc_show_rebroadcast_id_seq');
|
||||
$this->setPrimaryKeyMethodInfo('cc_stamp_id_seq');
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
|
||||
$this->addColumn('DAY_OFFSET', 'DbDayOffset', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('START_TIME', 'DbStartTime', 'TIME', true, null, null);
|
||||
$this->addForeignKey('SHOW_ID', 'DbShowId', 'INTEGER', 'cc_show', 'ID', true, null, null);
|
||||
$this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', false, null, null);
|
||||
$this->addColumn('LINKED', 'DbLinked', 'BOOLEAN', true, null, null);
|
||||
// validators
|
||||
} // initialize()
|
||||
|
||||
|
@ -51,6 +51,8 @@ class CcShowRebroadcastTableMap extends TableMap {
|
|||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('CcShow', 'CcShow', RelationMap::MANY_TO_ONE, array('show_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::MANY_TO_ONE, array('instance_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcStampContents', 'CcStampContents', RelationMap::ONE_TO_MANY, array('id' => 'stamp_id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // CcShowRebroadcastTableMap
|
||||
} // CcStampTableMap
|
|
@ -114,6 +114,13 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
*/
|
||||
protected $broadcasted;
|
||||
|
||||
/**
|
||||
* The value for the position field.
|
||||
* Note: this column has a database default value of: 0
|
||||
* @var int
|
||||
*/
|
||||
protected $position;
|
||||
|
||||
/**
|
||||
* @var CcShowInstances
|
||||
*/
|
||||
|
@ -162,6 +169,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
$this->media_item_played = false;
|
||||
$this->playout_status = 1;
|
||||
$this->broadcasted = 0;
|
||||
$this->position = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -406,6 +414,16 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
return $this->broadcasted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [position] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDbPosition()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of [id] column.
|
||||
*
|
||||
|
@ -816,6 +834,26 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
return $this;
|
||||
} // setDbBroadcasted()
|
||||
|
||||
/**
|
||||
* Set the value of [position] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return CcSchedule The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbPosition($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->position !== $v || $this->isNew()) {
|
||||
$this->position = $v;
|
||||
$this->modifiedColumns[] = CcSchedulePeer::POSITION;
|
||||
}
|
||||
|
||||
return $this;
|
||||
} // setDbPosition()
|
||||
|
||||
/**
|
||||
* Indicates whether the columns in this object are only set to default values.
|
||||
*
|
||||
|
@ -850,6 +888,10 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($this->position !== 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// otherwise, everything was equal, so return TRUE
|
||||
return true;
|
||||
} // hasOnlyDefaultValues()
|
||||
|
@ -886,6 +928,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
$this->instance_id = ($row[$startcol + 11] !== null) ? (int) $row[$startcol + 11] : null;
|
||||
$this->playout_status = ($row[$startcol + 12] !== null) ? (int) $row[$startcol + 12] : null;
|
||||
$this->broadcasted = ($row[$startcol + 13] !== null) ? (int) $row[$startcol + 13] : null;
|
||||
$this->position = ($row[$startcol + 14] !== null) ? (int) $row[$startcol + 14] : null;
|
||||
$this->resetModified();
|
||||
|
||||
$this->setNew(false);
|
||||
|
@ -894,7 +937,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 14; // 14 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
return $startcol + 15; // 15 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating CcSchedule object", $e);
|
||||
|
@ -1315,6 +1358,9 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
case 13:
|
||||
return $this->getDbBroadcasted();
|
||||
break;
|
||||
case 14:
|
||||
return $this->getDbPosition();
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
break;
|
||||
|
@ -1353,6 +1399,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
$keys[11] => $this->getDbInstanceId(),
|
||||
$keys[12] => $this->getDbPlayoutStatus(),
|
||||
$keys[13] => $this->getDbBroadcasted(),
|
||||
$keys[14] => $this->getDbPosition(),
|
||||
);
|
||||
if ($includeForeignObjects) {
|
||||
if (null !== $this->aCcShowInstances) {
|
||||
|
@ -1437,6 +1484,9 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
case 13:
|
||||
$this->setDbBroadcasted($value);
|
||||
break;
|
||||
case 14:
|
||||
$this->setDbPosition($value);
|
||||
break;
|
||||
} // switch()
|
||||
}
|
||||
|
||||
|
@ -1475,6 +1525,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
if (array_key_exists($keys[11], $arr)) $this->setDbInstanceId($arr[$keys[11]]);
|
||||
if (array_key_exists($keys[12], $arr)) $this->setDbPlayoutStatus($arr[$keys[12]]);
|
||||
if (array_key_exists($keys[13], $arr)) $this->setDbBroadcasted($arr[$keys[13]]);
|
||||
if (array_key_exists($keys[14], $arr)) $this->setDbPosition($arr[$keys[14]]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1500,6 +1551,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
if ($this->isColumnModified(CcSchedulePeer::INSTANCE_ID)) $criteria->add(CcSchedulePeer::INSTANCE_ID, $this->instance_id);
|
||||
if ($this->isColumnModified(CcSchedulePeer::PLAYOUT_STATUS)) $criteria->add(CcSchedulePeer::PLAYOUT_STATUS, $this->playout_status);
|
||||
if ($this->isColumnModified(CcSchedulePeer::BROADCASTED)) $criteria->add(CcSchedulePeer::BROADCASTED, $this->broadcasted);
|
||||
if ($this->isColumnModified(CcSchedulePeer::POSITION)) $criteria->add(CcSchedulePeer::POSITION, $this->position);
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
|
@ -1574,6 +1626,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
$copyObj->setDbInstanceId($this->instance_id);
|
||||
$copyObj->setDbPlayoutStatus($this->playout_status);
|
||||
$copyObj->setDbBroadcasted($this->broadcasted);
|
||||
$copyObj->setDbPosition($this->position);
|
||||
|
||||
if ($deepCopy) {
|
||||
// important: temporarily setNew(false) because this affects the behavior of
|
||||
|
@ -1906,6 +1959,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
|||
$this->instance_id = null;
|
||||
$this->playout_status = null;
|
||||
$this->broadcasted = null;
|
||||
$this->position = null;
|
||||
$this->alreadyInSave = false;
|
||||
$this->alreadyInValidation = false;
|
||||
$this->clearAllReferences();
|
||||
|
|
|
@ -26,7 +26,7 @@ abstract class BaseCcSchedulePeer {
|
|||
const TM_CLASS = 'CcScheduleTableMap';
|
||||
|
||||
/** The total number of columns. */
|
||||
const NUM_COLUMNS = 14;
|
||||
const NUM_COLUMNS = 15;
|
||||
|
||||
/** The number of lazy-loaded columns. */
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
@ -73,6 +73,9 @@ abstract class BaseCcSchedulePeer {
|
|||
/** the column name for the BROADCASTED field */
|
||||
const BROADCASTED = 'cc_schedule.BROADCASTED';
|
||||
|
||||
/** the column name for the POSITION field */
|
||||
const POSITION = 'cc_schedule.POSITION';
|
||||
|
||||
/**
|
||||
* An identiy map to hold any loaded instances of CcSchedule objects.
|
||||
* This must be public so that other peer classes can access this when hydrating from JOIN
|
||||
|
@ -89,12 +92,12 @@ abstract class BaseCcSchedulePeer {
|
|||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
private static $fieldNames = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbFileId', 'DbStreamId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbMediaItemPlayed', 'DbInstanceId', 'DbPlayoutStatus', 'DbBroadcasted', ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbFileId', 'dbStreamId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbMediaItemPlayed', 'dbInstanceId', 'dbPlayoutStatus', 'dbBroadcasted', ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::FILE_ID, self::STREAM_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::MEDIA_ITEM_PLAYED, self::INSTANCE_ID, self::PLAYOUT_STATUS, self::BROADCASTED, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'FILE_ID', 'STREAM_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', 'PLAYOUT_STATUS', 'BROADCASTED', ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'file_id', 'stream_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'media_item_played', 'instance_id', 'playout_status', 'broadcasted', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbFileId', 'DbStreamId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbMediaItemPlayed', 'DbInstanceId', 'DbPlayoutStatus', 'DbBroadcasted', 'DbPosition', ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbFileId', 'dbStreamId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbMediaItemPlayed', 'dbInstanceId', 'dbPlayoutStatus', 'dbBroadcasted', 'dbPosition', ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::FILE_ID, self::STREAM_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::MEDIA_ITEM_PLAYED, self::INSTANCE_ID, self::PLAYOUT_STATUS, self::BROADCASTED, self::POSITION, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'FILE_ID', 'STREAM_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', 'PLAYOUT_STATUS', 'BROADCASTED', 'POSITION', ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'file_id', 'stream_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'media_item_played', 'instance_id', 'playout_status', 'broadcasted', 'position', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -104,12 +107,12 @@ abstract class BaseCcSchedulePeer {
|
|||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
private static $fieldKeys = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbFileId' => 3, 'DbStreamId' => 4, 'DbClipLength' => 5, 'DbFadeIn' => 6, 'DbFadeOut' => 7, 'DbCueIn' => 8, 'DbCueOut' => 9, 'DbMediaItemPlayed' => 10, 'DbInstanceId' => 11, 'DbPlayoutStatus' => 12, 'DbBroadcasted' => 13, ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbFileId' => 3, 'dbStreamId' => 4, 'dbClipLength' => 5, 'dbFadeIn' => 6, 'dbFadeOut' => 7, 'dbCueIn' => 8, 'dbCueOut' => 9, 'dbMediaItemPlayed' => 10, 'dbInstanceId' => 11, 'dbPlayoutStatus' => 12, 'dbBroadcasted' => 13, ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::FILE_ID => 3, self::STREAM_ID => 4, self::CLIP_LENGTH => 5, self::FADE_IN => 6, self::FADE_OUT => 7, self::CUE_IN => 8, self::CUE_OUT => 9, self::MEDIA_ITEM_PLAYED => 10, self::INSTANCE_ID => 11, self::PLAYOUT_STATUS => 12, self::BROADCASTED => 13, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'FILE_ID' => 3, 'STREAM_ID' => 4, 'CLIP_LENGTH' => 5, 'FADE_IN' => 6, 'FADE_OUT' => 7, 'CUE_IN' => 8, 'CUE_OUT' => 9, 'MEDIA_ITEM_PLAYED' => 10, 'INSTANCE_ID' => 11, 'PLAYOUT_STATUS' => 12, 'BROADCASTED' => 13, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'file_id' => 3, 'stream_id' => 4, 'clip_length' => 5, 'fade_in' => 6, 'fade_out' => 7, 'cue_in' => 8, 'cue_out' => 9, 'media_item_played' => 10, 'instance_id' => 11, 'playout_status' => 12, 'broadcasted' => 13, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbFileId' => 3, 'DbStreamId' => 4, 'DbClipLength' => 5, 'DbFadeIn' => 6, 'DbFadeOut' => 7, 'DbCueIn' => 8, 'DbCueOut' => 9, 'DbMediaItemPlayed' => 10, 'DbInstanceId' => 11, 'DbPlayoutStatus' => 12, 'DbBroadcasted' => 13, 'DbPosition' => 14, ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbFileId' => 3, 'dbStreamId' => 4, 'dbClipLength' => 5, 'dbFadeIn' => 6, 'dbFadeOut' => 7, 'dbCueIn' => 8, 'dbCueOut' => 9, 'dbMediaItemPlayed' => 10, 'dbInstanceId' => 11, 'dbPlayoutStatus' => 12, 'dbBroadcasted' => 13, 'dbPosition' => 14, ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::FILE_ID => 3, self::STREAM_ID => 4, self::CLIP_LENGTH => 5, self::FADE_IN => 6, self::FADE_OUT => 7, self::CUE_IN => 8, self::CUE_OUT => 9, self::MEDIA_ITEM_PLAYED => 10, self::INSTANCE_ID => 11, self::PLAYOUT_STATUS => 12, self::BROADCASTED => 13, self::POSITION => 14, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'FILE_ID' => 3, 'STREAM_ID' => 4, 'CLIP_LENGTH' => 5, 'FADE_IN' => 6, 'FADE_OUT' => 7, 'CUE_IN' => 8, 'CUE_OUT' => 9, 'MEDIA_ITEM_PLAYED' => 10, 'INSTANCE_ID' => 11, 'PLAYOUT_STATUS' => 12, 'BROADCASTED' => 13, 'POSITION' => 14, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'file_id' => 3, 'stream_id' => 4, 'clip_length' => 5, 'fade_in' => 6, 'fade_out' => 7, 'cue_in' => 8, 'cue_out' => 9, 'media_item_played' => 10, 'instance_id' => 11, 'playout_status' => 12, 'broadcasted' => 13, 'position' => 14, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -195,6 +198,7 @@ abstract class BaseCcSchedulePeer {
|
|||
$criteria->addSelectColumn(CcSchedulePeer::INSTANCE_ID);
|
||||
$criteria->addSelectColumn(CcSchedulePeer::PLAYOUT_STATUS);
|
||||
$criteria->addSelectColumn(CcSchedulePeer::BROADCASTED);
|
||||
$criteria->addSelectColumn(CcSchedulePeer::POSITION);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.STARTS');
|
||||
|
@ -210,6 +214,7 @@ abstract class BaseCcSchedulePeer {
|
|||
$criteria->addSelectColumn($alias . '.INSTANCE_ID');
|
||||
$criteria->addSelectColumn($alias . '.PLAYOUT_STATUS');
|
||||
$criteria->addSelectColumn($alias . '.BROADCASTED');
|
||||
$criteria->addSelectColumn($alias . '.POSITION');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* @method CcScheduleQuery orderByDbInstanceId($order = Criteria::ASC) Order by the instance_id column
|
||||
* @method CcScheduleQuery orderByDbPlayoutStatus($order = Criteria::ASC) Order by the playout_status column
|
||||
* @method CcScheduleQuery orderByDbBroadcasted($order = Criteria::ASC) Order by the broadcasted column
|
||||
* @method CcScheduleQuery orderByDbPosition($order = Criteria::ASC) Order by the position column
|
||||
*
|
||||
* @method CcScheduleQuery groupByDbId() Group by the id column
|
||||
* @method CcScheduleQuery groupByDbStarts() Group by the starts column
|
||||
|
@ -35,6 +36,7 @@
|
|||
* @method CcScheduleQuery groupByDbInstanceId() Group by the instance_id column
|
||||
* @method CcScheduleQuery groupByDbPlayoutStatus() Group by the playout_status column
|
||||
* @method CcScheduleQuery groupByDbBroadcasted() Group by the broadcasted column
|
||||
* @method CcScheduleQuery groupByDbPosition() Group by the position column
|
||||
*
|
||||
* @method CcScheduleQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method CcScheduleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
|
@ -73,6 +75,7 @@
|
|||
* @method CcSchedule findOneByDbInstanceId(int $instance_id) Return the first CcSchedule filtered by the instance_id column
|
||||
* @method CcSchedule findOneByDbPlayoutStatus(int $playout_status) Return the first CcSchedule filtered by the playout_status column
|
||||
* @method CcSchedule findOneByDbBroadcasted(int $broadcasted) Return the first CcSchedule filtered by the broadcasted column
|
||||
* @method CcSchedule findOneByDbPosition(int $position) Return the first CcSchedule filtered by the position column
|
||||
*
|
||||
* @method array findByDbId(int $id) Return CcSchedule objects filtered by the id column
|
||||
* @method array findByDbStarts(string $starts) Return CcSchedule objects filtered by the starts column
|
||||
|
@ -88,6 +91,7 @@
|
|||
* @method array findByDbInstanceId(int $instance_id) Return CcSchedule objects filtered by the instance_id column
|
||||
* @method array findByDbPlayoutStatus(int $playout_status) Return CcSchedule objects filtered by the playout_status column
|
||||
* @method array findByDbBroadcasted(int $broadcasted) Return CcSchedule objects filtered by the broadcasted column
|
||||
* @method array findByDbPosition(int $position) Return CcSchedule objects filtered by the position column
|
||||
*
|
||||
* @package propel.generator.airtime.om
|
||||
*/
|
||||
|
@ -576,6 +580,37 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
|
|||
return $this->addUsingAlias(CcSchedulePeer::BROADCASTED, $dbBroadcasted, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the position column
|
||||
*
|
||||
* @param int|array $dbPosition The value to use as filter.
|
||||
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return CcScheduleQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDbPosition($dbPosition = null, $comparison = null)
|
||||
{
|
||||
if (is_array($dbPosition)) {
|
||||
$useMinMax = false;
|
||||
if (isset($dbPosition['min'])) {
|
||||
$this->addUsingAlias(CcSchedulePeer::POSITION, $dbPosition['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($dbPosition['max'])) {
|
||||
$this->addUsingAlias(CcSchedulePeer::POSITION, $dbPosition['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
return $this->addUsingAlias(CcSchedulePeer::POSITION, $dbPosition, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related CcShowInstances object
|
||||
*
|
||||
|
|
|
@ -95,6 +95,20 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
|||
*/
|
||||
protected $live_stream_pass;
|
||||
|
||||
/**
|
||||
* The value for the linked field.
|
||||
* Note: this column has a database default value of: false
|
||||
* @var boolean
|
||||
*/
|
||||
protected $linked;
|
||||
|
||||
/**
|
||||
* The value for the is_linkable field.
|
||||
* Note: this column has a database default value of: true
|
||||
* @var boolean
|
||||
*/
|
||||
protected $is_linkable;
|
||||
|
||||
/**
|
||||
* @var array CcShowInstances[] Collection to store aggregation of CcShowInstances objects.
|
||||
*/
|
||||
|
@ -142,6 +156,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
|||
$this->genre = '';
|
||||
$this->live_stream_using_airtime_auth = false;
|
||||
$this->live_stream_using_custom_auth = false;
|
||||
$this->linked = false;
|
||||
$this->is_linkable = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -264,6 +280,26 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
|||
return $this->live_stream_pass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [linked] column value.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getDbLinked()
|
||||
{
|
||||
return $this->linked;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [is_linkable] column value.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getDbIsLinkable()
|
||||
{
|
||||
return $this->is_linkable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of [id] column.
|
||||
*
|
||||
|
@ -484,6 +520,46 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
|||
return $this;
|
||||
} // setDbLiveStreamPass()
|
||||
|
||||
/**
|
||||
* Set the value of [linked] column.
|
||||
*
|
||||
* @param boolean $v new value
|
||||
* @return CcShow The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbLinked($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (boolean) $v;
|
||||
}
|
||||
|
||||
if ($this->linked !== $v || $this->isNew()) {
|
||||
$this->linked = $v;
|
||||
$this->modifiedColumns[] = CcShowPeer::LINKED;
|
||||
}
|
||||
|
||||
return $this;
|
||||
} // setDbLinked()
|
||||
|
||||
/**
|
||||
* Set the value of [is_linkable] column.
|
||||
*
|
||||
* @param boolean $v new value
|
||||
* @return CcShow The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbIsLinkable($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (boolean) $v;
|
||||
}
|
||||
|
||||
if ($this->is_linkable !== $v || $this->isNew()) {
|
||||
$this->is_linkable = $v;
|
||||
$this->modifiedColumns[] = CcShowPeer::IS_LINKABLE;
|
||||
}
|
||||
|
||||
return $this;
|
||||
} // setDbIsLinkable()
|
||||
|
||||
/**
|
||||
* Indicates whether the columns in this object are only set to default values.
|
||||
*
|
||||
|
@ -514,6 +590,14 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($this->linked !== false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->is_linkable !== true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// otherwise, everything was equal, so return TRUE
|
||||
return true;
|
||||
} // hasOnlyDefaultValues()
|
||||
|
@ -547,6 +631,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
|||
$this->live_stream_using_custom_auth = ($row[$startcol + 8] !== null) ? (boolean) $row[$startcol + 8] : null;
|
||||
$this->live_stream_user = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
|
||||
$this->live_stream_pass = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
|
||||
$this->linked = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null;
|
||||
$this->is_linkable = ($row[$startcol + 12] !== null) ? (boolean) $row[$startcol + 12] : null;
|
||||
$this->resetModified();
|
||||
|
||||
$this->setNew(false);
|
||||
|
@ -555,7 +641,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
|||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 11; // 11 = CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
return $startcol + 13; // 13 = CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating CcShow object", $e);
|
||||
|
@ -959,6 +1045,12 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
|||
case 10:
|
||||
return $this->getDbLiveStreamPass();
|
||||
break;
|
||||
case 11:
|
||||
return $this->getDbLinked();
|
||||
break;
|
||||
case 12:
|
||||
return $this->getDbIsLinkable();
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
break;
|
||||
|
@ -993,6 +1085,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
|||
$keys[8] => $this->getDbLiveStreamUsingCustomAuth(),
|
||||
$keys[9] => $this->getDbLiveStreamUser(),
|
||||
$keys[10] => $this->getDbLiveStreamPass(),
|
||||
$keys[11] => $this->getDbLinked(),
|
||||
$keys[12] => $this->getDbIsLinkable(),
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
|
@ -1057,6 +1151,12 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
|||
case 10:
|
||||
$this->setDbLiveStreamPass($value);
|
||||
break;
|
||||
case 11:
|
||||
$this->setDbLinked($value);
|
||||
break;
|
||||
case 12:
|
||||
$this->setDbIsLinkable($value);
|
||||
break;
|
||||
} // switch()
|
||||
}
|
||||
|
||||
|
@ -1092,6 +1192,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
|||
if (array_key_exists($keys[8], $arr)) $this->setDbLiveStreamUsingCustomAuth($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setDbLiveStreamUser($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setDbLiveStreamPass($arr[$keys[10]]);
|
||||
if (array_key_exists($keys[11], $arr)) $this->setDbLinked($arr[$keys[11]]);
|
||||
if (array_key_exists($keys[12], $arr)) $this->setDbIsLinkable($arr[$keys[12]]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1114,6 +1216,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
|||
if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH)) $criteria->add(CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH, $this->live_stream_using_custom_auth);
|
||||
if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_USER)) $criteria->add(CcShowPeer::LIVE_STREAM_USER, $this->live_stream_user);
|
||||
if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_PASS)) $criteria->add(CcShowPeer::LIVE_STREAM_PASS, $this->live_stream_pass);
|
||||
if ($this->isColumnModified(CcShowPeer::LINKED)) $criteria->add(CcShowPeer::LINKED, $this->linked);
|
||||
if ($this->isColumnModified(CcShowPeer::IS_LINKABLE)) $criteria->add(CcShowPeer::IS_LINKABLE, $this->is_linkable);
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
|
@ -1185,6 +1289,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
|||
$copyObj->setDbLiveStreamUsingCustomAuth($this->live_stream_using_custom_auth);
|
||||
$copyObj->setDbLiveStreamUser($this->live_stream_user);
|
||||
$copyObj->setDbLiveStreamPass($this->live_stream_pass);
|
||||
$copyObj->setDbLinked($this->linked);
|
||||
$copyObj->setDbIsLinkable($this->is_linkable);
|
||||
|
||||
if ($deepCopy) {
|
||||
// important: temporarily setNew(false) because this affects the behavior of
|
||||
|
@ -1787,6 +1893,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
|||
$this->live_stream_using_custom_auth = null;
|
||||
$this->live_stream_user = null;
|
||||
$this->live_stream_pass = null;
|
||||
$this->linked = null;
|
||||
$this->is_linkable = null;
|
||||
$this->alreadyInSave = false;
|
||||
$this->alreadyInValidation = false;
|
||||
$this->clearAllReferences();
|
||||
|
|
|
@ -26,7 +26,7 @@ abstract class BaseCcShowPeer {
|
|||
const TM_CLASS = 'CcShowTableMap';
|
||||
|
||||
/** The total number of columns. */
|
||||
const NUM_COLUMNS = 11;
|
||||
const NUM_COLUMNS = 13;
|
||||
|
||||
/** The number of lazy-loaded columns. */
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
@ -64,6 +64,12 @@ abstract class BaseCcShowPeer {
|
|||
/** the column name for the LIVE_STREAM_PASS field */
|
||||
const LIVE_STREAM_PASS = 'cc_show.LIVE_STREAM_PASS';
|
||||
|
||||
/** the column name for the LINKED field */
|
||||
const LINKED = 'cc_show.LINKED';
|
||||
|
||||
/** the column name for the IS_LINKABLE field */
|
||||
const IS_LINKABLE = 'cc_show.IS_LINKABLE';
|
||||
|
||||
/**
|
||||
* An identiy map to hold any loaded instances of CcShow objects.
|
||||
* This must be public so that other peer classes can access this when hydrating from JOIN
|
||||
|
@ -80,12 +86,12 @@ abstract class BaseCcShowPeer {
|
|||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
private static $fieldNames = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbUrl', 'DbGenre', 'DbDescription', 'DbColor', 'DbBackgroundColor', 'DbLiveStreamUsingAirtimeAuth', 'DbLiveStreamUsingCustomAuth', 'DbLiveStreamUser', 'DbLiveStreamPass', ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbUrl', 'dbGenre', 'dbDescription', 'dbColor', 'dbBackgroundColor', 'dbLiveStreamUsingAirtimeAuth', 'dbLiveStreamUsingCustomAuth', 'dbLiveStreamUser', 'dbLiveStreamPass', ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::URL, self::GENRE, self::DESCRIPTION, self::COLOR, self::BACKGROUND_COLOR, self::LIVE_STREAM_USING_AIRTIME_AUTH, self::LIVE_STREAM_USING_CUSTOM_AUTH, self::LIVE_STREAM_USER, self::LIVE_STREAM_PASS, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'URL', 'GENRE', 'DESCRIPTION', 'COLOR', 'BACKGROUND_COLOR', 'LIVE_STREAM_USING_AIRTIME_AUTH', 'LIVE_STREAM_USING_CUSTOM_AUTH', 'LIVE_STREAM_USER', 'LIVE_STREAM_PASS', ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'url', 'genre', 'description', 'color', 'background_color', 'live_stream_using_airtime_auth', 'live_stream_using_custom_auth', 'live_stream_user', 'live_stream_pass', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbUrl', 'DbGenre', 'DbDescription', 'DbColor', 'DbBackgroundColor', 'DbLiveStreamUsingAirtimeAuth', 'DbLiveStreamUsingCustomAuth', 'DbLiveStreamUser', 'DbLiveStreamPass', 'DbLinked', 'DbIsLinkable', ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbUrl', 'dbGenre', 'dbDescription', 'dbColor', 'dbBackgroundColor', 'dbLiveStreamUsingAirtimeAuth', 'dbLiveStreamUsingCustomAuth', 'dbLiveStreamUser', 'dbLiveStreamPass', 'dbLinked', 'dbIsLinkable', ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::URL, self::GENRE, self::DESCRIPTION, self::COLOR, self::BACKGROUND_COLOR, self::LIVE_STREAM_USING_AIRTIME_AUTH, self::LIVE_STREAM_USING_CUSTOM_AUTH, self::LIVE_STREAM_USER, self::LIVE_STREAM_PASS, self::LINKED, self::IS_LINKABLE, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'URL', 'GENRE', 'DESCRIPTION', 'COLOR', 'BACKGROUND_COLOR', 'LIVE_STREAM_USING_AIRTIME_AUTH', 'LIVE_STREAM_USING_CUSTOM_AUTH', 'LIVE_STREAM_USER', 'LIVE_STREAM_PASS', 'LINKED', 'IS_LINKABLE', ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'url', 'genre', 'description', 'color', 'background_color', 'live_stream_using_airtime_auth', 'live_stream_using_custom_auth', 'live_stream_user', 'live_stream_pass', 'linked', 'is_linkable', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -95,12 +101,12 @@ abstract class BaseCcShowPeer {
|
|||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
private static $fieldKeys = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbUrl' => 2, 'DbGenre' => 3, 'DbDescription' => 4, 'DbColor' => 5, 'DbBackgroundColor' => 6, 'DbLiveStreamUsingAirtimeAuth' => 7, 'DbLiveStreamUsingCustomAuth' => 8, 'DbLiveStreamUser' => 9, 'DbLiveStreamPass' => 10, ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbUrl' => 2, 'dbGenre' => 3, 'dbDescription' => 4, 'dbColor' => 5, 'dbBackgroundColor' => 6, 'dbLiveStreamUsingAirtimeAuth' => 7, 'dbLiveStreamUsingCustomAuth' => 8, 'dbLiveStreamUser' => 9, 'dbLiveStreamPass' => 10, ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::URL => 2, self::GENRE => 3, self::DESCRIPTION => 4, self::COLOR => 5, self::BACKGROUND_COLOR => 6, self::LIVE_STREAM_USING_AIRTIME_AUTH => 7, self::LIVE_STREAM_USING_CUSTOM_AUTH => 8, self::LIVE_STREAM_USER => 9, self::LIVE_STREAM_PASS => 10, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'URL' => 2, 'GENRE' => 3, 'DESCRIPTION' => 4, 'COLOR' => 5, 'BACKGROUND_COLOR' => 6, 'LIVE_STREAM_USING_AIRTIME_AUTH' => 7, 'LIVE_STREAM_USING_CUSTOM_AUTH' => 8, 'LIVE_STREAM_USER' => 9, 'LIVE_STREAM_PASS' => 10, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'url' => 2, 'genre' => 3, 'description' => 4, 'color' => 5, 'background_color' => 6, 'live_stream_using_airtime_auth' => 7, 'live_stream_using_custom_auth' => 8, 'live_stream_user' => 9, 'live_stream_pass' => 10, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbUrl' => 2, 'DbGenre' => 3, 'DbDescription' => 4, 'DbColor' => 5, 'DbBackgroundColor' => 6, 'DbLiveStreamUsingAirtimeAuth' => 7, 'DbLiveStreamUsingCustomAuth' => 8, 'DbLiveStreamUser' => 9, 'DbLiveStreamPass' => 10, 'DbLinked' => 11, 'DbIsLinkable' => 12, ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbUrl' => 2, 'dbGenre' => 3, 'dbDescription' => 4, 'dbColor' => 5, 'dbBackgroundColor' => 6, 'dbLiveStreamUsingAirtimeAuth' => 7, 'dbLiveStreamUsingCustomAuth' => 8, 'dbLiveStreamUser' => 9, 'dbLiveStreamPass' => 10, 'dbLinked' => 11, 'dbIsLinkable' => 12, ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::URL => 2, self::GENRE => 3, self::DESCRIPTION => 4, self::COLOR => 5, self::BACKGROUND_COLOR => 6, self::LIVE_STREAM_USING_AIRTIME_AUTH => 7, self::LIVE_STREAM_USING_CUSTOM_AUTH => 8, self::LIVE_STREAM_USER => 9, self::LIVE_STREAM_PASS => 10, self::LINKED => 11, self::IS_LINKABLE => 12, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'URL' => 2, 'GENRE' => 3, 'DESCRIPTION' => 4, 'COLOR' => 5, 'BACKGROUND_COLOR' => 6, 'LIVE_STREAM_USING_AIRTIME_AUTH' => 7, 'LIVE_STREAM_USING_CUSTOM_AUTH' => 8, 'LIVE_STREAM_USER' => 9, 'LIVE_STREAM_PASS' => 10, 'LINKED' => 11, 'IS_LINKABLE' => 12, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'url' => 2, 'genre' => 3, 'description' => 4, 'color' => 5, 'background_color' => 6, 'live_stream_using_airtime_auth' => 7, 'live_stream_using_custom_auth' => 8, 'live_stream_user' => 9, 'live_stream_pass' => 10, 'linked' => 11, 'is_linkable' => 12, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -183,6 +189,8 @@ abstract class BaseCcShowPeer {
|
|||
$criteria->addSelectColumn(CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH);
|
||||
$criteria->addSelectColumn(CcShowPeer::LIVE_STREAM_USER);
|
||||
$criteria->addSelectColumn(CcShowPeer::LIVE_STREAM_PASS);
|
||||
$criteria->addSelectColumn(CcShowPeer::LINKED);
|
||||
$criteria->addSelectColumn(CcShowPeer::IS_LINKABLE);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.NAME');
|
||||
|
@ -195,6 +203,8 @@ abstract class BaseCcShowPeer {
|
|||
$criteria->addSelectColumn($alias . '.LIVE_STREAM_USING_CUSTOM_AUTH');
|
||||
$criteria->addSelectColumn($alias . '.LIVE_STREAM_USER');
|
||||
$criteria->addSelectColumn($alias . '.LIVE_STREAM_PASS');
|
||||
$criteria->addSelectColumn($alias . '.LINKED');
|
||||
$criteria->addSelectColumn($alias . '.IS_LINKABLE');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
* @method CcShowQuery orderByDbLiveStreamUsingCustomAuth($order = Criteria::ASC) Order by the live_stream_using_custom_auth column
|
||||
* @method CcShowQuery orderByDbLiveStreamUser($order = Criteria::ASC) Order by the live_stream_user column
|
||||
* @method CcShowQuery orderByDbLiveStreamPass($order = Criteria::ASC) Order by the live_stream_pass column
|
||||
* @method CcShowQuery orderByDbLinked($order = Criteria::ASC) Order by the linked column
|
||||
* @method CcShowQuery orderByDbIsLinkable($order = Criteria::ASC) Order by the is_linkable column
|
||||
*
|
||||
* @method CcShowQuery groupByDbId() Group by the id column
|
||||
* @method CcShowQuery groupByDbName() Group by the name column
|
||||
|
@ -29,6 +31,8 @@
|
|||
* @method CcShowQuery groupByDbLiveStreamUsingCustomAuth() Group by the live_stream_using_custom_auth column
|
||||
* @method CcShowQuery groupByDbLiveStreamUser() Group by the live_stream_user column
|
||||
* @method CcShowQuery groupByDbLiveStreamPass() Group by the live_stream_pass column
|
||||
* @method CcShowQuery groupByDbLinked() Group by the linked column
|
||||
* @method CcShowQuery groupByDbIsLinkable() Group by the is_linkable column
|
||||
*
|
||||
* @method CcShowQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method CcShowQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
|
@ -64,6 +68,8 @@
|
|||
* @method CcShow findOneByDbLiveStreamUsingCustomAuth(boolean $live_stream_using_custom_auth) Return the first CcShow filtered by the live_stream_using_custom_auth column
|
||||
* @method CcShow findOneByDbLiveStreamUser(string $live_stream_user) Return the first CcShow filtered by the live_stream_user column
|
||||
* @method CcShow findOneByDbLiveStreamPass(string $live_stream_pass) Return the first CcShow filtered by the live_stream_pass column
|
||||
* @method CcShow findOneByDbLinked(boolean $linked) Return the first CcShow filtered by the linked column
|
||||
* @method CcShow findOneByDbIsLinkable(boolean $is_linkable) Return the first CcShow filtered by the is_linkable column
|
||||
*
|
||||
* @method array findByDbId(int $id) Return CcShow objects filtered by the id column
|
||||
* @method array findByDbName(string $name) Return CcShow objects filtered by the name column
|
||||
|
@ -76,6 +82,8 @@
|
|||
* @method array findByDbLiveStreamUsingCustomAuth(boolean $live_stream_using_custom_auth) Return CcShow objects filtered by the live_stream_using_custom_auth column
|
||||
* @method array findByDbLiveStreamUser(string $live_stream_user) Return CcShow objects filtered by the live_stream_user column
|
||||
* @method array findByDbLiveStreamPass(string $live_stream_pass) Return CcShow objects filtered by the live_stream_pass column
|
||||
* @method array findByDbLinked(boolean $linked) Return CcShow objects filtered by the linked column
|
||||
* @method array findByDbIsLinkable(boolean $is_linkable) Return CcShow objects filtered by the is_linkable column
|
||||
*
|
||||
* @package propel.generator.airtime.om
|
||||
*/
|
||||
|
@ -412,6 +420,40 @@ abstract class BaseCcShowQuery extends ModelCriteria
|
|||
return $this->addUsingAlias(CcShowPeer::LIVE_STREAM_PASS, $dbLiveStreamPass, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the linked column
|
||||
*
|
||||
* @param boolean|string $dbLinked The value to use as filter.
|
||||
* Accepts strings ('false', 'off', '-', 'no', 'n', and '0' are false, the rest is true)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return CcShowQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDbLinked($dbLinked = null, $comparison = null)
|
||||
{
|
||||
if (is_string($dbLinked)) {
|
||||
$linked = in_array(strtolower($dbLinked), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
|
||||
}
|
||||
return $this->addUsingAlias(CcShowPeer::LINKED, $dbLinked, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the is_linkable column
|
||||
*
|
||||
* @param boolean|string $dbIsLinkable The value to use as filter.
|
||||
* Accepts strings ('false', 'off', '-', 'no', 'n', and '0' are false, the rest is true)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return CcShowQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDbIsLinkable($dbIsLinkable = null, $comparison = null)
|
||||
{
|
||||
if (is_string($dbIsLinkable)) {
|
||||
$is_linkable = in_array(strtolower($dbIsLinkable), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
|
||||
}
|
||||
return $this->addUsingAlias(CcShowPeer::IS_LINKABLE, $dbIsLinkable, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related CcShowInstances object
|
||||
*
|
||||
|
|
|
@ -0,0 +1,326 @@
|
|||
<?php
|
||||
|
||||
class Application_Service_CalendarService
|
||||
{
|
||||
private $currentUser;
|
||||
private $ccShowInstance;
|
||||
private $ccShow;
|
||||
|
||||
public function __construct($instanceId = null)
|
||||
{
|
||||
if (!is_null($instanceId)) {
|
||||
$this->ccShowInstance = CcShowInstancesQuery::create()->findPk($instanceId);
|
||||
if (is_null($this->ccShowInstance)) {
|
||||
throw new Exception("Instance does not exist");
|
||||
}
|
||||
$this->ccShow = $this->ccShowInstance->getCcShow();
|
||||
}
|
||||
|
||||
$service_user = new Application_Service_UserService();
|
||||
$this->currentUser = $service_user->getCurrentUser();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
*/
|
||||
public function makeContextMenu()
|
||||
{
|
||||
$menu = array();
|
||||
$now = time();
|
||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||
$isAdminOrPM = $this->currentUser->isAdminOrPM();
|
||||
$isHostOfShow = $this->currentUser->isHostOfShow($this->ccShow->getDbId());
|
||||
|
||||
//DateTime objects in UTC
|
||||
$startDT = $this->ccShowInstance->getDbStarts(null);
|
||||
$endDT = $this->ccShowInstance->getDbEnds(null);
|
||||
|
||||
//timestamps
|
||||
$start = $startDT->getTimestamp();
|
||||
$end = $endDT->getTimestamp();
|
||||
|
||||
//show has ended
|
||||
if ($now > $end) {
|
||||
if ($this->ccShowInstance->isRecorded()) {
|
||||
|
||||
$ccFile = $this->ccShowInstance->getCcFiles();
|
||||
|
||||
$menu["view_recorded"] = array(
|
||||
"name" => _("View Recorded File Metadata"),
|
||||
"icon" => "overview",
|
||||
"url" => $baseUrl."library/edit-file-md/id/".$ccFile->getDbId());
|
||||
|
||||
//recorded show can be uploaded to soundcloud
|
||||
if (Application_Model_Preference::GetUploadToSoundcloudOption()) {
|
||||
$scid = $ccFile->getDbSoundcloudId();
|
||||
|
||||
if ($scid > 0) {
|
||||
$menu["soundcloud_view"] = array(
|
||||
"name" => _("View on Soundcloud"),
|
||||
"icon" => "soundcloud",
|
||||
"url" => $ccFile->getDbSoundcloudLinkToFile());
|
||||
}
|
||||
|
||||
$text = is_null($scid) ? _('Upload to SoundCloud') : _('Re-upload to SoundCloud');
|
||||
$menu["soundcloud_upload"] = array(
|
||||
"name"=> $text,
|
||||
"icon" => "soundcloud");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//Show content can be modified from the calendar if:
|
||||
// the show has not started,
|
||||
// the user is admin or hosting the show,
|
||||
// the show is not recorded or rebroadcasted
|
||||
if ($now < $start && ($isAdminOrPM || $isHostOfShow) &&
|
||||
!$this->ccShowInstance->isRecorded() && !$this->ccShowInstance->isRebroadcast()) {
|
||||
|
||||
$menu["schedule"] = array(
|
||||
"name"=> _("Add / Remove Content"),
|
||||
"icon" => "add-remove-content",
|
||||
"url" => $baseUrl."showbuilder/builder-dialog/");
|
||||
|
||||
$menu["clear"] = array(
|
||||
"name"=> _("Remove All Content"),
|
||||
"icon" => "remove-all-content",
|
||||
"url" => $baseUrl."schedule/clear-show");
|
||||
}
|
||||
|
||||
//"Show Content" should be a menu item at all times except when
|
||||
//the show is recorded
|
||||
if (!$this->ccShowInstance->isRecorded()) {
|
||||
|
||||
$menu["content"] = array(
|
||||
"name"=> _("Show Content"),
|
||||
"icon" => "overview",
|
||||
"url" => $baseUrl."schedule/show-content-dialog");
|
||||
}
|
||||
|
||||
//show is currently playing and user is admin
|
||||
if ($start <= $now && $now < $end && $isAdminOrPM) {
|
||||
|
||||
if ($this->ccShowInstance->isRecorded()) {
|
||||
$menu["cancel_recorded"] = array(
|
||||
"name"=> _("Cancel Current Show"),
|
||||
"icon" => "delete");
|
||||
} else {
|
||||
$menu["cancel"] = array(
|
||||
"name"=> _("Cancel Current Show"),
|
||||
"icon" => "delete");
|
||||
}
|
||||
}
|
||||
|
||||
$isRepeating = $this->ccShow->getFirstCcShowDay()->isRepeating();
|
||||
if (!$this->ccShowInstance->isRebroadcast()) {
|
||||
if ($isRepeating) {
|
||||
$menu["edit"] = array(
|
||||
"name" => _("Edit"),
|
||||
"icon" => "edit",
|
||||
"items" => array());
|
||||
|
||||
$menu["edit"]["items"]["all"] = array(
|
||||
"name" => _("Edit Show"),
|
||||
"icon" => "edit",
|
||||
"url" => $baseUrl."Schedule/populate-show-form");
|
||||
|
||||
$menu["edit"]["items"]["instance"] = array(
|
||||
"name" => _("Edit This Instance"),
|
||||
"icon" => "edit",
|
||||
"url" => $baseUrl."Schedule/populate-repeating-show-instance-form");
|
||||
} else {
|
||||
$menu["edit"] = array(
|
||||
"name"=> _("Edit Show"),
|
||||
"icon" => "edit",
|
||||
"_type"=>"all",
|
||||
"url" => $baseUrl."Schedule/populate-show-form");
|
||||
}
|
||||
}
|
||||
|
||||
//show hasn't started yet and user is admin
|
||||
if ($now < $start && $isAdminOrPM) {
|
||||
//show is repeating so give user the option to delete all
|
||||
//repeating instances or just the one
|
||||
if ($isRepeating) {
|
||||
$menu["del"] = array(
|
||||
"name"=> _("Delete"),
|
||||
"icon" => "delete",
|
||||
"items" => array());
|
||||
|
||||
$menu["del"]["items"]["single"] = array(
|
||||
"name"=> _("Delete This Instance"),
|
||||
"icon" => "delete",
|
||||
"url" => $baseUrl."schedule/delete-show-instance");
|
||||
|
||||
$menu["del"]["items"]["following"] = array(
|
||||
"name"=> _("Delete This Instance and All Following"),
|
||||
"icon" => "delete",
|
||||
"url" => $baseUrl."schedule/delete-show");
|
||||
} else {
|
||||
$menu["del"] = array(
|
||||
"name"=> _("Delete"),
|
||||
"icon" => "delete",
|
||||
"url" => $baseUrl."schedule/delete-show");
|
||||
}
|
||||
}
|
||||
}
|
||||
return $menu;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
* @param DateTime $dateTime object to add deltas to
|
||||
* @param int $deltaDay delta days show moved
|
||||
* @param int $deltaMin delta minutes show moved
|
||||
*/
|
||||
public static function addDeltas($dateTime, $deltaDay, $deltaMin)
|
||||
{
|
||||
$newDateTime = clone $dateTime;
|
||||
|
||||
$days = abs($deltaDay);
|
||||
$mins = abs($deltaMin);
|
||||
|
||||
$dayInterval = new DateInterval("P{$days}D");
|
||||
$minInterval = new DateInterval("PT{$mins}M");
|
||||
|
||||
if ($deltaDay > 0) {
|
||||
$newDateTime->add($dayInterval);
|
||||
} elseif ($deltaDay < 0) {
|
||||
$newDateTime->sub($dayInterval);
|
||||
}
|
||||
|
||||
if ($deltaMin > 0) {
|
||||
$newDateTime->add($minInterval);
|
||||
} elseif ($deltaMin < 0) {
|
||||
$newDateTime->sub($minInterval);
|
||||
}
|
||||
|
||||
return $newDateTime;
|
||||
}
|
||||
|
||||
private function validateShowMove($deltaDay, $deltaMin)
|
||||
{
|
||||
if (!$this->currentUser->isAdminOrPM()) {
|
||||
throw new Exception(_("Permission denied"));
|
||||
}
|
||||
|
||||
if ($this->ccShow->getFirstCcShowDay()->isRepeating()) {
|
||||
throw new Exception(_("Can't drag and drop repeating shows"));
|
||||
}
|
||||
|
||||
$today_timestamp = time();
|
||||
|
||||
$startsDateTime = new DateTime($this->ccShowInstance->getDbStarts(), new DateTimeZone("UTC"));
|
||||
$endsDateTime = new DateTime($this->ccShowInstance->getDbEnds(), new DateTimeZone("UTC"));
|
||||
|
||||
if ($today_timestamp > $startsDateTime->getTimestamp()) {
|
||||
throw new Exception(_("Can't move a past show"));
|
||||
}
|
||||
|
||||
//the user is moving the show on the calendar from the perspective of local time.
|
||||
//incase a show is moved across a time change border offsets should be added to the localtime
|
||||
//stamp and then converted back to UTC to avoid show time changes!
|
||||
$localTimezone = Application_Model_Preference::GetTimezone();
|
||||
$startsDateTime->setTimezone(new DateTimeZone($localTimezone));
|
||||
$endsDateTime->setTimezone(new DateTimeZone($localTimezone));
|
||||
|
||||
$newStartsDateTime = self::addDeltas($startsDateTime, $deltaDay, $deltaMin);
|
||||
$newEndsDateTime = self::addDeltas($endsDateTime, $deltaDay, $deltaMin);
|
||||
|
||||
//convert our new starts/ends to UTC.
|
||||
$newStartsDateTime->setTimezone(new DateTimeZone("UTC"));
|
||||
$newEndsDateTime->setTimezone(new DateTimeZone("UTC"));
|
||||
|
||||
if ($today_timestamp > $newStartsDateTime->getTimestamp()) {
|
||||
throw new Exception(_("Can't move show into past"));
|
||||
}
|
||||
|
||||
//check if show is overlapping
|
||||
$overlapping = Application_Model_Schedule::checkOverlappingShows(
|
||||
$newStartsDateTime, $newEndsDateTime, true, $this->ccShowInstance->getDbId());
|
||||
if ($overlapping) {
|
||||
throw new Exception(_("Cannot schedule overlapping shows"));
|
||||
}
|
||||
|
||||
if ($this->ccShow->isRecorded()) {
|
||||
//rebroadcasts should start at max 1 hour after a recorded show has ended.
|
||||
$minRebroadcastStart = self::addDeltas($newEndsDateTime, 0, 60);
|
||||
//check if we are moving a recorded show less than 1 hour before any of its own rebroadcasts.
|
||||
$rebroadcasts = CcShowInstancesQuery::create()
|
||||
->filterByDbOriginalShow($this->_instanceId)
|
||||
->filterByDbStarts($minRebroadcastStart->format('Y-m-d H:i:s'), Criteria::LESS_THAN)
|
||||
->find();
|
||||
|
||||
if (count($rebroadcasts) > 0) {
|
||||
throw new Exception(_("Can't move a recorded show less than 1 hour before its rebroadcasts."));
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->ccShow->isRebroadcast()) {
|
||||
$recordedShow = CcShowInstancesQuery::create()->findPk(
|
||||
$this->ccShowInstance->getDbOriginalShow());
|
||||
if (is_null($recordedShow)) {
|
||||
$this->ccShowInstance->delete();
|
||||
throw new Exception(_("Show was deleted because recorded show does not exist!"));
|
||||
}
|
||||
|
||||
$recordEndDateTime = new DateTime($recordedShow->getDbEnds(), new DateTimeZone("UTC"));
|
||||
$newRecordEndDateTime = self::addDeltas($recordEndDateTime, 0, 60);
|
||||
|
||||
if ($newStartsDateTime->getTimestamp() < $newRecordEndDateTime->getTimestamp()) {
|
||||
throw new Exception(_("Must wait 1 hour to rebroadcast."));
|
||||
}
|
||||
}
|
||||
return array($newStartsDateTime, $newEndsDateTime);
|
||||
}
|
||||
|
||||
public function moveShow($deltaDay, $deltaMin)
|
||||
{
|
||||
try {
|
||||
$con = Propel::getConnection();
|
||||
$con->beginTransaction();
|
||||
|
||||
list($newStartsDateTime, $newEndsDateTime) = $this->validateShowMove(
|
||||
$deltaDay, $deltaMin);
|
||||
|
||||
$this->ccShowInstance
|
||||
->setDbStarts($newStartsDateTime)
|
||||
->setDbEnds($newEndsDateTime)
|
||||
->save();
|
||||
|
||||
if (!$this->ccShowInstance->getCcShow()->isRebroadcast()) {
|
||||
//we can get the first show day because we know the show is
|
||||
//not repeating, and therefore will only have one show day entry
|
||||
$ccShowDay = $this->ccShow->getFirstCcShowDay();
|
||||
$ccShowDay
|
||||
->setDbFirstShow($newStartsDateTime)
|
||||
->setDbLastShow($newEndsDateTime)
|
||||
->save();
|
||||
}
|
||||
|
||||
Application_Service_SchedulerService::updateScheduleStartTime(
|
||||
array($this->ccShowInstance->getDbId()), null, $newStartsDateTime);
|
||||
|
||||
$con->commit();
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
public function resizeShow($deltaDay, $deltaMin)
|
||||
{
|
||||
try {
|
||||
$con = Propel::getConnection();
|
||||
$con->beginTransaction();
|
||||
|
||||
$con->commit();
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,243 @@
|
|||
<?php
|
||||
class Application_Service_SchedulerService
|
||||
{
|
||||
private $con;
|
||||
private $fileInfo = array(
|
||||
"id" => "",
|
||||
"cliplength" => "",
|
||||
"cuein" => "00:00:00",
|
||||
"cueout" => "00:00:00",
|
||||
"fadein" => "00:00:00",
|
||||
"fadeout" => "00:00:00",
|
||||
"sched_id" => null,
|
||||
"type" => 0 //default type of '0' to represent files. type '1' represents a webstream
|
||||
);
|
||||
|
||||
private $epochNow;
|
||||
private $nowDT;
|
||||
private $currentUser;
|
||||
private $checkUserPermissions = true;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
||||
|
||||
//subtracting one because sometimes when we cancel a track, we set its end time
|
||||
//to epochNow and then send the new schedule to pypo. Sometimes the currently cancelled
|
||||
//track can still be included in the new schedule because it may have a few ms left to play.
|
||||
//subtracting 1 second from epochNow resolves this issue.
|
||||
$this->epochNow = microtime(true)-1;
|
||||
$this->nowDT = DateTime::createFromFormat("U.u", $this->epochNow, new DateTimeZone("UTC"));
|
||||
|
||||
if ($this->nowDT === false) {
|
||||
// DateTime::createFromFormat does not support millisecond string formatting in PHP 5.3.2 (Ubuntu 10.04).
|
||||
// In PHP 5.3.3 (Ubuntu 10.10), this has been fixed.
|
||||
$this->nowDT = DateTime::createFromFormat("U", time(), new DateTimeZone("UTC"));
|
||||
}
|
||||
|
||||
$user_service = new Application_Service_UserService();
|
||||
$this->currentUser = $user_service->getCurrentUser();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
* @param array $instanceIds
|
||||
*/
|
||||
public static function updateScheduleStartTime($instanceIds, $diff=null, $newStart=null)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
if (count($instanceIds) > 0) {
|
||||
$showIdList = implode(",", $instanceIds);
|
||||
|
||||
if (is_null($diff)) {
|
||||
$ccSchedule = CcScheduleQuery::create()
|
||||
->filterByDbInstanceId($instanceIds, Criteria::IN)
|
||||
->orderByDbStarts()
|
||||
->limit(1)
|
||||
->findOne();
|
||||
|
||||
if (!is_null($ccSchedule)) {
|
||||
$scheduleStartsEpoch = strtotime($ccSchedule->getDbStarts());
|
||||
$showStartsEpoch = strtotime($newStart->format("Y-m-d H:i:s"));
|
||||
|
||||
$diff = $showStartsEpoch - $scheduleStartsEpoch;
|
||||
}
|
||||
}
|
||||
|
||||
$ccSchedules = CcScheduleQuery::create()
|
||||
->filterByDbInstanceId($instanceIds, Criteria::IN)
|
||||
->find();
|
||||
foreach ($ccSchedules as $ccSchedule) {
|
||||
$interval = new DateInterval("PT".$diff."S");
|
||||
$start = new DateTime($ccSchedule->getDbStarts());
|
||||
$newStart = $start->add($interval);
|
||||
$end = new DateTime($ccSchedule->getDbEnds());
|
||||
$newEnd = $end->add($interval);
|
||||
$ccSchedule
|
||||
->setDbStarts($newStart->format("Y-m-d H:i:s"))
|
||||
->setDbEnds($newEnd->format("Y-m-d H:i:s"))
|
||||
->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Removes any time gaps in shows
|
||||
*
|
||||
* @param array $schedIds schedule ids to exclude
|
||||
*/
|
||||
public function removeGaps($showId, $schedIds=null)
|
||||
{
|
||||
$ccShowInstances = CcShowInstancesQuery::create()->filterByDbShowId($showId)->find();
|
||||
|
||||
foreach ($ccShowInstances as $instance) {
|
||||
Logging::info("Removing gaps from show instance #".$instance->getDbId());
|
||||
//DateTime object
|
||||
$itemStart = $instance->getDbStarts(null);
|
||||
|
||||
$ccScheduleItems = CcScheduleQuery::create()
|
||||
->filterByDbInstanceId($instance->getDbId())
|
||||
->filterByDbId($schedIds, Criteria::NOT_IN)
|
||||
->orderByDbStarts()
|
||||
->find();
|
||||
|
||||
foreach ($ccScheduleItems as $ccSchedule) {
|
||||
//DateTime object
|
||||
$itemEnd = $this->findEndTime($itemStart, $ccSchedule->getDbClipLength());
|
||||
|
||||
$ccSchedule->setDbStarts($itemStart)
|
||||
->setDbEnds($itemEnd);
|
||||
|
||||
$itemStart = $itemEnd;
|
||||
}
|
||||
$ccScheduleItems->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
* @param DateTime $instanceStart
|
||||
* @param string $clipLength
|
||||
*/
|
||||
private static function findEndTime($instanceStart, $clipLength)
|
||||
{
|
||||
$startEpoch = $instanceStart->format("U.u");
|
||||
$durationSeconds = Application_Common_DateHelper::playlistTimeToSeconds($clipLength);
|
||||
|
||||
//add two float numbers to 6 subsecond precision
|
||||
//DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number.
|
||||
$endEpoch = bcadd($startEpoch , (string) $durationSeconds, 6);
|
||||
|
||||
$dt = DateTime::createFromFormat("U.u", $endEpoch, new DateTimeZone("UTC"));
|
||||
|
||||
if ($dt === false) {
|
||||
//PHP 5.3.2 problem
|
||||
$dt = DateTime::createFromFormat("U", intval($endEpoch), new DateTimeZone("UTC"));
|
||||
}
|
||||
|
||||
return $dt;
|
||||
}
|
||||
|
||||
public static function fillLinkedShows($ccShow)
|
||||
{
|
||||
if ($ccShow->isLinked()) {
|
||||
/* First check if any linked instances have content
|
||||
* If all instances are empty then we don't need to fill
|
||||
* any other instances with content
|
||||
*/
|
||||
$instanceIds = $ccShow->getInstanceIds();
|
||||
$ccSchedules = CcScheduleQuery::create()
|
||||
->filterByDbInstanceId($instanceIds, Criteria::IN)
|
||||
->find();
|
||||
if (!$ccSchedules->isEmpty()) {
|
||||
/* Find the show contents of just one of the instances. It doesn't
|
||||
* matter which instance we use since all the content is the same
|
||||
*/
|
||||
$ccSchedule = $ccSchedules->getFirst();
|
||||
$showStamp = CcScheduleQuery::create()
|
||||
->filterByDbInstanceId($ccSchedule->getDbInstanceId())
|
||||
->orderByDbStarts()
|
||||
->find();
|
||||
|
||||
//get time_filled so we can update cc_show_instances
|
||||
$timeFilled = $ccSchedule->getCcShowInstances()->getDbTimeFilled();
|
||||
|
||||
//need to find out which linked instances are empty
|
||||
foreach ($ccShow->getCcShowInstancess() as $ccShowInstance) {
|
||||
$ccSchedules = CcScheduleQuery::create()
|
||||
->filterByDbInstanceId($ccShowInstance->getDbId())
|
||||
->find();
|
||||
if ($ccSchedules->isEmpty()) {
|
||||
$nextStartDT = $ccShowInstance->getDbStarts(null);
|
||||
|
||||
foreach ($showStamp as $item) {
|
||||
$endTimeDT = self::findEndTime($nextStartDT, $item->getDbClipLength());
|
||||
|
||||
$ccSchedule = new CcSchedule();
|
||||
$ccSchedule
|
||||
->setDbStarts($nextStartDT)
|
||||
->setDbEnds($endTimeDT)
|
||||
->setDbFileId($item->getDbFileId())
|
||||
->setDbStreamId($item->getDbStreamId())
|
||||
->setDbClipLength($item->getDbClipLength())
|
||||
->setDbFadeIn($item->getDbFadeIn())
|
||||
->setDbFadeOut($item->getDbFadeOut())
|
||||
->setDbCuein($item->getDbCueIn())
|
||||
->setDbCueOut($item->getDbCueOut())
|
||||
->setDbInstanceId($ccShowInstance->getDbId())
|
||||
->setDbPosition($item->getDbPosition())
|
||||
->save();
|
||||
|
||||
$nextStartDT = $endTimeDT;
|
||||
} //foreach show item
|
||||
|
||||
//update time_filled in cc_show_instances
|
||||
$ccShowInstance
|
||||
->setDbTimeFilled($timeFilled)
|
||||
->setDbLastScheduled(gmdate("Y-m-d H:i:s"))
|
||||
->save();
|
||||
}
|
||||
} //foreach linked instance
|
||||
} //if at least one linked instance has content
|
||||
}
|
||||
}
|
||||
|
||||
public function emptyShowContent($instanceId)
|
||||
{
|
||||
try {
|
||||
$ccShowInstance = CcShowInstancesQuery::create()->findPk($instanceId);
|
||||
|
||||
$instances = 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 {
|
||||
$instances[] = $ccShowInstance;
|
||||
CcScheduleQuery::create()
|
||||
->filterByDbInstanceId($ccShowInstance->getDbId())
|
||||
->delete();
|
||||
}
|
||||
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
$con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME);
|
||||
foreach ($instances as $instance) {
|
||||
$instance->updateDbTimeFilled($con);
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
Logging::info($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,449 @@
|
|||
<?php
|
||||
class Application_Service_ShowFormService
|
||||
{
|
||||
private $ccShow;
|
||||
private $instanceId;
|
||||
|
||||
public function __construct($showId = null, $instanceId = null)
|
||||
{
|
||||
if (!is_null($showId)) {
|
||||
$this->ccShow = CcShowQuery::create()->findPk($showId);
|
||||
}
|
||||
$this->instanceId = $instanceId;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return array of show forms
|
||||
*/
|
||||
public function createShowForms()
|
||||
{
|
||||
$formWhat = new Application_Form_AddShowWhat();
|
||||
$formWho = new Application_Form_AddShowWho();
|
||||
$formWhen = new Application_Form_AddShowWhen();
|
||||
$formRepeats = new Application_Form_AddShowRepeats();
|
||||
$formStyle = new Application_Form_AddShowStyle();
|
||||
$formLive = new Application_Form_AddShowLiveStream();
|
||||
$formRecord = new Application_Form_AddShowRR();
|
||||
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
||||
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
||||
|
||||
$formWhat->removeDecorator('DtDdWrapper');
|
||||
$formWho->removeDecorator('DtDdWrapper');
|
||||
$formWhen->removeDecorator('DtDdWrapper');
|
||||
$formRepeats->removeDecorator('DtDdWrapper');
|
||||
$formStyle->removeDecorator('DtDdWrapper');
|
||||
$formLive->removeDecorator('DtDdWrapper');
|
||||
$formRecord->removeDecorator('DtDdWrapper');
|
||||
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
||||
$formRebroadcast->removeDecorator('DtDdWrapper');
|
||||
|
||||
$forms = array();
|
||||
$forms["what"] = $formWhat;
|
||||
$forms["who"] = $formWho;
|
||||
$forms["when"] = $formWhen;
|
||||
$forms["repeats"] = $formRepeats;
|
||||
$forms["style"] = $formStyle;
|
||||
$forms["live"] = $formLive;
|
||||
$forms["record"] = $formRecord;
|
||||
$forms["abs_rebroadcast"] = $formAbsoluteRebroadcast;
|
||||
$forms["rebroadcast"] = $formRebroadcast;
|
||||
|
||||
return $forms;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Popluates the what, when, and repeat forms
|
||||
* with default values
|
||||
*/
|
||||
public function populateNewShowForms($formWhat, $formWhen, $formRepeats)
|
||||
{
|
||||
$formWhat->populate(
|
||||
array('add_show_id' => '-1',
|
||||
'add_show_instance_id' => '-1'));
|
||||
|
||||
$formWhen->populate(
|
||||
array('add_show_start_date' => date("Y-m-d"),
|
||||
'add_show_start_time' => '00:00',
|
||||
'add_show_end_date_no_repeate' => date("Y-m-d"),
|
||||
'add_show_end_time' => '01:00',
|
||||
'add_show_duration' => '01h 00m'));
|
||||
|
||||
$formRepeats->populate(array('add_show_end_date' => date("Y-m-d")));
|
||||
}
|
||||
|
||||
public function delegateShowInstanceFormPopulation($forms)
|
||||
{
|
||||
$this->populateFormWhat($forms["what"]);
|
||||
$this->populateInstanceFormWhen($forms["when"]);
|
||||
$this->populateFormWho($forms["who"]);
|
||||
$this->populateFormLive($forms["live"]);
|
||||
$this->populateFormStyle($forms["style"]);
|
||||
|
||||
//no need to populate these forms since the user won't
|
||||
//be able to see them
|
||||
$forms["repeats"]->disable();
|
||||
$forms["record"]->disable();
|
||||
$forms["rebroadcast"]->disable();
|
||||
$forms["abs_rebroadcast"]->disable();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Delegates populating each show form with the appropriate
|
||||
* data of the current show being edited
|
||||
*
|
||||
* @param $forms
|
||||
*/
|
||||
public function delegateShowFormPopulation($forms)
|
||||
{
|
||||
$this->populateFormWhat($forms["what"]);
|
||||
$this->populateFormWhen($forms["when"]);
|
||||
$this->populateFormRepeats($forms["repeats"]);
|
||||
$this->populateFormWho($forms["who"]);
|
||||
$this->populateFormStyle($forms["style"]);
|
||||
$this->populateFormLive($forms["live"]);
|
||||
$this->populateFormRecord($forms["record"]);
|
||||
$this->populateFormRebroadcastRelative($forms["rebroadcast"]);
|
||||
$this->populateFormRebroadcastAbsolute($forms["abs_rebroadcast"]);
|
||||
}
|
||||
|
||||
private function populateFormWhat($form)
|
||||
{
|
||||
$form->populate(
|
||||
array(
|
||||
'add_show_instance_id' => $this->instanceId,
|
||||
'add_show_id' => $this->ccShow->getDbId(),
|
||||
'add_show_name' => $this->ccShow->getDbName(),
|
||||
'add_show_url' => $this->ccShow->getDbUrl(),
|
||||
'add_show_genre' => $this->ccShow->getDbGenre(),
|
||||
'add_show_description' => $this->ccShow->getDbDescription()));
|
||||
}
|
||||
|
||||
private function populateFormWhen($form)
|
||||
{
|
||||
$ccShowDay = $this->ccShow->getFirstCcShowDay();
|
||||
|
||||
$showStart = $ccShowDay->getLocalStartDateAndTime();
|
||||
$showEnd = $ccShowDay->getLocalEndDateAndTime($showStart);
|
||||
|
||||
//check if the first show is in the past
|
||||
if ($ccShowDay->isShowStartInPast()) {
|
||||
//for a non-repeating show, we should never allow user to change the start time.
|
||||
//for a repeating show, we should allow because the form works as repeating template form
|
||||
if (!$ccShowDay->isRepeating()) {
|
||||
$form->disableStartDateAndTime();
|
||||
} else {
|
||||
list($showStart, $showEnd) = $this->getNextFutureRepeatShowTime();
|
||||
}
|
||||
}
|
||||
|
||||
$form->populate(
|
||||
array(
|
||||
'add_show_start_date' => $showStart->format("Y-m-d"),
|
||||
'add_show_start_time' => $showStart->format("H:i"),
|
||||
'add_show_end_date_no_repeat' => $showEnd->format("Y-m-d"),
|
||||
'add_show_end_time' => $showEnd->format("H:i"),
|
||||
'add_show_duration' => $ccShowDay->formatDuration(true),
|
||||
'add_show_repeats' => $ccShowDay->isRepeating() ? 1 : 0));
|
||||
}
|
||||
|
||||
private function populateInstanceFormWhen($form)
|
||||
{
|
||||
$ccShowInstance = CcShowInstancesQuery::create()->findPk($this->instanceId);
|
||||
|
||||
$timezone = new DateTimeZone(Application_Model_Preference::GetTimezone());
|
||||
//DateTime object in UTC
|
||||
$showStart = $ccShowInstance->getDbStarts(null);
|
||||
$showStart->setTimezone($timezone);
|
||||
|
||||
$showEnd = $ccShowInstance->getDbEnds(null);
|
||||
$showEnd->setTimezone($timezone);
|
||||
|
||||
//if the show has started, do not allow editing on the start time
|
||||
if ($showStart->getTimestamp() <= time()) {
|
||||
$form->disableStartDateAndTime();
|
||||
}
|
||||
|
||||
$form->populate(
|
||||
array(
|
||||
'add_show_start_date' => $showStart->format("Y-m-d"),
|
||||
'add_show_start_time' => $showStart->format("H:i"),
|
||||
'add_show_end_date_no_repeat' => $showEnd->format("Y-m-d"),
|
||||
'add_show_end_time' => $showEnd->format("H:i"),
|
||||
'add_show_duration' => $this->calculateDuration(
|
||||
$showStart->format("Y-m-d H:i:s"), $showEnd->format("Y-m-d H:i:s")),
|
||||
'add_show_repeats' => 0));
|
||||
|
||||
$form->getElement('add_show_repeats')->setOptions(array("disabled" => true));
|
||||
}
|
||||
|
||||
private function populateFormRepeats($form)
|
||||
{
|
||||
$ccShowDays = $this->ccShow->getCcShowDays();
|
||||
|
||||
$days = array();
|
||||
foreach ($ccShowDays as $ccShowDay) {
|
||||
$showStart = $ccShowDay->getLocalStartDateAndTime();
|
||||
array_push($days, $showStart->format("w"));
|
||||
}
|
||||
|
||||
$service_show = new Application_Service_ShowService($this->ccShow->getDbId());
|
||||
$repeatEndDate = new DateTime($service_show->getRepeatingEndDate(), new DateTimeZone(
|
||||
$ccShowDays[0]->getDbTimezone()));
|
||||
//end dates are stored non-inclusively so we need to
|
||||
//subtract one day
|
||||
$repeatEndDate->sub(new DateInterval("P1D"));
|
||||
|
||||
//default monthly repeat type
|
||||
$monthlyRepeatType = 2;
|
||||
$repeatType = $ccShowDays[0]->getDbRepeatType();
|
||||
if ($repeatType == REPEAT_MONTHLY_WEEKLY) {
|
||||
$monthlyRepeatType = $repeatType;
|
||||
//a repeat type of 2 means the show is repeating monthly
|
||||
$repeatType = 2;
|
||||
} elseif ($repeatType == REPEAT_MONTHLY_MONTHLY) {
|
||||
$monthlyRepeatType = $repeatType;
|
||||
}
|
||||
|
||||
$form->populate(
|
||||
array(
|
||||
'add_show_linked' => $this->ccShow->getDbLinked(),
|
||||
'add_show_repeat_type' => $repeatType,
|
||||
'add_show_day_check' => $days,
|
||||
'add_show_end_date' => $repeatEndDate->format("Y-m-d"),
|
||||
'add_show_no_end' => (!$service_show->getRepeatingEndDate()),
|
||||
'add_show_monthly_repeat_type' => $monthlyRepeatType));
|
||||
|
||||
if (!$this->ccShow->isLinkable()) {
|
||||
$form->getElement('add_show_linked')->setOptions(array('disabled' => true));
|
||||
}
|
||||
}
|
||||
|
||||
private function populateFormWho($form)
|
||||
{
|
||||
$ccShowHosts = $this->ccShow->getCcShowHostss();
|
||||
|
||||
$hosts = array();
|
||||
foreach ($ccShowHosts as $ccShowHost) {
|
||||
array_push($hosts, $ccShowHost->getDbHost());
|
||||
}
|
||||
|
||||
$form->populate(array('add_show_hosts' => $hosts));
|
||||
}
|
||||
|
||||
private function populateFormStyle($form)
|
||||
{
|
||||
$form->populate(
|
||||
array(
|
||||
'add_show_background_color' => $this->ccShow->getDbBackgroundColor(),
|
||||
'add_show_color' => $this->ccShow->getDbColor()));
|
||||
}
|
||||
|
||||
private function populateFormLive($form)
|
||||
{
|
||||
$form->populate(
|
||||
array(
|
||||
"cb_airtime_auth" => $this->ccShow->getDbLiveStreamUsingAirtimeAuth(),
|
||||
"cb_custom_auth" => $this->ccShow->getDbLiveStreamUsingCustomAuth(),
|
||||
"custom_username" => $this->ccShow->getDbLiveStreamUser(),
|
||||
"custom_password" => $this->ccShow->getDbLiveStreamPass()));
|
||||
}
|
||||
|
||||
private function populateFormRecord($form)
|
||||
{
|
||||
$form->populate(
|
||||
array(
|
||||
'add_show_record' => $this->ccShow->isRecorded(),
|
||||
'add_show_rebroadcast' => $this->ccShow->isRebroadcast()));
|
||||
|
||||
$form->getElement('add_show_record')->setOptions(array('disabled' => true));
|
||||
}
|
||||
|
||||
private function populateFormRebroadcastRelative($form)
|
||||
{
|
||||
$relativeRebroadcasts = $this->ccShow->getRebroadcastsRelative();
|
||||
|
||||
$formValues = array();
|
||||
$i = 1;
|
||||
foreach ($relativeRebroadcasts as $rr) {
|
||||
$formValues["add_show_rebroadcast_date_$i"] = $rr->getDbDayOffset();
|
||||
$formValues["add_show_rebroadcast_time_$i"] = Application_Common_DateHelper::removeSecondsFromTime(
|
||||
$rr->getDbStartTime());
|
||||
$i++;
|
||||
}
|
||||
|
||||
$form->populate($formValues);
|
||||
}
|
||||
|
||||
private function populateFormRebroadcastAbsolute($form)
|
||||
{
|
||||
$absolutRebroadcasts = $this->ccShow->getRebroadcastsAbsolute();
|
||||
|
||||
$formValues = array();
|
||||
$i = 1;
|
||||
foreach ($absolutRebroadcasts as $ar) {
|
||||
//convert dates to user's local time
|
||||
$start = new DateTime($ar->getDbStarts(), new DateTimeZone("UTC"));
|
||||
$start->setTimezone(new DateTimeZone(Application_Model_Preference::GetTimezone()));
|
||||
$formValues["add_show_rebroadcast_date_absolute_$i"] = $start->format("Y-m-d");
|
||||
$formValues["add_show_rebroadcast_time_absolute_$i"] = $start->format("H:i");
|
||||
$i++;
|
||||
}
|
||||
|
||||
$form->populate($formValues);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Before we send the form data in for validation, there
|
||||
* are a few fields we may need to adjust first
|
||||
* @param $formData
|
||||
*/
|
||||
public function preEditShowValidationCheck($formData)
|
||||
{
|
||||
$validateStartDate = true;
|
||||
$validateStartTime = true;
|
||||
|
||||
//CcShowDays object of the show currently being edited
|
||||
$currentShowDay = $this->ccShow->getFirstCcShowDay();
|
||||
|
||||
//DateTime object
|
||||
$dt = $currentShowDay->getLocalStartDateAndTime();
|
||||
|
||||
if (!array_key_exists('add_show_start_date', $formData)) {
|
||||
//Changing the start date was disabled, since the
|
||||
//array key does not exist. We need to repopulate this entry from the db.
|
||||
$formData['add_show_start_date'] = $dt->format("Y-m-d");
|
||||
|
||||
if (!array_key_exists('add_show_start_time', $formData)) {
|
||||
$formData['add_show_start_time'] = $dt->format("H:i");
|
||||
$validateStartTime = false;
|
||||
}
|
||||
$validateStartDate = false;
|
||||
}
|
||||
$formData['add_show_record'] = $currentShowDay->getDbRecord();
|
||||
|
||||
//if the show is repeating, set the start date to the next
|
||||
//repeating instance in the future
|
||||
if ($currentShowDay->isRepeating()) {
|
||||
list($originalShowStartDateTime,) = $this->getNextFutureRepeatShowTime();
|
||||
} else {
|
||||
$originalShowStartDateTime = $dt;
|
||||
}
|
||||
|
||||
return array($formData, $validateStartDate, $validateStartTime, $originalShowStartDateTime);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns 2 DateTime objects, in the user's local time,
|
||||
* of the next future repeat show instance start and end time
|
||||
*/
|
||||
public function getNextFutureRepeatShowTime()
|
||||
{
|
||||
$ccShowInstance = CcShowInstancesQuery::create()
|
||||
->filterByDbShowId($this->ccShow->getDbId())
|
||||
->filterByDbModifiedInstance(false)
|
||||
->filterByDbEnds(gmdate("Y-m-d H:i:s"), Criteria::GREATER_THAN)
|
||||
->orderByDbStarts()
|
||||
->limit(1)
|
||||
->findOne();
|
||||
|
||||
$starts = new DateTime($ccShowInstance->getDbStarts(), new DateTimeZone("UTC"));
|
||||
$ends = new DateTime($ccShowInstance->getDbEnds(), new DateTimeZone("UTC"));
|
||||
$userTimezone = Application_Model_Preference::GetTimezone();
|
||||
|
||||
$starts->setTimezone(new DateTimeZone($userTimezone));
|
||||
$ends->setTimezone(new DateTimeZone($userTimezone));
|
||||
|
||||
return array($starts, $ends);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Validates show forms
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function validateShowForms($forms, $formData, $validateStartDate = true,
|
||||
$originalStartDate=null, $editShow=false, $instanceId=null)
|
||||
{
|
||||
$what = $forms["what"]->isValid($formData);
|
||||
$live = $forms["live"]->isValid($formData);
|
||||
$record = $forms["record"]->isValid($formData);
|
||||
$who = $forms["who"]->isValid($formData);
|
||||
$style = $forms["style"]->isValid($formData);
|
||||
$when = $forms["when"]->isWhenFormValid($formData, $validateStartDate,
|
||||
$originalStartDate, $editShow, $instanceId);
|
||||
|
||||
$repeats = true;
|
||||
if ($formData["add_show_repeats"]) {
|
||||
$repeats = $forms["repeats"]->isValid($formData);
|
||||
|
||||
/*
|
||||
* Make the absolute rebroadcast form valid since
|
||||
* it does not get used if the show is repeating
|
||||
*/
|
||||
$forms["abs_rebroadcast"]->reset();
|
||||
$absRebroadcast = true;
|
||||
|
||||
$rebroadcast = true;
|
||||
if ($formData["add_show_rebroadcast"]) {
|
||||
$formData["add_show_duration"] = Application_Service_ShowService::formatShowDuration(
|
||||
$formData["add_show_duration"]);
|
||||
$rebroadcast = $forms["rebroadcast"]->isValid($formData);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Make the rebroadcast form valid since it does
|
||||
* not get used if the show is not repeating.
|
||||
* Instead, we use the absolute rebroadcast form
|
||||
*/
|
||||
$forms["rebroadcast"]->reset();
|
||||
$rebroadcast = true;
|
||||
|
||||
$absRebroadcast = true;
|
||||
if ($formData["add_show_rebroadcast"]) {
|
||||
$formData["add_show_duration"] = Application_Service_ShowService::formatShowDuration(
|
||||
$formData["add_show_duration"]);
|
||||
$absRebroadcast = $forms["abs_rebroadcast"]->isValid($formData);
|
||||
}
|
||||
}
|
||||
|
||||
if ($what && $live && $record && $who && $style && $when &&
|
||||
$repeats && $absRebroadcast && $rebroadcast) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function calculateDuration($start, $end)
|
||||
{
|
||||
try {
|
||||
$startDateTime = new DateTime($start);
|
||||
$endDateTime = new DateTime($end);
|
||||
|
||||
$UTCStartDateTime = $startDateTime->setTimezone(new DateTimeZone('UTC'));
|
||||
$UTCEndDateTime = $endDateTime->setTimezone(new DateTimeZone('UTC'));
|
||||
|
||||
$duration = $UTCEndDateTime->diff($UTCStartDateTime);
|
||||
|
||||
$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');
|
||||
return sprintf('%s%02dh %02dm', $sign, $hour, $min);
|
||||
} else {
|
||||
return $duration->format('%Hh %Im');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return "Invalid Date";
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
/*define('UTYPE_HOST' , 'H');
|
||||
define('UTYPE_ADMIN' , 'A');
|
||||
define('UTYPE_GUEST' , 'G');
|
||||
define('UTYPE_PROGRAM_MANAGER' , 'P');*/
|
||||
|
||||
class Application_Service_UserService
|
||||
{
|
||||
private $currentUser;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
if (!is_null($userInfo->id)) {
|
||||
$this->currentUser = CcSubjsQuery::create()->findPK($userInfo->id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns a CcSubjs object
|
||||
*/
|
||||
public function getCurrentUser()
|
||||
{
|
||||
if (is_null($this->currentUser)) {
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
return $this->currentUser;
|
||||
}
|
||||
|
||||
}
|
|
@ -132,6 +132,10 @@
|
|||
<column name="live_stream_using_custom_auth" phpName="DbLiveStreamUsingCustomAuth" type="BOOLEAN" required="false" defaultValue="false"/>
|
||||
<column name="live_stream_user" phpName="DbLiveStreamUser" type="VARCHAR" size="255" required="false"/>
|
||||
<column name="live_stream_pass" phpName="DbLiveStreamPass" type="VARCHAR" size="255" required="false"/>
|
||||
<column name="linked" phpName="DbLinked" type="BOOLEAN" required="true" defaultValue="false" />
|
||||
<column name="is_linkable" phpName="DbIsLinkable" type="BOOLEAN" required="true" defaultValue="true" />
|
||||
<!-- A show is_linkable if it has never been linked before. Once a show becomes unlinked
|
||||
it can not be linked again -->
|
||||
</table>
|
||||
<table name="cc_show_instances" phpName="CcShowInstances">
|
||||
<column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
|
||||
|
@ -324,6 +328,11 @@
|
|||
<column name="instance_id" phpName="DbInstanceId" type="INTEGER" required="true"/>
|
||||
<column name="playout_status" phpName="DbPlayoutStatus" type="SMALLINT" required="true" defaultValue="1"/>
|
||||
<column name="broadcasted" phpName="DbBroadcasted" type="SMALLINT" required="true" defaultValue="0"/>
|
||||
<!-- Broadcasted is set to 1 when show and master source are not on.
|
||||
We need to know this for logging playout history. (It only gets logged when
|
||||
broadcasted = 1)
|
||||
-->
|
||||
<column name="position" phpName="DbPosition" type="INTEGER" required="true" default="0" />
|
||||
<!-- This foreign key is still useful even though it may seem we don't ever delete cc_show_instances anymore.
|
||||
We will do delete them in some cases (when editing a show and changing the repeating days of the week
|
||||
for example. \
|
||||
|
|
|
@ -11,7 +11,7 @@ INSERT INTO cc_live_log("state", "start_time") VALUES('S', now() at time zone 'U
|
|||
-- end of added in 2.1
|
||||
|
||||
-- added in 2.0.0
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('stream_type', 'ogg, mp3');
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('stream_type', 'ogg, mp3, opus, aac');
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('stream_bitrate', '24, 32, 48, 64, 96, 128, 160, 192, 224, 256, 320');
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('num_of_streams', '3');
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('max_bitrate', '320');
|
||||
|
@ -325,9 +325,12 @@ INSERT INTO cc_pref("keystr", "valstr") VALUES('locale', 'en_CA');
|
|||
|
||||
INSERT INTO cc_pref("subjid", "keystr", "valstr") VALUES(1, 'user_locale', 'en_CA');
|
||||
|
||||
INSERT INTO cc_locale (locale_code, locale_lang) VALUES ('en_CA', 'English');
|
||||
INSERT INTO cc_locale (locale_code, locale_lang) VALUES ('en_CA', 'English (Canada)');
|
||||
INSERT INTO cc_locale (locale_code, locale_lang) VALUES ('en_GB', 'English (Britain)');
|
||||
INSERT INTO cc_locale (locale_code, locale_lang) VALUES ('en_US', 'English (USA)');
|
||||
INSERT INTO cc_locale (locale_code, locale_lang) VALUES ('cs_CZ', 'Český');
|
||||
INSERT INTO cc_locale (locale_code, locale_lang) VALUES ('de_DE', 'Deutsch');
|
||||
INSERT INTO cc_locale (locale_code, locale_lang) VALUES ('de_AT', 'Österreichisches Deutsch');
|
||||
INSERT INTO cc_locale (locale_code, locale_lang) VALUES ('es_ES', 'Español');
|
||||
INSERT INTO cc_locale (locale_code, locale_lang) VALUES ('fr_FR', 'Français');
|
||||
INSERT INTO cc_locale (locale_code, locale_lang) VALUES ('it_IT', 'Italiano');
|
||||
|
|
|
@ -156,6 +156,8 @@ CREATE TABLE "cc_show"
|
|||
"live_stream_using_custom_auth" BOOLEAN default 'f',
|
||||
"live_stream_user" VARCHAR(255),
|
||||
"live_stream_pass" VARCHAR(255),
|
||||
"linked" BOOLEAN default 'f' NOT NULL,
|
||||
"is_linkable" BOOLEAN default 't' NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
|
@ -428,6 +430,7 @@ CREATE TABLE "cc_schedule"
|
|||
"instance_id" INTEGER NOT NULL,
|
||||
"playout_status" INT2 default 1 NOT NULL,
|
||||
"broadcasted" INT2 default 0 NOT NULL,
|
||||
"position" INTEGER default 0 NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -2390,13 +2390,13 @@ dd .info-text-small {
|
|||
margin-bottom:0px;
|
||||
}
|
||||
.stream-config dd select {
|
||||
width:160px;
|
||||
width:180px;
|
||||
line-height:140%;
|
||||
}
|
||||
|
||||
.stream-config input[type="text"] {
|
||||
.stream-config input[type="text"], .stream-config input[type="password"] {
|
||||
/*width:98.5%;*/
|
||||
min-width:152px;
|
||||
min-width:172px;
|
||||
}
|
||||
.stream-config .display_field dd input[type="text"], .stream-config .display_field dd input[type="password"], .stream-config .display_field dd textarea {
|
||||
min-width:99%;
|
||||
|
|
|
@ -214,13 +214,28 @@ function setAddShowEvents() {
|
|||
});
|
||||
|
||||
form.find("#add_show_repeat_type").change(function(){
|
||||
if($(this).val() == 2) {
|
||||
toggleRepeatDays();
|
||||
toggleMonthlyRepeatType();
|
||||
});
|
||||
toggleMonthlyRepeatType();
|
||||
toggleRepeatDays();
|
||||
function toggleRepeatDays() {
|
||||
if(form.find("#add_show_repeat_type").val() >= 2) {
|
||||
form.find("#add_show_day_check-label, #add_show_day_check-element").hide();
|
||||
//form.find("#add_show_monthly_repeat_type-label, #add_show_monthly_repeat_type-element").show();
|
||||
}
|
||||
else {
|
||||
form.find("#add_show_day_check-label, #add_show_day_check-element").show();
|
||||
//form.find("#add_show_monthly_repeat_type-label, #add_show_monthly_repeat_type-element").hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
function toggleMonthlyRepeatType() {
|
||||
if (form.find("#add_show_repeat_type").val() == 2) {
|
||||
form.find("#add_show_monthly_repeat_type-label, #add_show_monthly_repeat_type-element").show();
|
||||
} else {
|
||||
form.find("#add_show_monthly_repeat_type-label, #add_show_monthly_repeat_type-element").hide();
|
||||
}
|
||||
}
|
||||
|
||||
form.find("#add_show_day_check-label").addClass("block-display");
|
||||
form.find("#add_show_day_check-element").addClass("block-display clearfix");
|
||||
|
|
|
@ -379,7 +379,7 @@ $(document).ready(function() {
|
|||
|
||||
//edit a single instance
|
||||
callback = function() {
|
||||
$.get(edit.instance.url, {format: "json", id: data.id, type: "instance"}, function(json){
|
||||
$.get(edit.instance.url, {format: "json", showId: data.showId, instanceId: data.id, type: "instance"}, function(json){
|
||||
beginEditShow(json);
|
||||
});
|
||||
};
|
||||
|
@ -387,14 +387,14 @@ $(document).ready(function() {
|
|||
|
||||
//edit this instance and all
|
||||
callback = function() {
|
||||
$.get(edit.all.url, {format: "json", id: data.id, type: "all"}, function(json){
|
||||
$.get(edit.all.url, {format: "json", showId: data.showId, instanceId: data.id, type: "all"}, function(json){
|
||||
beginEditShow(json);
|
||||
});
|
||||
};
|
||||
edit.all.callback = callback;
|
||||
}else{
|
||||
callback = function() {
|
||||
$.get(oItems.edit.url, {format: "json", id: data.id, type: oItems.edit._type}, function(json){
|
||||
$.get(oItems.edit.url, {format: "json", showId: data.showId, instanceId: data.id, type: oItems.edit._type}, function(json){
|
||||
beginEditShow(json);
|
||||
});
|
||||
};
|
||||
|
@ -497,11 +497,11 @@ $(document).ready(function() {
|
|||
|
||||
items = oItems;
|
||||
}
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: baseUrl+"schedule/make-context-menu",
|
||||
type: "GET",
|
||||
data: {id : data.id, format: "json"},
|
||||
data: {instanceId : data.id, showId: data.showId, format: "json"},
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json){
|
||||
|
|
|
@ -42,7 +42,9 @@ var AIRTIME = (function(AIRTIME){
|
|||
mod.updateCalendarStatusIcon = function(json) {
|
||||
|
||||
|
||||
if (window.location.pathname.toLowerCase() != baseUrl+"schedule") {
|
||||
//make sure we are only executing this code on the calendar view, not
|
||||
//the Now Playing view.
|
||||
if (window.location.pathname.toLowerCase().indexOf("schedule") < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -170,7 +172,6 @@ var AIRTIME = (function(AIRTIME){
|
|||
};
|
||||
|
||||
mod.checkToolBarIcons = function() {
|
||||
|
||||
AIRTIME.library.checkAddButton();
|
||||
mod.checkSelectButton();
|
||||
mod.checkTrimButton();
|
||||
|
@ -297,7 +298,6 @@ var AIRTIME = (function(AIRTIME){
|
|||
};
|
||||
|
||||
mod.fnAdd = function(aMediaIds, aSchedIds) {
|
||||
|
||||
mod.disableUI();
|
||||
|
||||
$.post(baseUrl+"showbuilder/schedule-add",
|
||||
|
@ -644,7 +644,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
|
||||
//save some info for reordering purposes.
|
||||
$nRow.data({"aData": aData});
|
||||
|
||||
|
||||
if (aData.scheduled === 1) {
|
||||
$nRow.addClass(NOW_PLAYING_CLASS);
|
||||
}
|
||||
|
@ -655,7 +655,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
$nRow.addClass("sb-future");
|
||||
}
|
||||
|
||||
if (aData.allowed !== true) {
|
||||
if (aData.allowed !== true || aData.linked_allowed === false) {
|
||||
$nRow.addClass("sb-not-allowed");
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -17,6 +17,7 @@ Depends: apache2,
|
|||
gzip (>= 1.3.12),
|
||||
libao-ocaml,
|
||||
libapache2-mod-php5,
|
||||
libc-bin,
|
||||
libcamomile-ocaml-data,
|
||||
libesd0,
|
||||
libmad-ocaml,
|
||||
|
@ -27,6 +28,7 @@ Depends: apache2,
|
|||
libsoundtouch-ocaml,
|
||||
libtaglib-ocaml,
|
||||
liquidsoap (>= 1.0.0~),
|
||||
locales,
|
||||
lsof,
|
||||
monit,
|
||||
multitail,
|
||||
|
|
|
@ -229,7 +229,7 @@ case "$1" in
|
|||
echo "Upgrades from Airtime versions before 2.1.0 are not supported. Please back up your files and perform a clean install."
|
||||
|
||||
elif [ "${APACHESETUP}" == "no thanks" ]; then
|
||||
echo "Please run the ${tmpdir}/install_minimal/airtime-install script after you have set up the web server."
|
||||
echo "Please run the ${tmpdir}/install_minimal/airtime-install script with the -d option after you have set up the web server."
|
||||
|
||||
else
|
||||
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
#!/bin/bash -e
|
||||
apt-get install -y --force-yes lsb-release sudo
|
||||
dist=`lsb_release -is`
|
||||
code=`lsb_release -cs`
|
||||
cpu=`getconf LONG_BIT`
|
||||
cpuvalue=
|
||||
|
||||
if [ "$dist" = "Ubuntu" ]; then
|
||||
set +e
|
||||
grep -E "deb http://ca.archive.ubuntu.com/ubuntu/ $code multiverse" /etc/apt/sources.list
|
||||
returncode=$?
|
||||
set -e
|
||||
if [ "$returncode" -ne "0" ]; then
|
||||
echo "deb http://ca.archive.ubuntu.com/ubuntu/ $code multiverse" >> /etc/apt/sources.list
|
||||
echo "deb http://ca.archive.ubuntu.com/ubuntu/ $code universe" >> /etc/apt/sources.list
|
||||
fi
|
||||
fi
|
||||
|
||||
#enable squeeze backports to get lame packages
|
||||
if [ "$dist" = "Debian" -a "$code" = "squeeze" ]; then
|
||||
set +e
|
||||
grep -E "deb http://backports.debian.org/debian-backports squeeze-backports main" /etc/apt/sources.list
|
||||
returncode=$?
|
||||
set -e
|
||||
if [ "$returncode" -ne "0" ]; then
|
||||
echo "deb http://backports.debian.org/debian-backports squeeze-backports main" >> /etc/apt/sources.list
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "System is $cpu bit..."
|
||||
if [ "$cpu" = "64" ]; then
|
||||
cpuvalue="amd64"
|
||||
else
|
||||
cpuvalue="i386"
|
||||
fi
|
||||
|
||||
apt-get update
|
||||
apt-get -o Dpkg::Options::="--force-confold" upgrade
|
||||
apt-get install wget
|
||||
wget http://apt.sourcefabric.org/misc/libopus_1.0.1/libopus-dbg_1.0.1~$code~sfo-1_$cpuvalue.deb
|
||||
wget http://apt.sourcefabric.org/misc/libopus_1.0.1/libopus-dev_1.0.1~$code~sfo-1_$cpuvalue.deb
|
||||
wget http://apt.sourcefabric.org/misc/libopus_1.0.1/libopus0_1.0.1~$code~sfo-1_$cpuvalue.deb
|
||||
|
||||
apt-get -y --force-yes install git-core ocaml-findlib libao-ocaml-dev \
|
||||
libportaudio-ocaml-dev libmad-ocaml-dev libtaglib-ocaml-dev libalsa-ocaml-dev \
|
||||
libvorbis-ocaml-dev libladspa-ocaml-dev libxmlplaylist-ocaml-dev libflac-dev \
|
||||
libxml-dom-perl libxml-dom-xpath-perl patch autoconf libmp3lame-dev \
|
||||
libcamomile-ocaml-dev libcamlimages-ocaml-dev libtool libpulse-dev camlidl \
|
||||
libfaad-dev libpcre-ocaml-dev
|
||||
|
||||
dpkg -i libopus-dbg_1.0.1~$code~sfo-1_$cpuvalue.deb libopus-dev_1.0.1~$code~sfo-1_$cpuvalue.deb libopus0_1.0.1~$code~sfo-1_$cpuvalue.deb
|
||||
rm -rf liquidsoap-full
|
||||
git clone https://github.com/savonet/liquidsoap-full
|
||||
chmod -R 777 liquidsoap-full
|
||||
cd liquidsoap-full
|
||||
sudo -u tmp make init
|
||||
sudo -u tmp make update
|
||||
|
||||
sudo -u tmp cp PACKAGES.minimal PACKAGES
|
||||
|
||||
sed -i "s/#ocaml-portaudio/ocaml-portaudio/g" PACKAGES
|
||||
sed -i "s/#ocaml-alsa/ocaml-alsa/g" PACKAGES
|
||||
sed -i "s/#ocaml-pulseaudio/ocaml-pulseaudio/g" PACKAGES
|
||||
sed -i "s/#ocaml-faad/ocaml-faad/g" PACKAGES
|
||||
sed -i "s/#ocaml-opus/ocaml-opus/g" PACKAGES
|
||||
#sed -i "s/#ocaml-shine/ocaml-shine/g" PACKAGES
|
||||
|
||||
sudo -u tmp ./bootstrap
|
||||
sudo -u tmp ./configure
|
||||
sudo -u tmp make
|
||||
cp /liquidsoap-full/liquidsoap/src/liquidsoap /
|
|
@ -0,0 +1,170 @@
|
|||
#!/bin/bash
|
||||
|
||||
exec 2>&1
|
||||
|
||||
ROOT_UID="0"
|
||||
|
||||
#Check if run as root
|
||||
if [ "$UID" -ne "$ROOT_UID" ] ; then
|
||||
echo "You must have 'sudo' right to do that!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf ./liquidsoap_compile_logs
|
||||
mkdir -p ./liquidsoap_compile_logs
|
||||
|
||||
showhelp () {
|
||||
echo "Usage: run.sh [options] [parameters]
|
||||
-c all|ubuntu_lucid_32 Compile liquidsoap on all platforms or specified platform.
|
||||
-b all|ubuntu_lucid_32 Build shroot environments for all platforms or specified platform.
|
||||
-u username Local username will be used as sudo user of chroot env. Must be assigned before -b options"
|
||||
exit 0
|
||||
}
|
||||
|
||||
build_env () {
|
||||
if [ $sudo_user = "-1" ];then
|
||||
echo "Please use -u to assign sudo username before build environments."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "build_env $1"
|
||||
#exec > >(tee ./liquidsoap_compile_logs/build_env_$1.log)
|
||||
os=`echo $1 | awk '/(debian)/'`
|
||||
cpu=`echo $1 | awk '/(64)/'`
|
||||
dist=`echo $1 | awk -F "_" '{print $2}'`
|
||||
|
||||
rm -f /etc/schroot/chroot.d/$1.conf
|
||||
if cat /etc/passwd | awk -F:'{print $1}' | grep "tmp" >/dev/null 2>&1;then
|
||||
echo "User tmp exists."
|
||||
else
|
||||
useradd tmp
|
||||
echo "User tmp is created."
|
||||
fi
|
||||
|
||||
apt-get update
|
||||
apt-get --force-yes -y install debootstrap dchroot
|
||||
echo [$1] > /etc/schroot/chroot.d/$1.conf
|
||||
echo description=$1 >> /etc/schroot/chroot.d/$1.conf
|
||||
echo directory=/srv/chroot/$1 >> /etc/schroot/chroot.d/$1.conf
|
||||
echo type=directory >> /etc/schroot/chroot.d/$1.conf
|
||||
echo users=$sudo_user,tmp >> /etc/schroot/chroot.d/$1.conf
|
||||
echo root-users=$sudo_user >> /etc/schroot/chroot.d/$1.conf
|
||||
rm -rf /srv/chroot/$1
|
||||
mkdir -p /srv/chroot/$1
|
||||
|
||||
#cp liquidsoap_compile.sh /srv/chroot/$1/
|
||||
if [ "$os" = "" ];then
|
||||
if [ "$cpu" = "" ];then
|
||||
echo "debootstrap --variant=buildd --arch=i386 $dist /srv/chroot/$1 http://archive.ubuntu.com/ubuntu/"
|
||||
debootstrap --variant=buildd --arch=i386 $dist /srv/chroot/$1 http://archive.ubuntu.com/ubuntu/
|
||||
else
|
||||
echo "debootstrap --variant=buildd --arch=amd64 $dist /srv/chroot/$1 http://archive.ubuntu.com/ubuntu/"
|
||||
debootstrap --variant=buildd --arch=amd64 $dist /srv/chroot/$1 http://archive.ubuntu.com/ubuntu/
|
||||
fi
|
||||
else
|
||||
if [ "$cpu" = "" ];then
|
||||
echo "debootstrap --variant=buildd --arch=i386 $dist /srv/chroot/$1 http://ftp.debian.com/debian/"
|
||||
debootstrap --variant=buildd --arch=i386 $dist /srv/chroot/$1 http://ftp.debian.com/debian/
|
||||
else
|
||||
echo "debootstrap --variant=buildd --arch=amd64 $dist /srv/chroot/$1 http://ftp.debian.com/debian/"
|
||||
debootstrap --variant=buildd --arch=amd64 $dist /srv/chroot/$1 http://ftp.debian.com/debian/
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
compile_liq () {
|
||||
echo "complie_liq $1"
|
||||
#exec > >(tee ./liquidsoap_compile_logs/compile_liq_$1.log)
|
||||
binfilename=`echo $1 | sed -e 's/ubuntu/liquidsoap/g' -e 's/debian/liquidsoap/g' -e 's/32/i386/g' -e 's/64/amd64/g'`
|
||||
rm -f /srv/chroot/$1/liquidsoap_compile.sh
|
||||
rm -f /srv/chroot/$1/liquidsoap
|
||||
cp liquidsoap_compile.sh /srv/chroot/$1/
|
||||
schroot -c $1 -u root -d / -- /liquidsoap_compile.sh
|
||||
cp /srv/chroot/$1/liquidsoap ./$binfilename
|
||||
if [ $? -ne 0 ];then
|
||||
echo "$binfilename is generated successfully"
|
||||
else
|
||||
mv ./liquidsoap_compile_logs/compile_liq_$1.log ./liquidsoap_compile_logs/fail_to_compile_liq_$1.log
|
||||
fi
|
||||
}
|
||||
|
||||
os_versions=("ubuntu_lucid_32" "ubuntu_lucid_64" "ubuntu_oneiric_32" "ubuntu_oneiric_64" "ubuntu_precise_32" "ubuntu_precise_64" "ubuntu_quantal_32" "ubuntu_quantal_64" "debian_squeeze_32" "debian_squeeze_64" "debian_wheezy_32" "debian_wheezy_64")
|
||||
|
||||
num=${#os_versions[@]}
|
||||
flag=
|
||||
os=
|
||||
sudo_user="-1"
|
||||
|
||||
if [ x$1 = x ];then
|
||||
showhelp
|
||||
fi
|
||||
|
||||
while getopts b:c:u: arg
|
||||
do
|
||||
case $arg in
|
||||
b)
|
||||
if [ "$OPTARG" = "all" ];then
|
||||
echo "Building all platforms on server..."
|
||||
for i in $(seq 0 $(($num -1)))
|
||||
do
|
||||
build_env ${os_versions[$i]} | tee ./liquidsoap_compile_logs/build_env_${os_versions[$i]}.log
|
||||
done
|
||||
else
|
||||
flag=1
|
||||
for i in $(seq 0 $(($num -1)));
|
||||
do
|
||||
if [ "$OPTARG" = ${os_versions[$i]} ];then
|
||||
echo "Building platform: $OPTARG ..."
|
||||
build_env ${os_versions[$i]} | tee ./liquidsoap_compile_logs/build_env_${os_versions[$i]}.log
|
||||
flag=0
|
||||
fi
|
||||
done
|
||||
if [ $flag = 1 ];then
|
||||
echo "Unsupported Platform from:"
|
||||
for j in "${os_versions[@]}"
|
||||
do
|
||||
echo $j
|
||||
done
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
c)
|
||||
if [ "$OPTARG" = "all" ];then
|
||||
echo "Compiling liquidsoap for all platforms on server..."
|
||||
for i in $(seq 0 $(($num -1)))
|
||||
do
|
||||
compile_liq ${os_versions[$i]} | tee ./liquidsoap_compile_logs/compile_liq_${os_versions[$i]}.log
|
||||
done
|
||||
|
||||
else
|
||||
flag=1
|
||||
for i in $(seq 0 $(($num -1)));
|
||||
do
|
||||
if [ "$OPTARG" = ${os_versions[$i]} ];then
|
||||
echo "Compiling liquidsoap for platform: $OPTARG ..."
|
||||
compile_liq ${os_versions[$i]} | tee ./liquidsoap_compile_logs/compile_liq_${os_versions[$i]}.log
|
||||
flag=0
|
||||
fi
|
||||
done
|
||||
if [ $flag = 1 ];then
|
||||
echo "Unsupported Platform from:"
|
||||
for k in "${os_versions[@]}"
|
||||
do
|
||||
echo $k
|
||||
done
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
u)
|
||||
sudo_user="$OPTARG"
|
||||
echo "sudo_user is set as $sudo_user."
|
||||
;;
|
||||
?)
|
||||
showhelp
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
|
@ -6,7 +6,7 @@ VERSION=2.3.0~$(date "+%Y%m%d")
|
|||
BUILDDEST=/tmp/airtime-${VERSION}/
|
||||
DEBDIR=`pwd`/debian
|
||||
|
||||
git checkout devel
|
||||
git checkout master
|
||||
git pull
|
||||
|
||||
echo "cleaning up previous build..."
|
||||
|
|
|
@ -82,10 +82,11 @@ else
|
|||
apt-get -y --force-yes install coreutils
|
||||
fi
|
||||
|
||||
#Install Sourcefabric's custom Liquidsoap debian package
|
||||
#Install packages back-ported by Sourcefabric
|
||||
apt-get -y --force-yes install sourcefabric-keyring
|
||||
apt-get -y --force-yes install liquidsoap
|
||||
apt-get -y --force-yes install silan
|
||||
apt-get -y --force-yes install libopus0
|
||||
|
||||
if [ "$server" = "nginx" ]; then
|
||||
apt-get -y --force-yes install nginx php5-fpm
|
||||
|
|
|
@ -17,8 +17,7 @@ showhelp () {
|
|||
--reinstall|-r Force a fresh install of this Airtime Version
|
||||
--media-monitor|-m Install only media-monitor
|
||||
--pypo|-p Install only pypo and liquidsoap
|
||||
--web|-w Install only files for web-server
|
||||
--liquidsoap-keep-alive|-l Keep Liquidsoap alive when upgrading"
|
||||
--web|-w Install only files for web-server"
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
@ -30,7 +29,6 @@ mediamonitor="f"
|
|||
pypo="f"
|
||||
showrecorder="f"
|
||||
web="f"
|
||||
liquidsoap_keep_alive="f"
|
||||
disable_deb_check="f"
|
||||
|
||||
set -- $(getopt -l help,overwrite,preserve,no-db,reinstall,media-monitor,pypo,web,liquidsoap-keep-alive,disable-deb-check "hopnrmywld" "$@")
|
||||
|
@ -45,7 +43,6 @@ do
|
|||
(-m|--media-monitor) mediamonitor="t";;
|
||||
(-y|--pypo) pypo="t";;
|
||||
(-w|--web) web="t";;
|
||||
(-l|--liquidsoap-keep-alive) liquidsoap_keep_alive="t";;
|
||||
(-d|--disable-deb-check) disable_deb_check="t";;
|
||||
|
||||
(--) shift; break;;
|
||||
|
@ -143,6 +140,11 @@ fi
|
|||
#We don't want any of our python services running if we are doing an upgrade/reinstall.
|
||||
#They will be automatically restarted later on.
|
||||
echo "* Temporarily stopping any previous running services"
|
||||
set +e
|
||||
monit unmonitor airtime-media-monitor >/dev/null 2>&1
|
||||
monit unmonitor airtime-liquidsoap >/dev/null 2>&1
|
||||
monit unmonitor airtime-playout >/dev/null 2>&1
|
||||
set -e
|
||||
if [ -e /etc/init.d/airtime-media-monitor ]; then
|
||||
invoke-rc.d airtime-media-monitor stop > /dev/null 2>&1
|
||||
fi
|
||||
|
@ -163,7 +165,6 @@ export reinstall
|
|||
export nodb
|
||||
export overwrite
|
||||
export preserve
|
||||
export liquidsoap_keep_alive
|
||||
|
||||
set +e
|
||||
test "$mediamonitor" = "t" -o "$pypo" = "t"
|
||||
|
@ -172,6 +173,8 @@ set -e
|
|||
|
||||
echo -e "\n******************************** Install Begin *********************************"
|
||||
rm -rf "/usr/lib/airtime"
|
||||
mkdir -p /usr/lib/airtime
|
||||
|
||||
if [ "$python_service" -eq "0" ]; then
|
||||
$AIRTIMEROOT/python_apps/python-virtualenv/virtualenv-install.sh
|
||||
|
||||
|
@ -208,6 +211,7 @@ if [ "$mediamonitor" = "t" -o "$pypo" = "t" ]; then
|
|||
fi
|
||||
|
||||
|
||||
#An attempt to force apache to realize that files are updated on upgrade...
|
||||
touch /usr/share/airtime/public/index.php
|
||||
|
||||
if [ "$python_service" -eq "0" ]; then
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<?php
|
||||
|
||||
define('AIRTIME_VERSION', '2.3.1');
|
||||
define('AIRTIME_VERSION', '2.4.0');
|
||||
|
|
|
@ -72,7 +72,6 @@ if [ "$python_service" -eq "0" ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
mkdir -p /usr/lib/airtime
|
||||
cp -R $AIRTIMEROOT/utils /usr/lib/airtime
|
||||
cp -R $AIRTIMEROOT/python_apps/std_err_override /usr/lib/airtime
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ require_once(__DIR__.'/airtime-constants.php');
|
|||
// -------------------------------------------------------------------------
|
||||
|
||||
$iniExists = file_exists("/etc/airtime/airtime.conf");
|
||||
if ($iniExists){
|
||||
if ($iniExists) {
|
||||
//reinstall, Will ask if we should rewrite config files.
|
||||
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
|
|
|
@ -21,13 +21,9 @@ monit unmonitor airtime-liquidsoap >/dev/null 2>&1
|
|||
monit unmonitor airtime-playout >/dev/null 2>&1
|
||||
set -e
|
||||
|
||||
#virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
||||
#. ${virtualenv_bin}activate
|
||||
|
||||
#uninitialize Airtime services
|
||||
python $AIRTIMEROOT/python_apps/pypo/install/pypo-uninitialize.py
|
||||
python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-uninitialize.py
|
||||
#python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-uninitialize.py
|
||||
|
||||
if [ "$purge" = "t" ]; then
|
||||
#call Airtime uninstall script
|
||||
|
|
|
@ -64,41 +64,9 @@ $version = substr($version, 0, 5);
|
|||
|
||||
$SCRIPTPATH = __DIR__;
|
||||
|
||||
if (strcmp($version, "2.0.0") < 0) {
|
||||
echo "Unsupported Airtime version. You must upgrade from at least Airtime 2.0.0.".PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
if (strcmp($version, "2.0.1") < 0) {
|
||||
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.0.1/airtime-upgrade.php");
|
||||
pause();
|
||||
}
|
||||
if (strcmp($version, "2.0.2") < 0) {
|
||||
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.0.2/airtime-upgrade.php");
|
||||
pause();
|
||||
}
|
||||
if (strcmp($version, "2.0.3") < 0) {
|
||||
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.0.3/airtime-upgrade.php");
|
||||
pause();
|
||||
}
|
||||
if (strcmp($version, "2.1.0") < 0) {
|
||||
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.1.0/airtime-upgrade.php");
|
||||
pause();
|
||||
}
|
||||
if (strcmp($version, "2.1.1") < 0) {
|
||||
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.1.1/airtime-upgrade.php");
|
||||
pause();
|
||||
}
|
||||
if (strcmp($version, "2.1.2") < 0) {
|
||||
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.1.2/airtime-upgrade.php");
|
||||
pause();
|
||||
}
|
||||
if (strcmp($version, "2.1.3") < 0) {
|
||||
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.1.3/airtime-upgrade.php");
|
||||
pause();
|
||||
}
|
||||
if (strcmp($version, "2.2.0") < 0) {
|
||||
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.2.0/airtime-upgrade.php");
|
||||
pause();
|
||||
echo "Unsupported Airtime version. You must upgrade from at least Airtime 2.2.0.".PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
if (strcmp($version, "2.2.1") < 0) {
|
||||
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.2.1/airtime-upgrade.php");
|
||||
|
@ -112,4 +80,8 @@ if (strcmp($version, "2.3.1") < 0) {
|
|||
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.3.1/airtime-upgrade.php");
|
||||
pause();
|
||||
}
|
||||
if (strcmp($version, "2.4.0") < 0) {
|
||||
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.4.0/airtime-upgrade.php");
|
||||
pause();
|
||||
}
|
||||
echo "******************************* Upgrade Complete *******************************".PHP_EOL;
|
||||
|
|
|
@ -1,256 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* These are helper functions that are common to each upgrade such as
|
||||
* creating connections to a database, backing up config files etc.
|
||||
*/
|
||||
class UpgradeCommon{
|
||||
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
|
||||
const CONF_FILE_PYPO = "/etc/airtime/pypo.cfg";
|
||||
const CONF_FILE_RECORDER = "/etc/airtime/recorder.cfg";
|
||||
const CONF_FILE_LIQUIDSOAP = "/etc/airtime/liquidsoap.cfg";
|
||||
const CONF_FILE_MEDIAMONITOR = "/etc/airtime/media-monitor.cfg";
|
||||
const CONF_FILE_API_CLIENT = "/etc/airtime/api_client.cfg";
|
||||
|
||||
const CONF_PYPO_GRP = "pypo";
|
||||
const CONF_WWW_DATA_GRP = "www-data";
|
||||
const CONF_BACKUP_SUFFIX = "201";
|
||||
const VERSION_NUMBER = "2.0.1";
|
||||
|
||||
public static function SetDefaultTimezone()
|
||||
{
|
||||
$sql = "SELECT valstr from cc_pref WHERE keystr = 'timezone'";
|
||||
|
||||
$result = self::queryDb($sql);
|
||||
$timezone = $result->fetchColumn();
|
||||
|
||||
date_default_timezone_set($timezone);
|
||||
}
|
||||
|
||||
public static function connectToDatabase($p_exitOnError = true)
|
||||
{
|
||||
try {
|
||||
$con = Propel::getConnection();
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage().PHP_EOL;
|
||||
echo "Database connection problem.".PHP_EOL;
|
||||
echo "Check if database exists with corresponding permissions.".PHP_EOL;
|
||||
if ($p_exitOnError) {
|
||||
exit(1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static function DbTableExists($p_name)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
try {
|
||||
$sql = "SELECT * FROM ".$p_name." LIMIT 1";
|
||||
$con->query($sql);
|
||||
} catch (PDOException $e){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static function GetAirtimeSrcDir()
|
||||
{
|
||||
return __DIR__."/../../../airtime_mvc";
|
||||
}
|
||||
|
||||
public static function MigrateTablesToVersion($dir, $version)
|
||||
{
|
||||
echo "Upgrading database, may take several minutes, please wait".PHP_EOL;
|
||||
|
||||
$appDir = self::GetAirtimeSrcDir();
|
||||
$command = "php --php-ini $dir/../../airtime-php.ini ".
|
||||
"$appDir/library/doctrine/migrations/doctrine-migrations.phar ".
|
||||
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
|
||||
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
|
||||
"--no-interaction migrations:migrate $version";
|
||||
system($command);
|
||||
}
|
||||
|
||||
public static function BypassMigrations($dir, $version)
|
||||
{
|
||||
$appDir = self::GetAirtimeSrcDir();
|
||||
$command = "php --php-ini $dir/../../airtime-php.ini ".
|
||||
"$appDir/library/doctrine/migrations/doctrine-migrations.phar ".
|
||||
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
|
||||
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
|
||||
"--no-interaction --add migrations:version $version";
|
||||
system($command);
|
||||
}
|
||||
|
||||
public static function upgradeConfigFiles(){
|
||||
|
||||
$configFiles = array(UpgradeCommon::CONF_FILE_AIRTIME,
|
||||
UpgradeCommon::CONF_FILE_PYPO,
|
||||
UpgradeCommon::CONF_FILE_RECORDER,
|
||||
UpgradeCommon::CONF_FILE_LIQUIDSOAP,
|
||||
UpgradeCommon::CONF_FILE_MEDIAMONITOR,
|
||||
UpgradeCommon::CONF_FILE_API_CLIENT);
|
||||
|
||||
// Backup the config files
|
||||
$suffix = date("Ymdhis")."-".UpgradeCommon::VERSION_NUMBER;
|
||||
foreach ($configFiles as $conf) {
|
||||
// do not back up monit cfg
|
||||
if (file_exists($conf)) {
|
||||
echo "Backing up $conf to $conf$suffix.bak".PHP_EOL;
|
||||
//copy($conf, $conf.$suffix.".bak");
|
||||
exec("cp -p $conf $conf$suffix.bak"); //use cli version to preserve file attributes
|
||||
}
|
||||
}
|
||||
|
||||
self::CreateIniFiles(UpgradeCommon::CONF_BACKUP_SUFFIX);
|
||||
self::MergeConfigFiles($configFiles, $suffix);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function creates the /etc/airtime configuration folder
|
||||
* and copies the default config files to it.
|
||||
*/
|
||||
public static function CreateIniFiles($suffix)
|
||||
{
|
||||
if (!file_exists("/etc/airtime/")){
|
||||
if (!mkdir("/etc/airtime/", 0755, true)){
|
||||
echo "Could not create /etc/airtime/ directory. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!copy(__DIR__."/airtime.conf.$suffix", self::CONF_FILE_AIRTIME)){
|
||||
echo "Could not copy airtime.conf to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
if (!copy(__DIR__."/pypo.cfg.$suffix", self::CONF_FILE_PYPO)){
|
||||
echo "Could not copy pypo.cfg to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
if (!copy(__DIR__."/recorder.cfg.$suffix", self::CONF_FILE_RECORDER)){
|
||||
echo "Could not copy recorder.cfg to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
if (!copy(__DIR__."/media-monitor.cfg.$suffix", self::CONF_FILE_MEDIAMONITOR)){
|
||||
echo "Could not copy meadia-monitor.cfg to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
if (!copy(__DIR__."/api_client.cfg.$suffix", self::CONF_FILE_API_CLIENT)){
|
||||
echo "Could not copy api_client.cfg to /etc/monit/conf.d/. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private static function MergeConfigFiles($configFiles, $suffix) {
|
||||
foreach ($configFiles as $conf) {
|
||||
// we want to use new liquidsoap.cfg so don't merge
|
||||
// also for monit
|
||||
if( $conf == self::CONF_FILE_LIQUIDSOAP){
|
||||
continue;
|
||||
}
|
||||
if (file_exists("$conf$suffix.bak")) {
|
||||
|
||||
if($conf === self::CONF_FILE_AIRTIME) {
|
||||
// Parse with sections
|
||||
$newSettings = parse_ini_file($conf, true);
|
||||
$oldSettings = parse_ini_file("$conf$suffix.bak", true);
|
||||
}
|
||||
else {
|
||||
$newSettings = self::ReadPythonConfig($conf);
|
||||
$oldSettings = self::ReadPythonConfig("$conf$suffix.bak");
|
||||
}
|
||||
|
||||
$settings = array_keys($newSettings);
|
||||
|
||||
foreach($settings as $section) {
|
||||
if(isset($oldSettings[$section])) {
|
||||
if(is_array($oldSettings[$section])) {
|
||||
$sectionKeys = array_keys($newSettings[$section]);
|
||||
foreach($sectionKeys as $sectionKey) {
|
||||
// skip airtim_dir as we want to use new value
|
||||
if($sectionKey != "airtime_dir"){
|
||||
if(isset($oldSettings[$section][$sectionKey])) {
|
||||
self::UpdateIniValue($conf, $sectionKey, $oldSettings[$section][$sectionKey]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
self::UpdateIniValue($conf, $section, $oldSettings[$section]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function ReadPythonConfig($p_filename)
|
||||
{
|
||||
$values = array();
|
||||
|
||||
$fh = fopen($p_filename, 'r');
|
||||
|
||||
while(!feof($fh)){
|
||||
$line = fgets($fh);
|
||||
if(substr(trim($line), 0, 1) == '#' || trim($line) == ""){
|
||||
continue;
|
||||
}else{
|
||||
$info = explode('=', $line, 2);
|
||||
$values[trim($info[0])] = trim($info[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function updates an INI style config file.
|
||||
*
|
||||
* A property and the value the property should be changed to are
|
||||
* supplied. If the property is not found, then no changes are made.
|
||||
*
|
||||
* @param string $p_filename
|
||||
* The path the to the file.
|
||||
* @param string $p_property
|
||||
* The property to look for in order to change its value.
|
||||
* @param string $p_value
|
||||
* The value the property should be changed to.
|
||||
*
|
||||
*/
|
||||
private static function UpdateIniValue($p_filename, $p_property, $p_value)
|
||||
{
|
||||
$lines = file($p_filename);
|
||||
$n=count($lines);
|
||||
foreach ($lines as &$line) {
|
||||
if ($line[0] != "#"){
|
||||
$key_value = explode("=", $line);
|
||||
$key = trim($key_value[0]);
|
||||
|
||||
if ($key == $p_property){
|
||||
$line = "$p_property = $p_value".PHP_EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$fp=fopen($p_filename, 'w');
|
||||
for($i=0; $i<$n; $i++){
|
||||
fwrite($fp, $lines[$i]);
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
public static function queryDb($p_sql){
|
||||
$con = Propel::getConnection();
|
||||
|
||||
try {
|
||||
$result = $con->query($p_sql);
|
||||
} catch (Exception $e) {
|
||||
echo "Error executing $p_sql. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
set daemon 10 # Poll at 10 second intervals
|
||||
#set logfile syslog facility log_daemon
|
||||
set logfile /var/log/monit.log
|
||||
|
||||
set httpd port 2812 and use address 127.0.0.1
|
||||
allow localhost
|
||||
allow admin:monit
|
||||
|
||||
check process airtime-playout
|
||||
with pidfile "/var/run/airtime-playout.pid"
|
||||
start program = "/etc/init.d/airtime-playout monit-restart" with timeout 5 seconds
|
||||
stop program = "/etc/init.d/airtime-playout stop"
|
||||
check process airtime-liquidsoap
|
||||
with pidfile "/var/run/airtime-liquidsoap.pid"
|
||||
start program = "/etc/init.d/airtime-playout monit-restart" with timeout 5 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-show-recorder
|
||||
with pidfile "/var/run/airtime-show-recorder.pid"
|
||||
start program = "/etc/init.d/airtime-show-recorder start" with timeout 10 seconds
|
||||
stop program = "/etc/init.d/airtime-show-recorder stop"
|
|
@ -1,83 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Airtime
|
||||
* @subpackage StorageServer
|
||||
* @copyright 2010 Sourcefabric O.P.S.
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
*/
|
||||
|
||||
/*
|
||||
* In the future, most Airtime upgrades will involve just mutating the
|
||||
* data that is stored on the system. For example, The only data
|
||||
* we need to preserve between versions is the database, /etc/airtime, and
|
||||
* /srv/airtime. Everything else is just binary files that can be removed/replaced
|
||||
* with the new version of Airtime. Of course, the data may need to be in a new
|
||||
* format, and that's what this upgrade script will be for.
|
||||
*/
|
||||
|
||||
set_include_path(__DIR__.'/../../../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
|
||||
set_include_path(__DIR__.'/../../../airtime_mvc/application/models' . PATH_SEPARATOR . get_include_path());
|
||||
set_include_path(__DIR__.'/../../../airtime_mvc/application/configs' . PATH_SEPARATOR . get_include_path());
|
||||
//require_once 'conf.php';
|
||||
require_once 'propel/runtime/lib/Propel.php';
|
||||
Propel::init(__DIR__."/propel/airtime-conf.php");
|
||||
|
||||
require_once 'UpgradeCommon.php';
|
||||
|
||||
class AirtimeStorWatchedDirsUpgrade{
|
||||
|
||||
public static function start(){
|
||||
}
|
||||
}
|
||||
|
||||
/* This class deals with any modifications to config files in /etc/airtime
|
||||
* as well as backups. All functions other than start() should be marked
|
||||
* as private. */
|
||||
class AirtimeConfigFileUpgrade{
|
||||
|
||||
public static function start(){
|
||||
echo "* Updating configFiles\n";
|
||||
self::changeConfigFilePermissions();
|
||||
UpgradeCommon::upgradeConfigFiles();
|
||||
}
|
||||
|
||||
/* Re: http://dev.sourcefabric.org/browse/CC-2797
|
||||
* We don't want config files to be world-readable so we
|
||||
* set the strictest permissions possible. */
|
||||
private static function changeConfigFilePermissions(){
|
||||
if (!self::ChangeFileOwnerGroupMod(UpgradeCommon::CONF_FILE_AIRTIME, UpgradeCommon::CONF_WWW_DATA_GRP)){
|
||||
echo "Could not set ownership of api_client.cfg to 'pypo'. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
if (!self::ChangeFileOwnerGroupMod(UpgradeCommon::CONF_FILE_API_CLIENT, UpgradeCommon::CONF_PYPO_GRP)){
|
||||
echo "Could not set ownership of api_client.cfg to 'pypo'. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
if (!self::ChangeFileOwnerGroupMod(UpgradeCommon::CONF_FILE_PYPO, UpgradeCommon::CONF_PYPO_GRP)){
|
||||
echo "Could not set ownership of pypo.cfg to 'pypo'. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
if (!self::ChangeFileOwnerGroupMod(UpgradeCommon::CONF_FILE_RECORDER, UpgradeCommon::CONF_PYPO_GRP)){
|
||||
echo "Could not set ownership of recorder.cfg to 'pypo'. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
if (!self::ChangeFileOwnerGroupMod(UpgradeCommon::CONF_FILE_LIQUIDSOAP, UpgradeCommon::CONF_PYPO_GRP)){
|
||||
echo "Could not set ownership of liquidsoap.cfg to 'pypo'. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
if (!self::ChangeFileOwnerGroupMod(UpgradeCommon::CONF_FILE_MEDIAMONITOR, UpgradeCommon::CONF_PYPO_GRP)){
|
||||
echo "Could not set ownership of media-monitor.cfg to 'pypo'. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private static function ChangeFileOwnerGroupMod($filename, $user){
|
||||
return (chown($filename, $user) &&
|
||||
chgrp($filename, $user) &&
|
||||
chmod($filename, 0640));
|
||||
}
|
||||
}
|
||||
|
||||
UpgradeCommon::connectToDatabase();
|
||||
UpgradeCommon::SetDefaultTimezone();
|
||||
AirtimeConfigFileUpgrade::start();
|
|
@ -1,23 +0,0 @@
|
|||
[database]
|
||||
host = localhost
|
||||
dbname = airtime
|
||||
dbuser = airtime
|
||||
dbpass = airtime
|
||||
|
||||
[rabbitmq]
|
||||
host = 127.0.0.1
|
||||
port = 5672
|
||||
user = guest
|
||||
password = guest
|
||||
vhost = /
|
||||
|
||||
[general]
|
||||
api_key = AAA
|
||||
web_server_user = www-data
|
||||
airtime_dir = /usr/share/airtime/
|
||||
base_url = localhost
|
||||
base_port = 80
|
||||
|
||||
[soundcloud]
|
||||
connection_retries = 3
|
||||
time_between_retries = 60
|
|
@ -1,104 +0,0 @@
|
|||
bin_dir = "/usr/lib/airtime/api_clients"
|
||||
|
||||
#############################
|
||||
## Common
|
||||
#############################
|
||||
|
||||
# Value needed to access the API
|
||||
api_key = 'AAA'
|
||||
|
||||
# Path to the base of the API
|
||||
api_base = 'api'
|
||||
|
||||
# URL to get the version number of the server API
|
||||
version_url = 'version/api_key/%%api_key%%'
|
||||
|
||||
#URL to register a components IP Address with the central web server
|
||||
register_component = 'register-component/format/json/api_key/%%api_key%%/component/%%component%%'
|
||||
|
||||
# Hostname
|
||||
base_url = 'localhost'
|
||||
base_port = 80
|
||||
|
||||
#############################
|
||||
## Config for Media Monitor
|
||||
#############################
|
||||
|
||||
# URL to setup the media monitor
|
||||
media_setup_url = 'media-monitor-setup/format/json/api_key/%%api_key%%'
|
||||
|
||||
# Tell Airtime the file id associated with a show instance.
|
||||
upload_recorded = 'upload-recorded/format/json/api_key/%%api_key%%/fileid/%%fileid%%/showinstanceid/%%showinstanceid%%'
|
||||
|
||||
# URL to tell Airtime to update file's meta data
|
||||
update_media_url = 'reload-metadata/format/json/api_key/%%api_key%%/mode/%%mode%%'
|
||||
|
||||
# URL to tell Airtime we want a listing of all files it knows about
|
||||
list_all_db_files = 'list-all-files/format/json/api_key/%%api_key%%/dir_id/%%dir_id%%'
|
||||
|
||||
# URL to tell Airtime we want a listing of all dirs its watching (including the stor dir)
|
||||
list_all_watched_dirs = 'list-all-watched-dirs/format/json/api_key/%%api_key%%'
|
||||
|
||||
# URL to tell Airtime we want to add watched directory
|
||||
add_watched_dir = 'add-watched-dir/format/json/api_key/%%api_key%%/path/%%path%%'
|
||||
|
||||
# URL to tell Airtime we want to add watched directory
|
||||
remove_watched_dir = 'remove-watched-dir/format/json/api_key/%%api_key%%/path/%%path%%'
|
||||
|
||||
# URL to tell Airtime we want to add watched directory
|
||||
set_storage_dir = 'set-storage-dir/format/json/api_key/%%api_key%%/path/%%path%%'
|
||||
|
||||
# URL to tell Airtime about file system mount change
|
||||
update_fs_mount = 'update-file-system-mount/format/json/api_key/%%api_key%%'
|
||||
|
||||
# URL to tell Airtime about file system mount change
|
||||
handle_watched_dir_missing = 'handle-watched-dir-missing/format/json/api_key/%%api_key%%/dir/%%dir%%'
|
||||
|
||||
#############################
|
||||
## Config for Recorder
|
||||
#############################
|
||||
|
||||
# URL to get the schedule of shows set to record
|
||||
show_schedule_url = 'recorded-shows/format/json/api_key/%%api_key%%'
|
||||
|
||||
# URL to upload the recorded show's file to Airtime
|
||||
upload_file_url = 'upload-file/format/json/api_key/%%api_key%%'
|
||||
|
||||
#number of retries to upload file if connection problem
|
||||
upload_retries = 3
|
||||
|
||||
#time to wait between attempts to upload file if connection problem (in seconds)
|
||||
upload_wait = 60
|
||||
|
||||
################################################################################
|
||||
# Uncomment *one of the sets* of values from the API clients below, and comment
|
||||
# out all the others.
|
||||
################################################################################
|
||||
|
||||
#############################
|
||||
## Config for Pypo
|
||||
#############################
|
||||
|
||||
# Schedule export path.
|
||||
# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm
|
||||
# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm
|
||||
export_url = 'schedule/api_key/%%api_key%%'
|
||||
|
||||
get_media_url = 'get-media/file/%%file%%/api_key/%%api_key%%'
|
||||
|
||||
# Update whether a schedule group has begun playing.
|
||||
update_item_url = 'notify-schedule-group-play/api_key/%%api_key%%/schedule_id/%%schedule_id%%'
|
||||
|
||||
# Update whether an audio clip is currently playing.
|
||||
update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/media_id/%%media_id%%/schedule_id/%%schedule_id%%'
|
||||
|
||||
# ???
|
||||
generate_range_url = 'generate_range_dp.php'
|
||||
|
||||
# URL to tell Airtime we want to get stream setting
|
||||
get_stream_setting = 'get-stream-setting/format/json/api_key/%%api_key%%/'
|
||||
|
||||
#URL to update liquidsoap status
|
||||
update_liquidsoap_status = 'update-liquidsoap-status/format/json/api_key/%%api_key%%/msg/%%msg%%/stream_id/%%stream_id%%/boot_time/%%boot_time%%'
|
||||
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
###########################################
|
||||
# Liquidsoap config file #
|
||||
###########################################
|
||||
|
||||
###########################################
|
||||
# Output settings #
|
||||
###########################################
|
||||
output_sound_device = false
|
||||
output_sound_device_type = "ALSA"
|
||||
s1_output = "icecast"
|
||||
s2_output = "icecast"
|
||||
s3_output = "icecast"
|
||||
|
||||
s1_enable = true
|
||||
s2_enable = false
|
||||
s3_enable = false
|
||||
|
||||
s1_type = "ogg"
|
||||
s2_type = "ogg"
|
||||
s3_type = "mp3"
|
||||
|
||||
s1_bitrate = 128
|
||||
s2_bitrate = 128
|
||||
s3_bitrate = 160
|
||||
|
||||
###########################################
|
||||
# Logging settings #
|
||||
###########################################
|
||||
log_file = "/var/log/airtime/pypo-liquidsoap/<script>.log"
|
||||
#log_level = 3
|
||||
|
||||
###########################################
|
||||
# Icecast Stream settings #
|
||||
###########################################
|
||||
s1_host = "127.0.0.1"
|
||||
s2_host = "127.0.0.1"
|
||||
s3_host = "127.0.0.1"
|
||||
s1_port = 8000
|
||||
s2_port = 8000
|
||||
s3_port = 8000
|
||||
s1_user = ""
|
||||
s2_user = ""
|
||||
s3_user = ""
|
||||
s1_pass = "hackme"
|
||||
s2_pass = "hackme"
|
||||
s3_pass = "hackme"
|
||||
|
||||
# Icecast mountpoint names
|
||||
s1_mount = "airtime_128.ogg"
|
||||
s2_mount = "airtime_128.ogg"
|
||||
s3_mount = "airtime_160.mp3"
|
||||
|
||||
# Webstream metadata settings
|
||||
s1_url = "http://airtime.sourcefabric.org"
|
||||
s2_url = "http://airtime.sourcefabric.org"
|
||||
s3_url = "http://airtime.sourcefabric.org"
|
||||
s1_description = "Airtime Radio! stream1"
|
||||
s2_description = "Airtime Radio! stream2"
|
||||
s3_description = "Airtime Radio! stream3"
|
||||
s1_genre = "genre"
|
||||
s2_genre = "genre"
|
||||
s3_genre = "genre"
|
||||
|
||||
# Audio stream metadata for vorbis/ogg is disabled by default
|
||||
# due to a number of client media players that disconnect
|
||||
# when the metadata changes to a new track. Some versions of
|
||||
# mplayer and VLC have this problem. Enable this option at your
|
||||
# own risk!
|
||||
icecast_vorbis_metadata = false
|
|
@ -1,22 +0,0 @@
|
|||
api_client = "airtime"
|
||||
|
||||
# where the binary files live
|
||||
bin_dir = '/usr/lib/airtime/media-monitor'
|
||||
|
||||
# where the logging files live
|
||||
log_dir = '/var/log/airtime/media-monitor'
|
||||
|
||||
|
||||
############################################
|
||||
# RabbitMQ settings #
|
||||
############################################
|
||||
rabbitmq_host = 'localhost'
|
||||
rabbitmq_user = 'guest'
|
||||
rabbitmq_password = 'guest'
|
||||
rabbitmq_vhost = '/'
|
||||
|
||||
############################################
|
||||
# Media-Monitor preferences #
|
||||
############################################
|
||||
check_filesystem_events = 5 #how long to queue up events performed on the files themselves.
|
||||
check_airtime_events = 30 #how long to queue metadata input from airtime.
|
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
// This file generated by Propel 1.5.2 convert-conf target - with modifications by Martin
|
||||
// from XML runtime conf file /home/naomiaro/dev-campcaster/campcaster/build/runtime-conf.xml
|
||||
|
||||
$ini = parse_ini_file('/etc/airtime/airtime.conf', true);
|
||||
|
||||
$dbhost = $ini['database']['host'];
|
||||
$dbname = $ini['database']['dbname'];
|
||||
$dbuser = $ini['database']['dbuser'];
|
||||
$dbpass = $ini['database']['dbpass'];
|
||||
|
||||
$conf = array (
|
||||
'datasources' =>
|
||||
array (
|
||||
'airtime' =>
|
||||
array (
|
||||
'adapter' => 'pgsql',
|
||||
'connection' =>
|
||||
array (
|
||||
'dsn' => "pgsql:host=$dbhost;port=5432;dbname=$dbname;user=$dbuser;password=$dbpass",
|
||||
),
|
||||
),
|
||||
'default' => 'airtime',
|
||||
),
|
||||
'generator_version' => '1.5.2',
|
||||
);
|
||||
$conf['classmap'] = include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classmap-airtime-conf.php');
|
||||
return $conf;
|
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'cc_access' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package propel.generator.airtime
|
||||
*/
|
||||
class CcAccess extends BaseCcAccess {
|
||||
|
||||
} // CcAccess
|
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'cc_access' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package propel.generator.airtime
|
||||
*/
|
||||
class CcAccessPeer extends BaseCcAccessPeer {
|
||||
|
||||
} // CcAccessPeer
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue