Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
d7dcd03de5
10 changed files with 59 additions and 34 deletions
|
@ -900,6 +900,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$startParam = $this->_getParam('startTime');
|
$startParam = $this->_getParam('startTime');
|
||||||
$endParam = $this->_getParam('endTime');
|
$endParam = $this->_getParam('endTime');
|
||||||
|
|
||||||
|
try{
|
||||||
$startDateTime = new DateTime($startParam);
|
$startDateTime = new DateTime($startParam);
|
||||||
$endDateTime = new DateTime($endParam);
|
$endDateTime = new DateTime($endParam);
|
||||||
|
|
||||||
|
@ -909,6 +910,9 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$duration = $UTCEndDateTime->diff($UTCStartDateTime);
|
$duration = $UTCEndDateTime->diff($UTCStartDateTime);
|
||||||
|
|
||||||
$result = $duration->format('%r%Hh %Im');
|
$result = $duration->format('%r%Hh %Im');
|
||||||
|
}catch (Exception $e){
|
||||||
|
$result = "Invalid Date";
|
||||||
|
}
|
||||||
|
|
||||||
echo Zend_Json::encode($result);
|
echo Zend_Json::encode($result);
|
||||||
exit();
|
exit();
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
</dt>
|
</dt>
|
||||||
<dd id="add_show_duration-element">
|
<dd id="add_show_duration-element">
|
||||||
<?php echo $this->element->getElement('add_show_duration') ?>
|
<?php echo $this->element->getElement('add_show_duration') ?>
|
||||||
|
<img id="icon-loader-small" src="/css/images/loader-small.gif" style="vertical-align:middle; display:none;"/>
|
||||||
</dd>
|
</dd>
|
||||||
<?php if($this->element->getElement('add_show_duration')->hasErrors()){ ?>
|
<?php if($this->element->getElement('add_show_duration')->hasErrors()){ ?>
|
||||||
<ul class='errors'>
|
<ul class='errors'>
|
||||||
|
|
|
@ -24,9 +24,12 @@
|
||||||
<h3>Source Streams</h3>
|
<h3>Source Streams</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<div id="scheduled_play_div" class="source-label"> Scheduled Play</div>
|
<div id="master_dj_div" class="source-label">
|
||||||
|
<a id="master_dj" class="source-kick-button" onclick="kickSource(this)"></a>
|
||||||
|
Master Source
|
||||||
|
</div>
|
||||||
<div class="line-to-switch"></div>
|
<div class="line-to-switch"></div>
|
||||||
<a href="#" id="scheduled_play" class="source-switch-button" onclick="setSwitchListener(this);"><span><?php echo $this->scheduled_play_switch?></span></a>
|
<a href="#" id="master_dj" class="source-switch-button" onclick="setSwitchListener(this);"><span><?php echo $this->master_dj_switch?></span></a>
|
||||||
<div class="line-to-on-air"></div>
|
<div class="line-to-on-air"></div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
@ -39,12 +42,9 @@
|
||||||
<div class="line-to-on-air"></div>
|
<div class="line-to-on-air"></div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<div id="master_dj_div" class="source-label">
|
<div id="scheduled_play_div" class="source-label"> Scheduled Play</div>
|
||||||
<a id="master_dj" class="source-kick-button" onclick="kickSource(this)"></a>
|
|
||||||
Master Source
|
|
||||||
</div>
|
|
||||||
<div class="line-to-switch"></div>
|
<div class="line-to-switch"></div>
|
||||||
<a href="#" id="master_dj" class="source-switch-button" onclick="setSwitchListener(this);"><span><?php echo $this->master_dj_switch?></span></a>
|
<a href="#" id="scheduled_play" class="source-switch-button" onclick="setSwitchListener(this);"><span><?php echo $this->scheduled_play_switch?></span></a>
|
||||||
<div class="line-to-on-air"></div>
|
<div class="line-to-on-air"></div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
BIN
airtime_mvc/public/css/images/loader-small.gif
Normal file
BIN
airtime_mvc/public/css/images/loader-small.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 673 B |
|
@ -24,6 +24,10 @@ function getDateFromString(time){
|
||||||
var month = parseInt(date[1], 10) -1;
|
var month = parseInt(date[1], 10) -1;
|
||||||
var day = parseInt(date[2], 10);
|
var day = parseInt(date[2], 10);
|
||||||
|
|
||||||
|
if (isNaN(year) || isNaN(month) || isNaN(day)){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return new Date(year, month, day);
|
return new Date(year, month, day);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,11 @@ var live_dj_on_air = false;
|
||||||
var scheduled_play_on_air = false;
|
var scheduled_play_on_air = false;
|
||||||
var scheduled_play_source = false;
|
var scheduled_play_source = false;
|
||||||
|
|
||||||
|
//keep track of how many UI refreshes the ON-AIR light has been off for.
|
||||||
|
//For example, the uiUpdateInterval is every 200ms, so if onAirOffIterations
|
||||||
|
//is 25, then that means 5 seconds have gone by.
|
||||||
|
var onAirOffIterations = 0;
|
||||||
|
|
||||||
//var timezoneOffset = 0;
|
//var timezoneOffset = 0;
|
||||||
|
|
||||||
//set to "development" if we are developing :). Useful to disable alerts
|
//set to "development" if we are developing :). Useful to disable alerts
|
||||||
|
@ -328,6 +333,13 @@ function parseSwitchStatus(obj){
|
||||||
function controlOnAirLight(){
|
function controlOnAirLight(){
|
||||||
if ((scheduled_play_on_air && scheduled_play_source) || live_dj_on_air || master_dj_on_air) {
|
if ((scheduled_play_on_air && scheduled_play_source) || live_dj_on_air || master_dj_on_air) {
|
||||||
$('#on-air-info').attr("class", "on-air-info on");
|
$('#on-air-info').attr("class", "on-air-info on");
|
||||||
|
onAirOffIterations = 0;
|
||||||
|
} else if (onAirOffIterations < 15) {
|
||||||
|
//if less than 3 seconds have gone by (< 15 executions of this function)
|
||||||
|
//then keep the ON-AIR light on. Only after at least 3 seconds have gone by,
|
||||||
|
//should we be allowed to turn it off. This is to stop the light from temporarily turning
|
||||||
|
//off between tracks: CC-3725
|
||||||
|
onAirOffIterations++;
|
||||||
} else {
|
} else {
|
||||||
$('#on-air-info').attr("class", "on-air-info off");
|
$('#on-air-info').attr("class", "on-air-info off");
|
||||||
}
|
}
|
||||||
|
|
|
@ -460,9 +460,12 @@ function setAddShowEvents() {
|
||||||
})
|
})
|
||||||
|
|
||||||
function calculateDuration(endDateTime, startDateTime){
|
function calculateDuration(endDateTime, startDateTime){
|
||||||
var duration;
|
var loadingIcon = $('#icon-loader-small');
|
||||||
|
|
||||||
|
loadingIcon.show();
|
||||||
$.post("/Schedule/calculate-duration", {startTime: startDateTime, endTime: endDateTime}, function(data){
|
$.post("/Schedule/calculate-duration", {startTime: startDateTime, endTime: endDateTime}, function(data){
|
||||||
$('#add_show_duration').val(JSON.parse(data));
|
$('#add_show_duration').val(JSON.parse(data));
|
||||||
|
loadingIcon.hide();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
||||||
. ${virtualenv_bin}activate
|
. ${virtualenv_bin}activate
|
||||||
|
|
||||||
media_monitor_path="/usr/lib/airtime/media-monitor/"
|
media_monitor_path="/usr/lib/airtime/media-monitor/"
|
||||||
media_monitor_script="MediaMonitor.py"
|
media_monitor_script="media_monitor.py"
|
||||||
|
|
||||||
api_client_path="/usr/lib/airtime/"
|
api_client_path="/usr/lib/airtime/"
|
||||||
|
|
||||||
|
|
|
@ -41,12 +41,15 @@ logger.info("\n\n*** Media Monitor bootup ***\n\n")
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
fs_encoding = locale.getdefaultlocale()[1].lower()
|
fs_encoding = locale.getdefaultlocale()[1]
|
||||||
|
if fs_encoding is not None:
|
||||||
if fs_encoding not in ['utf-8', 'utf8']:
|
if fs_encoding not in ['utf-8', 'utf8']:
|
||||||
logger.error("Filesystem encoding needs to be UTF-8. Currently '%s'. Exiting..." % fs_encoding)
|
logger.error("Filesystem encoding needs to be UTF-8. Currently '%s'. Exiting..." % fs_encoding)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
logger.debug("Filesystem encoding: '%s'" % fs_encoding)
|
logger.debug("Filesystem encoding: '%s'" % fs_encoding)
|
||||||
|
else:
|
||||||
|
logger.debug("Unknown encoding")
|
||||||
|
|
||||||
|
|
||||||
config = AirtimeMediaConfig(logger)
|
config = AirtimeMediaConfig(logger)
|
|
@ -73,7 +73,7 @@ class PypoPush(Thread):
|
||||||
if len(current_event_chain) > 0 and len(liquidsoap_queue_approx) == 0:
|
if len(current_event_chain) > 0 and len(liquidsoap_queue_approx) == 0:
|
||||||
#Something is scheduled but Liquidsoap is not playing anything!
|
#Something is scheduled but Liquidsoap is not playing anything!
|
||||||
#Need to schedule it immediately..this might happen if Liquidsoap crashed.
|
#Need to schedule it immediately..this might happen if Liquidsoap crashed.
|
||||||
self.modify_cue_point_of_first_link(current_event_chain)
|
self.modify_cue_point(current_event_chain[0])
|
||||||
next_media_item_chain = current_event_chain
|
next_media_item_chain = current_event_chain
|
||||||
time_until_next_play = 0
|
time_until_next_play = 0
|
||||||
else:
|
else:
|
||||||
|
@ -176,8 +176,11 @@ class PypoPush(Thread):
|
||||||
|
|
||||||
if problem_at_iteration is not None:
|
if problem_at_iteration is not None:
|
||||||
self.logger.debug("Change in chain at link %s", problem_at_iteration)
|
self.logger.debug("Change in chain at link %s", problem_at_iteration)
|
||||||
#self.modify_cue_point_of_first_link(media_chain)
|
|
||||||
self.push_to_liquidsoap(media_chain[problem_at_iteration:])
|
chain_to_push = media_chain[problem_at_iteration:]
|
||||||
|
if len(chain_to_push) > 0:
|
||||||
|
self.modify_cue_point(chain_to_push[0])
|
||||||
|
self.push_to_liquidsoap(chain_to_push)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Compare whats in the liquidsoap_queue to the new schedule we just
|
Compare whats in the liquidsoap_queue to the new schedule we just
|
||||||
|
@ -246,23 +249,18 @@ class PypoPush(Thread):
|
||||||
|
|
||||||
return chains
|
return chains
|
||||||
|
|
||||||
def modify_cue_point_of_first_link(self, chain):
|
def modify_cue_point(self, link):
|
||||||
tnow = datetime.utcnow()
|
tnow = datetime.utcnow()
|
||||||
link = chain[0]
|
|
||||||
|
|
||||||
link_start = datetime.strptime(link['start'], "%Y-%m-%d-%H-%M-%S")
|
link_start = datetime.strptime(link['start'], "%Y-%m-%d-%H-%M-%S")
|
||||||
|
|
||||||
diff_td = tnow - link_start
|
diff_td = tnow - link_start
|
||||||
diff_sec = self.convert_timedelta_to_seconds(diff_td)
|
diff_sec = self.date_interval_to_seconds(diff_td)
|
||||||
|
|
||||||
if diff_sec > 0:
|
if diff_sec > 0:
|
||||||
self.logger.debug("media item was supposed to start %s ago. Preparing to start..", diff_sec)
|
self.logger.debug("media item was supposed to start %s ago. Preparing to start..", diff_sec)
|
||||||
original_cue_in_td = timedelta(seconds=float(link['cue_in']))
|
original_cue_in_td = timedelta(seconds=float(link['cue_in']))
|
||||||
link['cue_in'] = self.convert_timedelta_to_seconds(original_cue_in_td) + diff_sec
|
link['cue_in'] = self.date_interval_to_seconds(original_cue_in_td) + diff_sec
|
||||||
|
|
||||||
|
|
||||||
def convert_timedelta_to_seconds(self, td):
|
|
||||||
return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
|
|
||||||
|
|
||||||
|
|
||||||
def get_current_chain(self, chains):
|
def get_current_chain(self, chains):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue