Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
denise 2012-09-04 16:59:40 -04:00
commit 63bd2f6381
7 changed files with 78 additions and 70 deletions

View File

@ -356,9 +356,9 @@ SQL;
." SET media_item_played=TRUE";
// we need to update 'broadcasted' column as well
// check the current switch status
$live_dj = Application_Model_Preference::GetSourceSwitchStatus('live_dj') == 'on'?true:false;
$master_dj = Application_Model_Preference::GetSourceSwitchStatus('master_dj') == 'on'?true:false;
$scheduled_play = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play') == 'on'?true:false;
$live_dj = Application_Model_Preference::GetSourceSwitchStatus('live_dj') == 'on';
$master_dj = Application_Model_Preference::GetSourceSwitchStatus('master_dj') == 'on';
$scheduled_play = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play') == 'on';
if (!$live_dj && !$master_dj && $scheduled_play) {
$sql .= ", broadcasted=1";
@ -616,23 +616,23 @@ SQL;
$temp = explode('.', Application_Model_Preference::GetDefaultTransitionFade());
// we round down transition time since PHP cannot handle millisecond. We need to
// handle this better in the future
$transition_time = intval($temp[0]);
$transition_time = intval($temp[0]);
$switchOffDataTime = new DateTime($kick_time, $utcTimeZone);
$switch_off_time = $switchOffDataTime->sub(new DateInterval('PT'.$transition_time.'S'));
$switch_off_time = $switch_off_time->format("Y-m-d H:i:s");
$switch_off_time = $switchOffDataTime->sub(new DateInterval('PT'.$transition_time.'S'));
$switch_off_time = $switch_off_time->format("Y-m-d H:i:s");
$kick_start = Application_Model_Schedule::AirtimeTimeToPypoTime($kick_time);
$data["media"][$kick_start]['start'] = $kick_start;
$data["media"][$kick_start]['end'] = $kick_start;
$data["media"][$kick_start]['event_type'] = "kick_out";
$data["media"][$kick_start]['type'] = "event";
$data["media"][$kick_start]['start'] = $kick_start;
$data["media"][$kick_start]['end'] = $kick_start;
$data["media"][$kick_start]['event_type'] = "kick_out";
$data["media"][$kick_start]['type'] = "event";
$data["media"][$kick_start]['independent_event'] = true;
if ($kick_time !== $switch_off_time) {
$switch_start = Application_Model_Schedule::AirtimeTimeToPypoTime($switch_off_time);
$data["media"][$switch_start]['start'] = $switch_start;
$data["media"][$switch_start]['end'] = $switch_start;
$data["media"][$switch_start]['event_type'] = "switch_off";
$data["media"][$switch_start]['start'] = $switch_start;
$data["media"][$switch_start]['end'] = $switch_start;
$data["media"][$switch_start]['event_type'] = "switch_off";
$data["media"][$switch_start]['independent_event'] = true;
}
}
@ -757,12 +757,12 @@ SQL;
{
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$formWhat = new Application_Form_AddShowWhat();
$formWho = new Application_Form_AddShowWho();
$formWhen = new Application_Form_AddShowWhen();
$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();
$formStyle = new Application_Form_AddShowStyle();
$formLive = new Application_Form_AddShowLiveStream();
$formWhat->removeDecorator('DtDdWrapper');
$formWho->removeDecorator('DtDdWrapper');
@ -813,12 +813,12 @@ SQL;
{
$isSaas = (Application_Model_Preference::GetPlanLevel() != 'disabled');
$formWhat = new Application_Form_AddShowWhat();
$formWhen = new Application_Form_AddShowWhen();
$formWhat = new Application_Form_AddShowWhat();
$formWhen = new Application_Form_AddShowWhen();
$formRepeats = new Application_Form_AddShowRepeats();
$formWho = new Application_Form_AddShowWho();
$formStyle = new Application_Form_AddShowStyle();
$formLive = new Application_Form_AddShowLiveStream();
$formWho = new Application_Form_AddShowWho();
$formStyle = new Application_Form_AddShowStyle();
$formLive = new Application_Form_AddShowLiveStream();
$formWhat->removeDecorator('DtDdWrapper');
$formWhen->removeDecorator('DtDdWrapper');
@ -898,12 +898,12 @@ SQL;
$isSaas = (Application_Model_Preference::GetPlanLevel() != 'disabled');
$record = false;
$formWhat = new Application_Form_AddShowWhat();
$formWho = new Application_Form_AddShowWho();
$formWhen = new Application_Form_AddShowWhen();
$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();
$formStyle = new Application_Form_AddShowStyle();
$formLive = new Application_Form_AddShowLiveStream();
$formWhat->removeDecorator('DtDdWrapper');
$formWho->removeDecorator('DtDdWrapper');

View File

@ -475,10 +475,9 @@ class Application_Model_Show
->filterByDbShowId($this->_showId)
->findOne();
if (!is_null($showDaysRow)) {
if (!is_null($showDaysRow))
return $showDaysRow->getDbRepeatType();
} else
else
return -1;
}
@ -607,31 +606,36 @@ class Application_Model_Show
* Get the start date of the current show in UTC timezone.
*
* @return string
* The start date in the format YYYY-MM-DD
* The start date in the format YYYY-MM-DD or empty string in case
* start date could not be found
*/
public function getStartDateAndTime()
{
$con = Propel::getConnection();
$showId = $this->getId();
$sql = "SELECT first_show, start_time, timezone FROM cc_show_days"
." WHERE show_id = $showId"
$stmt = $con->prepare(
"SELECT first_show, start_time, timezone FROM cc_show_days"
." WHERE show_id = :showId"
." ORDER BY first_show"
." LIMIT 1";
." LIMIT 1");
$query = $con->query($sql);
$stmt->bindParam(':showId', $showId);
$stmt->execute();
if ($query->rowCount() == 0) {
//$query = $con->query($sql);
if (!$stmt) {
return "";
} else {
$rows = $query->fetchAll();
$row = $rows[0];
$dt = new DateTime($row["first_show"]." ".$row["start_time"], new DateTimeZone($row["timezone"]));
$dt->setTimezone(new DateTimeZone("UTC"));
return $dt->format("Y-m-d H:i");
}
$rows = $stmt->fetchAll();
$row = $rows[0];
$dt = new DateTime($row["first_show"]." ".$row["start_time"], new DateTimeZone($row["timezone"]));
$dt->setTimezone(new DateTimeZone("UTC"));
return $dt->format("Y-m-d H:i");
}
/**
@ -670,12 +674,12 @@ class Application_Model_Show
*/
public function getEndDate()
{
$startDate = $this->getStartDate();
$startTime = $this->getStartTime();
$duration = $this->getDuration();
$startDate = $this->getStartDate();
$startTime = $this->getStartTime();
$duration = $this->getDuration();
$startDateTime = new DateTime($startDate.' '.$startTime);
$duration = explode(":", $duration);
$duration = explode(":", $duration);
$endDate = $startDateTime->add(new DateInterval('PT'.$duration[0].'H'.$duration[1].'M'));
@ -877,7 +881,7 @@ class Application_Model_Show
$ccShow = CcShowQuery::create()->findPK($this->_showId);
$info['custom_username'] = $ccShow->getDbLiveStreamUser();
$info['cb_airtime_auth'] = $ccShow->getDbLiveStreamUsingAirtimeAuth();
$info['cb_custom_auth'] = $ccShow->getDbLiveStreamUsingCustomAuth();
$info['cb_custom_auth'] = $ccShow->getDbLiveStreamUsingCustomAuth();
$info['custom_username'] = $ccShow->getDbLiveStreamUser();
$info['custom_password'] = $ccShow->getDbLiveStreamPass();
@ -1064,8 +1068,8 @@ class Application_Model_Show
$ccShow->setDbGenre($data['add_show_genre']);
$ccShow->setDbColor($data['add_show_color']);
$ccShow->setDbBackgroundColor($data['add_show_background_color']);
$ccShow->setDbLiveStreamUsingAirtimeAuth($data['cb_airtime_auth'] == 1?true:false);
$ccShow->setDbLiveStreamUsingCustomAuth($data['cb_custom_auth'] == 1?true:false);
$ccShow->setDbLiveStreamUsingAirtimeAuth($data['cb_airtime_auth'] == 1);
$ccShow->setDbLiveStreamUsingCustomAuth($data['cb_custom_auth'] == 1);
$ccShow->setDbLiveStreamUser($data['custom_username']);
$ccShow->setDbLiveStreamPass($data['custom_password']);
$ccShow->save();
@ -1250,6 +1254,8 @@ class Application_Model_Show
*/
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
if ($p_showDaysRow["repeat_type"] == -1) {
Application_Model_Show::populateNonRepeatingShow($p_showDaysRow, $p_populateUntilDateTime);
} elseif ($p_showDaysRow["repeat_type"] == 0) {
@ -1730,17 +1736,18 @@ class Application_Model_Show
{
$event = array();
$event["id"] = intval($show["instance_id"]);
$event["title"] = $show["name"];
$event["start"] = $startDateTime->format("Y-m-d H:i:s");
$event["startUnix"] = $startsEpoch;
$event["end"] = $endDateTime->format("Y-m-d H:i:s");
$event["endUnix"] = $endsEpoch;
$event["allDay"] = false;
$event["showId"] = intval($show["show_id"]);
$event["record"] = intval($show["record"]);
$event["rebroadcast"] = intval($show["rebroadcast"]);
$event["soundcloud_id"] = is_null($show["soundcloud_id"]) ? -1 : $show["soundcloud_id"];
$event["id"] = intval($show["instance_id"]);
$event["title"] = $show["name"];
$event["start"] = $startDateTime->format("Y-m-d H:i:s");
$event["startUnix"] = $startsEpoch;
$event["end"] = $endDateTime->format("Y-m-d H:i:s");
$event["endUnix"] = $endsEpoch;
$event["allDay"] = false;
$event["showId"] = intval($show["show_id"]);
$event["record"] = intval($show["record"]);
$event["rebroadcast"] = intval($show["rebroadcast"]);
$event["soundcloud_id"] = is_null($show["soundcloud_id"])
? -1 : $show["soundcloud_id"];
//event colouring
if ($show["color"] != "") {

View File

@ -175,15 +175,13 @@ class Application_Model_StreamSetting
*/
public static function setStreamSetting($data)
{
$con = Propel::getConnection();
foreach ($data as $key => $d) {
if ($key == "output_sound_device" || $key == "icecast_vorbis_metadata") {
$v = $d == 1?"true":"false";
$v = ($d == 1) ? "true" : "false";
self::saveStreamSetting($key, $v);
} elseif ($key == "output_sound_device_type") {
self::saveStreamSetting($key, $v);
self::saveStreamSetting($key, $d);
} elseif (is_array($d)) {
$temp = explode('_', $key);
$prefix = $temp[0];

View File

@ -168,6 +168,9 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
if ($result == 0) {
$valid['url'][0] = false;
$valid['url'][1] = 'URL should be of form "http://domain"';
} elseif (strlen($url) > 512) {
$valid['url'][0] = false;
$valid['url'][1] = 'URL should be 512 characters or less';
} else {
try {

View File

@ -4,7 +4,7 @@
<p>Here's how you can get started using Airtime to automate your broadcasts: </p>
<ol>
<li>Add your files to the library using the "Add Media" button. You can drag and drop your files to this window too.</li>
<li>Begin by adding your files to the library using the "Add Media" menu button. You can drag and drop your files to this window too.</li>
<li>Create a show by going to "Calendar" in the menu bar, and then clicking the "+ Show" icon. This can be either a one-time or repeating show. Only admins and program managers can add shows.</li>
<li>Add media to the show by going to your show in the Schedule calendar, left-clicking on it and selecting "Add / Remove Content".</li>
<li>Select your media from the left pane and drag them to your show in the right pane.</li>

View File

@ -420,7 +420,7 @@
<column name="name" phpName="DbName" type="VARCHAR" size="255" required="true" />
<!-- TODO, remove hardlimit on this column length? -->
<column name="description" phpName="DbDescription" type="VARCHAR" size="255" required="true" />
<column name="url" phpName="DbUrl" type="VARCHAR" size="255" required="true" />
<column name="url" phpName="DbUrl" type="VARCHAR" size="512" required="true" />
<column name="length" phpName="DbLength" type="VARCHAR" sqlType="interval" required="true" defaultValue="00:00:00"/>
<column name="creator_id" phpName="DbCreatorId" type="INTEGER" required="true" />
<column name="mtime" phpName="DbMtime" type="TIMESTAMP" size="6" required="true" />

View File

@ -95,7 +95,7 @@ CREATE TABLE cc_webstream (
id integer DEFAULT nextval('cc_webstream_id_seq'::regclass) NOT NULL,
name character varying(255) NOT NULL,
description character varying(255) NOT NULL,
url character varying(255) NOT NULL,
url character varying(512) NOT NULL,
length interval DEFAULT '00:00:00'::interval NOT NULL,
creator_id integer NOT NULL,
mtime timestamp(6) without time zone NOT NULL,