Merge branch 'saas-dev' into saas-temp-testing
This commit is contained in:
commit
8b02002f5e
44 changed files with 883 additions and 220 deletions
|
@ -1453,4 +1453,44 @@ class Application_Model_Preference
|
|||
{
|
||||
return self::getValue("provisioning_status");
|
||||
}
|
||||
|
||||
public static function setTuneinEnabled($value)
|
||||
{
|
||||
self::setValue("tunein_enabled", $value);
|
||||
}
|
||||
|
||||
public static function getTuneinEnabled()
|
||||
{
|
||||
return self::getValue("tunein_enabled");
|
||||
}
|
||||
|
||||
public static function setTuneinPartnerKey($value)
|
||||
{
|
||||
self::setValue("tunein_partner_key", $value);
|
||||
}
|
||||
|
||||
public static function getTuneinPartnerKey()
|
||||
{
|
||||
return self::getValue("tunein_partner_key");
|
||||
}
|
||||
|
||||
public static function setTuneinPartnerId($value)
|
||||
{
|
||||
self::setValue("tunein_partner_id", $value);
|
||||
}
|
||||
|
||||
public static function getTuneinPartnerId()
|
||||
{
|
||||
return self::getValue("tunein_partner_id");
|
||||
}
|
||||
|
||||
public static function setTuneinStationId($value)
|
||||
{
|
||||
self::setValue("tunein_station_id", $value);
|
||||
}
|
||||
|
||||
public static function getTuneinStationId()
|
||||
{
|
||||
return self::getValue("tunein_station_id");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,12 +112,7 @@ class Application_Model_RabbitMq
|
|||
$data['original_filename'] = $originalFilename;
|
||||
$data['callback_url'] = $callbackUrl;
|
||||
$data['api_key'] = $apiKey;
|
||||
// Pass station name to the analyzer so we can set it with the file's
|
||||
// metadata before uploading it to the cloud. This isn't a requirement
|
||||
// for cloud storage, but put there as a safeguard, since all Airtime
|
||||
// Pro stations will share the same bucket.
|
||||
$data['station_domain'] = $stationDomain = Application_Model_Preference::GetStationName();
|
||||
|
||||
|
||||
// We add a prefix to the resource name so files are not all placed
|
||||
// under the root folder. We do this in case we need to restore a
|
||||
// customer's file/s; File restoration is done via the S3 Browser
|
||||
|
|
|
@ -56,6 +56,29 @@ SQL;
|
|||
|
||||
return $real_streams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array with 2 elements: artist and title name of the track that is currently playing.
|
||||
* Elements will be set to null if metadata is not set for those fields.
|
||||
*
|
||||
* Returns null if no track is currently playing.
|
||||
*
|
||||
* Data is based on GetPlayOrderRange() in this class.
|
||||
*/
|
||||
public static function getCurrentPlayingTrack()
|
||||
{
|
||||
$currentScheduleInfo = self::GetPlayOrderRange();
|
||||
if (empty($currentScheduleInfo["tracks"]["current"])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$currentTrackArray = explode(" - ", $currentScheduleInfo["tracks"]["current"]["name"]);
|
||||
$currentTrackMetadata = array(
|
||||
"artist" => empty($currentTrackArray[0]) ? null : urlencode($currentTrackArray[0]),
|
||||
"title" => empty($currentTrackArray[1]) ? null : urlencode($currentTrackArray[1])
|
||||
);
|
||||
return $currentTrackMetadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns data related to the scheduled items.
|
||||
|
|
|
@ -1012,10 +1012,10 @@ class Application_Model_Scheduler
|
|||
*/
|
||||
public function moveItem($selectedItems, $afterItems, $adjustSched = true)
|
||||
{
|
||||
$startProfile = microtime(true);
|
||||
//$startProfile = microtime(true);
|
||||
|
||||
$this->con->beginTransaction();
|
||||
$this->con->useDebug(true);
|
||||
//$this->con->useDebug(true);
|
||||
|
||||
try {
|
||||
|
||||
|
@ -1024,8 +1024,8 @@ class Application_Model_Scheduler
|
|||
$this->validateRequest($afterItems);
|
||||
|
||||
$endProfile = microtime(true);
|
||||
Logging::debug("validating move request took:");
|
||||
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||
//Logging::debug("validating move request took:");
|
||||
//Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||
|
||||
$afterInstance = CcShowInstancesQuery::create()->findPK($afterItems[0]["instance"], $this->con);
|
||||
|
||||
|
@ -1066,18 +1066,18 @@ class Application_Model_Scheduler
|
|||
|
||||
$this->removeGaps($instance, $schedIds);
|
||||
|
||||
$endProfile = microtime(true);
|
||||
Logging::debug("removing gaps from instance $instance:");
|
||||
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||
//$endProfile = microtime(true);
|
||||
//Logging::debug("removing gaps from instance $instance:");
|
||||
//Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||
}
|
||||
|
||||
$startProfile = microtime(true);
|
||||
//$startProfile = microtime(true);
|
||||
|
||||
$this->insertAfter($afterItems, null, $movedData, $adjustSched, true);
|
||||
|
||||
$endProfile = microtime(true);
|
||||
Logging::debug("inserting after removing gaps.");
|
||||
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||
//$endProfile = microtime(true);
|
||||
//Logging::debug("inserting after removing gaps.");
|
||||
//Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||
|
||||
$modified = array_keys($modifiedMap);
|
||||
//need to adjust shows we have moved items from.
|
||||
|
@ -1087,7 +1087,7 @@ class Application_Model_Scheduler
|
|||
$instance->updateScheduleStatus($this->con);
|
||||
}
|
||||
|
||||
$this->con->useDebug(false);
|
||||
//$this->con->useDebug(false);
|
||||
$this->con->commit();
|
||||
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
|
|
|
@ -974,10 +974,7 @@ SQL;
|
|||
foreach ($shows as &$show) {
|
||||
$options = array();
|
||||
|
||||
//only bother calculating percent for week or day view.
|
||||
if (intval($days) <= 7) {
|
||||
$options["percent"] = Application_Model_Show::getPercentScheduled($show["starts"], $show["ends"], $show["time_filled"]);
|
||||
}
|
||||
$options["percent"] = Application_Model_Show::getPercentScheduled($show["starts"], $show["ends"], $show["time_filled"]);
|
||||
|
||||
if (isset($show["parent_starts"])) {
|
||||
$parentStartsDT = new DateTime($show["parent_starts"], $utcTimezone);
|
||||
|
@ -1432,39 +1429,70 @@ SQL;
|
|||
}
|
||||
|
||||
public static function getStartEndCurrentMonthView() {
|
||||
$first_day_of_calendar_month_view = mktime(0, 0, 0, date("n"), 1);
|
||||
$weekStart = Application_Model_Preference::GetWeekStartDay();
|
||||
while (date('w', $first_day_of_calendar_month_view) != $weekStart) {
|
||||
$first_day_of_calendar_month_view -= 60*60*24;
|
||||
}
|
||||
$last_day_of_calendar_view = $first_day_of_calendar_month_view + 3600*24*42;
|
||||
|
||||
$start = new DateTime("@".$first_day_of_calendar_month_view);
|
||||
$end = new DateTime("@".$last_day_of_calendar_view);
|
||||
$utcTimeZone = new DateTimeZone("UTC");
|
||||
|
||||
//We have to get the start of the day in the user's timezone, and then convert that to UTC.
|
||||
$start = new DateTime("first day of this month", new DateTimeZone(Application_Model_Preference::GetUserTimezone()));
|
||||
|
||||
$start->setTimezone($utcTimeZone); //Covert it to UTC.
|
||||
$monthInterval = new DateInterval("P1M");
|
||||
$end = clone($start);
|
||||
$end->add($monthInterval);
|
||||
|
||||
return array($start, $end);
|
||||
}
|
||||
|
||||
/** Returns the start and end date that FullCalendar will display for today's month.
|
||||
*
|
||||
* FullCalendar displays 6 weeks, starting on a Sunday, for a total of 42 days. This function returns 42 days worth
|
||||
* of data (a few days before, and a few days after.)
|
||||
*/
|
||||
public static function getStartEndCurrentMonthPlusView() {
|
||||
|
||||
$utcTimeZone = new DateTimeZone("UTC");
|
||||
|
||||
//We have to get the start of the day in the user's timezone, and then convert that to UTC.
|
||||
$start = new DateTime("first day of this month", new DateTimeZone(Application_Model_Preference::GetUserTimezone()));
|
||||
|
||||
$dayOfWeekNumeric = $start->format('w');
|
||||
$start->sub(new DateInterval("P{$dayOfWeekNumeric}D")); //Subtract the index of the day of the week the month starts on. (adds this many days from the previous month)
|
||||
$start->setTimezone($utcTimeZone); //Covert it to UTC.
|
||||
|
||||
$fullCalendarMonthInterval = new DateInterval("P42D"); //42 days
|
||||
$end = clone($start);
|
||||
$end->add($fullCalendarMonthInterval);
|
||||
|
||||
return array($start, $end);
|
||||
}
|
||||
|
||||
|
||||
public static function getStartEndCurrentWeekView() {
|
||||
$first_day_of_calendar_week_view = mktime(0, 0, 0, date("n"), date("j"));
|
||||
$weekStart = Application_Model_Preference::GetWeekStartDay();
|
||||
while (date('w', $first_day_of_calendar_week_view) != $weekStart) {
|
||||
$first_day_of_calendar_week_view -= 60*60*24;
|
||||
}
|
||||
$last_day_of_calendar_view = $first_day_of_calendar_week_view + 3600*24*7;
|
||||
|
||||
$start = new DateTime("@".$first_day_of_calendar_week_view);
|
||||
$end = new DateTime("@".$last_day_of_calendar_view);
|
||||
$weekStartDayNum = Application_Model_Preference::GetWeekStartDay();
|
||||
$utcTimeZone = new DateTimeZone("UTC");
|
||||
|
||||
//We have to get the start of the week in the user's timezone, and then convert that to UTC.
|
||||
$start = new DateTime("Sunday last week", new DateTimeZone(Application_Model_Preference::GetUserTimezone()));
|
||||
$start->add(new DateInterval("P{$weekStartDayNum}D")); //Shift the start date to the station's "Week Starts on Day"
|
||||
|
||||
$start->setTimezone($utcTimeZone); //Covert it to UTC.
|
||||
$weekInterval = new DateInterval("P1W");
|
||||
$end = clone($start);
|
||||
$end->add($weekInterval);
|
||||
return array($start, $end);
|
||||
}
|
||||
|
||||
public static function getStartEndCurrentDayView() {
|
||||
$today = mktime(0, 0, 0, date("n"), date("j"));
|
||||
$tomorrow = $today + 3600*24;
|
||||
$utcTimeZone = new DateTimeZone("UTC");
|
||||
|
||||
$start = new DateTime("@".$today);
|
||||
$end = new DateTime("@".$tomorrow);
|
||||
//We have to get the start of the day in the user's timezone, and then convert that to UTC.
|
||||
$start = new DateTime("today", new DateTimeZone(Application_Model_Preference::GetUserTimezone()));
|
||||
|
||||
$start->setTimezone($utcTimeZone); //Covert it to UTC.
|
||||
$dayInterval = new DateInterval("P1D");
|
||||
$end = clone($start);
|
||||
$end->add($dayInterval);
|
||||
|
||||
return array($start, $end);
|
||||
}
|
||||
|
|
|
@ -375,7 +375,7 @@ SQL;
|
|||
* Deletes the physical file from the local file system or from the cloud
|
||||
*
|
||||
*/
|
||||
public function delete()
|
||||
public function delete($quiet=false)
|
||||
{
|
||||
// Check if the file is scheduled to be played in the future
|
||||
if (Application_Model_Schedule::IsFileScheduledInTheFuture($this->_file->getCcFileId())) {
|
||||
|
@ -405,8 +405,12 @@ SQL;
|
|||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
//Just log the exception and continue.
|
||||
Logging::error($e);
|
||||
if ($quiet) {
|
||||
Logging::info($e);
|
||||
} else {
|
||||
//Just log the exception and continue.
|
||||
Logging::error($e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue