Merge branch '2.1.x' into devel

This commit is contained in:
denise 2012-06-11 15:10:33 -04:00
commit d498c51814
14 changed files with 118 additions and 55 deletions

View file

@ -53,7 +53,7 @@ class DashboardController extends Zend_Controller_Action
$show_id = isset($show[0]['id'])?$show[0]['id']:0;
$source_connected = Application_Model_Preference::GetSourceStatus($sourcename);
if($user->canSchedule($show_id) && ($source_connected || $sourcename == 'scheduled_play')){
if($user->canSchedule($show_id) && ($source_connected || $sourcename == 'scheduled_play' || $current_status == "on")){
$change_status_to = "on";

View file

@ -12,7 +12,7 @@ class Application_Model_Schedule {
global $CC_CONFIG;
$con = Propel::getConnection();
$sql = "SELECT COUNT(*) FROM ".$CC_CONFIG["scheduleTable"]
." WHERE file_id = {$p_fileId} AND starts > NOW()";
." WHERE file_id = {$p_fileId} AND ends > NOW() AT TIME ZONE 'UTC'";
$count = $con->query($sql)->fetchColumn(0);
if (is_numeric($count) && ($count != '0')) {
return TRUE;

View file

@ -1061,7 +1061,7 @@ class Application_Model_Show {
//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) && $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();
@ -1310,6 +1310,7 @@ class Application_Model_Show {
if ($ccShowInstance->getDbModifiedInstance()){
//show instance on this date has been deleted.
$utcStartDateTime = self::advanceRepeatingDate($p_interval, $start, $timezone);
continue;
}
@ -1342,7 +1343,14 @@ class Application_Model_Show {
$showInstance->deleteRebroadcasts();
self::createRebroadcastInstances($rebroadcasts, $currentUtcTimestamp, $show_id, $show_instance_id, $start, $duration, $timezone);
$utcStartDateTime = self::advanceRepeatingDate($p_interval, $start, $timezone);
}
Application_Model_Show::setNextPop($start, $show_id, $day);
}
private static function advanceRepeatingDate($p_interval, $start, $timezone){
if ($p_interval == 'P1M'){
/* When adding months, there is a problem if we are on January 31st and add one month with PHP.
* What ends up happening is that since February 31st doesn't exist, the date returned is
@ -1351,11 +1359,11 @@ class Application_Model_Show {
* over the years 2011->2012, etc.). Then let's append the actual day, and use the php
* checkdate() function, to see if it is valid. If not, then we'll just skip this month. */
$startDt = new DateTime($start, new DateTimeZone($timezone));
/* pass in only the year and month (not the day) */
$dt = new DateTime($startDt->format("Y-m"), new DateTimeZone($timezone));
$dt = new DateTime($startDt->format("Y-m"), new DateTimeZone($timezone));
/* Keep adding 1 month, until we find the next month that contains the day
* we are looking for (31st day for example) */
do {
@ -1375,10 +1383,7 @@ class Application_Model_Show {
$dt->setTimezone(new DateTimeZone('UTC'));
$utcStartDateTime = $dt;
}
}
Application_Model_Show::setNextPop($start, $show_id, $day);
return $utcStartDateTime;
}
/*
@ -1477,7 +1482,6 @@ class Application_Model_Show {
//UTC DateTime object
$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);
@ -1492,7 +1496,6 @@ class Application_Model_Show {
LEFT JOIN cc_show_instances AS si2 ON si1.instance_id = si2.id
LEFT JOIN cc_show AS show ON show.id = si1.show_id
WHERE si1.modified_instance = FALSE";
//only want shows that are starting at the time or later.
$start_string = $start_timestamp->format("Y-m-d H:i:s");
$end_string = $end_timestamp->format("Y-m-d H:i:s");
@ -1563,7 +1566,6 @@ class Application_Model_Show {
//Logging::log($sql);
$res = $con->query($sql)->fetchAll();
foreach ($res as $row) {
Application_Model_Show::populateShow($row, $p_endTimestamp);
}

View file

@ -161,7 +161,11 @@ class CcShowInstances extends BaseCcShowInstances {
*/
public function updateDbTimeFilled(PropelPDO $con)
{
$this->setDbTimeFilled($this->computeDbTimeFilled($con));
$timefilled = $this->computeDbTimeFilled($con);
if($timefilled == null){
$timefilled = "00:00:00";
}
$this->setDbTimeFilled($timefilled);
$this->save($con);
}

View file

@ -21,6 +21,7 @@
<div id="custom_auth_div">
<dt id="custom_username-label" class="block-display">
<label class="optional" for="custom_username"><?php echo $this->element->getElement('custom_username')->getLabel() ?> :
<span class='stream_username_help_icon'></span>
</label>
</dt>
<dd id="custom_username-element" class="block-display">

View file

@ -33,6 +33,7 @@
</dd>
<dt id="master_username-label">
<label class="optional" for="master_username"><?php echo $this->element->getElement('master_username')->getLabel() ?> :
<span class='stream_username_help_icon'></span>
</label>
</dt>
<dd id="master_username-element">

View file

@ -68,7 +68,9 @@
</legend>
<dl class="zend_form">
<dt id="outputUser-label">
<label for="outputUser"><?php echo $this->element->getElement('user')->getLabel()?> :</label>
<label for="outputUser"><?php echo $this->element->getElement('user')->getLabel()?> :
<span class='stream_username_help_icon'></span>
</label>
</dt>
<dd id="outputUser-element">
<?php echo $this->element->getElement('user')?>

View file

@ -104,7 +104,7 @@ select {
line-height:16px !important;
}
.airtime_auth_help_icon, .custom_auth_help_icon {
.airtime_auth_help_icon, .custom_auth_help_icon, .stream_username_help_icon {
cursor: help;
position: relative;
display:inline-block; zoom:1;

View file

@ -304,4 +304,25 @@ $(document).ready(function() {
at: "right center"
},
})
$(".stream_username_help_icon").qtip({
content: {
text: "If your live streaming client does not ask for a username, this field should be 'source'."
},
hide: {
delay: 500,
fixed: true
},
style: {
border: {
width: 0,
radius: 4
},
classes: "ui-tooltip-dark ui-tooltip-rounded"
},
position: {
my: "left bottom",
at: "right center"
},
})
});

View file

@ -220,6 +220,26 @@ function setAddShowEvents() {
at: "right center"
}
});
form.find(".stream_username_help_icon").qtip({
content: {
text: "If your live streaming client does not ask for a username, this field should be 'source'."
},
hide: {
delay: 500,
fixed: true
},
style: {
border: {
width: 0,
radius: 4
},
classes: "ui-tooltip-dark ui-tooltip-rounded"
},
position: {
my: "left bottom",
at: "right center"
}
});
function endDateVisibility(){
if(form.find("#add_show_no_end").is(':checked')){

View file

@ -91,16 +91,15 @@ denise@denise-DX4860:~/airtime/airtime_mvc/public/js/fullcalendar$ diff -u fullc
clearEvents();
}
- updateCells(firstTime);
+ getOffset();
+ getOffset(firstTime);
}
-
-
+ function getOffset() {
+ function getOffset(firstTime) {
+ var timezoneOffset;
+ $.ajax({ url: "/Api/calendar-init/format/json", dataType:"json", success:function(data) {
+ timezoneOffset = data.calendarInit.timezoneOffset*1000;
+ var firstTime = !body;
+ updateCells(firstTime, timezoneOffset);
+ }, error:function(jqXHR, textStatus, errorThrown){}});
+ }

View file

@ -2187,14 +2187,13 @@ function BasicView(element, calendar, viewName) {
}else{
clearEvents();
}
getOffset();
getOffset(firstTime);
}
function getOffset() {
function getOffset(firstTime) {
var timezoneOffset;
$.ajax({ url: "/Api/calendar-init/format/json", dataType:"json", success:function(data) {
timezoneOffset = data.calendarInit.timezoneOffset*1000;
var firstTime = !body;
updateCells(firstTime, timezoneOffset);
}, error:function(jqXHR, textStatus, errorThrown){}});
}

View file

@ -35,7 +35,7 @@ class MediaMonitorCommon:
# if file doesn't have any extension, info[-2] throws exception
# Hence, checking length of info before we do anything
if(len(info) >= 2):
if(info[-2] in self.supported_file_formats):
if(info[-2].lower() in self.supported_file_formats):
return True
else:
return False
@ -45,7 +45,7 @@ class MediaMonitorCommon:
def is_audio_file(self, filename):
info = filename.split(".")
if(info[-1] in self.supported_file_formats):
if(info[-1].lower() in self.supported_file_formats):
return True
else:
return False

View file

@ -42,6 +42,8 @@ class PypoFetch(Thread):
self.fetch_queue = pypoFetch_q
self.push_queue = pypoPush_q
self.media_prepare_queue = media_q
self.last_update_schedule_timestamp = time.time()
self.listener_timeout = 3600
self.telnet_lock = telnet_lock
@ -78,6 +80,7 @@ class PypoFetch(Thread):
self.logger.info("Handling command: " + command)
if command == 'update_schedule':
self.last_update_schedule_timestamp = time.time()
self.schedule_data = m['schedule']
self.process_schedule(self.schedule_data)
elif command == 'update_stream_setting':
@ -98,6 +101,15 @@ class PypoFetch(Thread):
elif command == 'disconnect_source':
self.logger.info("disconnect_on_source show command received...")
self.disconnect_source(self.logger, self.telnet_lock, m['sourcename'])
# update timeout value
if command == 'update_schedule':
self.listener_timeout = 3600
else:
self.listener_timeout = self.last_update_schedule_timestamp - time.time() + 3600
if self.listener_timeout < 0:
self.listener_timeout = 0
self.logger.info("New timeout: %s" % self.listener_timeout)
except Exception, e:
import traceback
top = traceback.format_exc()
@ -476,7 +488,9 @@ class PypoFetch(Thread):
Currently we are checking every 3600 seconds (1 hour)
"""
message = self.fetch_queue.get(block=True, timeout=3600)
message = self.fetch_queue.get(block=True, timeout=self.listener_timeout)
self.handle_message(message)
except Exception, e:
import traceback