Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
b69f3288d3
|
@ -783,6 +783,8 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$data['add_show_instance_id']);
|
||||
|
||||
if ($success) {
|
||||
$scheduler = new Application_Model_Scheduler();
|
||||
$scheduler->removeGaps($data['add_show_instance_id']);
|
||||
$this->view->addNewShow = true;
|
||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||
} else {
|
||||
|
|
|
@ -1291,6 +1291,10 @@ SQL;
|
|||
} else {
|
||||
$qry->add($spCriteria, $spCriteriaValue, $spCriteriaModifier);
|
||||
}
|
||||
|
||||
if ($spCriteriaModifier == Criteria::NOT_ILIKE || $spCriteriaModifier == Criteria::NOT_EQUAL) {
|
||||
$qry->addOr($spCriteria, null, Criteria::ISNULL);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
Logging::info($e);
|
||||
}
|
||||
|
|
|
@ -331,7 +331,7 @@ class Application_Model_Scheduler
|
|||
* This function squeezes all items of a show together so that
|
||||
* there are no gaps between them.
|
||||
*/
|
||||
private function removeGaps($showInstance, $exclude=null)
|
||||
public function removeGaps($showInstance, $exclude=null)
|
||||
{
|
||||
Logging::info("removing gaps from show instance #".$showInstance);
|
||||
|
||||
|
|
|
@ -187,12 +187,12 @@ SQL;
|
|||
if ($diff != 0) {
|
||||
$sql = <<<SQL
|
||||
UPDATE cc_schedule
|
||||
SET starts = starts + INTERVAL :diff1 SECOND,
|
||||
ends = ends + INTERVAL :diff2 SECOND
|
||||
SET starts = starts + :diff1::INTERVAL SECOND,
|
||||
ends = ends + :diff2::INTERVAL SECOND
|
||||
WHERE instance_id = :instanceId
|
||||
SQL;
|
||||
Application_Common_Database::prepareAndExecute($sql,
|
||||
array(
|
||||
array(
|
||||
':diff1' => $diff,
|
||||
':diff2' => $diff,
|
||||
':instanceId' => $instance_id ), 'execute');
|
||||
|
@ -345,7 +345,7 @@ SQL;
|
|||
//$sql = "SELECT timestamp '{$ends}' + interval '{$deltaDay} days' + interval '{$hours}:{$mins}'";
|
||||
$sql = "SELECT timestamp :ends + interval :deltaDays + interval :deltaTime";
|
||||
|
||||
$now_ends = Application_Common_Database::prepareAndExecute($sql,
|
||||
$now_ends = Application_Common_Database::prepareAndExecute($sql,
|
||||
array(':ends' => $ends,
|
||||
':deltaDays' => "$deltaDay days",
|
||||
':deltaTime' => "{$hours}:{$mins}"), 'column'
|
||||
|
@ -765,7 +765,7 @@ WHERE si.ends < :timeNow::TIMESTAMP
|
|||
AND si.modified_instance = 'f'
|
||||
ORDER BY si.ends DESC LIMIT 1;
|
||||
SQL;
|
||||
$id = Application_Common_Database( $sql, array(
|
||||
$id = Application_Common_Database( $sql, array(
|
||||
':timeNow' => $p_timeNow ), 'column' );
|
||||
|
||||
return ($id ? new Application_Model_ShowInstance($id) : null );
|
||||
|
@ -818,7 +818,7 @@ SELECT count(*) AS cnt
|
|||
FROM cc_show_instances
|
||||
WHERE ends < :day
|
||||
SQL;
|
||||
return Application_Common_Database::prepareAndExecute( $sql,
|
||||
return Application_Common_Database::prepareAndExecute( $sql,
|
||||
array( ':day' => $day ), 'column' );
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
define('UTYPE_HOST', 'H');
|
||||
define('UTYPE_ADMIN', 'A');
|
||||
define('UTYPE_GUEST', 'G');
|
||||
define('UTYPE_PROGRAM_MANAGER', 'P');
|
||||
define('UTYPE_HOST' , 'H');
|
||||
define('UTYPE_ADMIN' , 'A');
|
||||
define('UTYPE_GUEST' , 'G');
|
||||
define('UTYPE_PROGRAM_MANAGER' , 'P');
|
||||
|
||||
class Application_Model_User
|
||||
{
|
||||
|
|
|
@ -17,12 +17,12 @@ class BitrateFormatter
|
|||
|
||||
public function format()
|
||||
{
|
||||
$Kbps = bcdiv($this->_bitrate, 1000, 0);
|
||||
$kbps = bcdiv($this->_bitrate, 1000, 0);
|
||||
|
||||
if ($Kbps == 0) {
|
||||
if ($kbps == 0) {
|
||||
return "";
|
||||
} else {
|
||||
return "{$Kbps} Kbps";
|
||||
return "$kbps Kbps";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -366,7 +366,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
//and verify whether they can be previewed by the browser or not. If not
|
||||
//then the playlist element is greyed out
|
||||
mod.validatePlaylistElements = function(){
|
||||
$.each($(".big_play"), function(index, value){
|
||||
$.each($(".big_play ui-icon-play"), function(index, value){
|
||||
if ($(value).attr('blockId') === undefined) {
|
||||
var mime = $(value).attr("data-mime-type");
|
||||
if (isAudioSupported(mime)) {
|
||||
|
|
|
@ -15,9 +15,10 @@ $(document).ready(function(){
|
|||
close: doNotShowPopup,
|
||||
buttons: [
|
||||
{
|
||||
id: "remind_me",
|
||||
text: "Remind me in 1 week",
|
||||
click: function() {
|
||||
id: "remind_me",
|
||||
text: "Remind me in 1 week",
|
||||
"class": "btn",
|
||||
click: function() {
|
||||
var url = '/Usersettings/remindme';
|
||||
$.ajax({
|
||||
url: url,
|
||||
|
@ -29,6 +30,7 @@ $(document).ready(function(){
|
|||
{
|
||||
id: "remind_never",
|
||||
text: "Remind me never",
|
||||
"class": "btn",
|
||||
click: function() {
|
||||
var url ='/Usersettings/remindme-never';
|
||||
$.ajax({
|
||||
|
@ -41,6 +43,7 @@ $(document).ready(function(){
|
|||
{
|
||||
id: "help_airtime",
|
||||
text: "Yes, help Airtime",
|
||||
"class": "btn",
|
||||
click: function() {
|
||||
$("#register-form").submit();
|
||||
}
|
||||
|
|
|
@ -255,8 +255,8 @@ function eventRender(event, element, view) {
|
|||
}
|
||||
|
||||
//add scheduled show content empty icon
|
||||
addIcon = checkEmptyShowStatus(event);
|
||||
if (!addIcon) {
|
||||
//addIcon = checkEmptyShowStatus(event);
|
||||
//if (!addIcon) {
|
||||
if (view.name === 'agendaDay' || view.name === 'agendaWeek') {
|
||||
if (event.show_empty === 1 && event.record === 0 && event.rebroadcast === 0) {
|
||||
if (event.soundcloud_id === -1) {
|
||||
|
@ -282,7 +282,7 @@ function eventRender(event, element, view) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
//rebroadcast icon
|
||||
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.rebroadcast === 1) {
|
||||
|
@ -518,6 +518,7 @@ function addQtipToSCIcons(ele){
|
|||
* This gets checked when we are deciding if the show-empty icon should be added
|
||||
* at the beginning of an event render callback.
|
||||
*/
|
||||
/*
|
||||
function checkEmptyShowStatus(e) {
|
||||
var currDate = new Date();
|
||||
var endTime;
|
||||
|
@ -541,6 +542,7 @@ function checkEmptyShowStatus(e) {
|
|||
return showOver;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//Alert the error and reload the page
|
||||
//this function is used to resolve concurrency issue
|
||||
|
@ -552,7 +554,7 @@ function alertShowErrorAndReload(){
|
|||
$(document).ready(function(){
|
||||
setInterval( "checkSCUploadStatus()", 5000 );
|
||||
setInterval( "getCurrentShow()", 5000 );
|
||||
setInterval( "checkEmptyShowStatus()", 5000 );
|
||||
//setInterval( "checkEmptyShowStatus()", 5000 );
|
||||
});
|
||||
|
||||
var view_name;
|
||||
|
|
|
@ -2,13 +2,12 @@
|
|||
from kombu.messaging import Exchange, Queue, Consumer
|
||||
from kombu.connection import BrokerConnection
|
||||
from os.path import normpath
|
||||
from mutagen.easymp4 import EasyMP4KeyError
|
||||
|
||||
import json
|
||||
import os
|
||||
import copy
|
||||
|
||||
from media.monitor.exceptions import BadSongFile
|
||||
from media.monitor.exceptions import BadSongFile, InvalidMetadataElement
|
||||
from media.monitor.metadata import Metadata
|
||||
from media.monitor.log import Loggable
|
||||
from media.monitor.syncdb import AirtimeDB
|
||||
|
@ -118,7 +117,7 @@ class AirtimeMessageReceiver(Loggable):
|
|||
try: Metadata.write_unsafe(path=md_path, md=msg)
|
||||
except BadSongFile as e:
|
||||
self.logger.info("Cannot find metadata file: '%s'" % e.path)
|
||||
except EasyMP4KeyError as e:
|
||||
except InvalidMetadataElement as e:
|
||||
self.logger.info("Metadata instance not supported for this file '%s'" \
|
||||
% e.path)
|
||||
self.logger.info(str(e))
|
||||
|
|
|
@ -48,3 +48,13 @@ class NoDirectoryInAirtime(Exception):
|
|||
def __str__(self):
|
||||
return "Directory '%s' does not exist in Airtime.\n \
|
||||
However: %s do exist." % (self.path, self.does_exist)
|
||||
|
||||
class InvalidMetadataElement(Exception):
|
||||
def __init__(self, parent, key, path):
|
||||
self.parent = parent
|
||||
self.key = key
|
||||
self.path = path
|
||||
def __str__(self):
|
||||
return "InvalidMetadataElement: (key,path) = (%s,%s)" \
|
||||
% (self.key, self.path)
|
||||
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
import mutagen
|
||||
import os
|
||||
import copy
|
||||
from collections import namedtuple
|
||||
from mutagen.easymp4 import EasyMP4KeyError
|
||||
from collections import namedtuple
|
||||
from mutagen.easymp4 import EasyMP4KeyError
|
||||
from mutagen.easyid3 import EasyID3KeyError
|
||||
|
||||
from media.monitor.exceptions import BadSongFile
|
||||
from media.monitor.exceptions import BadSongFile, InvalidMetadataElement
|
||||
from media.monitor.log import Loggable
|
||||
from media.monitor.pure import format_length
|
||||
import media.monitor.pure as mmp
|
||||
|
@ -150,17 +151,18 @@ class Metadata(Loggable):
|
|||
"""
|
||||
if not os.path.exists(path): raise BadSongFile(path)
|
||||
song_file = mutagen.File(path, easy=True)
|
||||
ex = None
|
||||
exceptions = [] # for bad keys
|
||||
for airtime_k, airtime_v in md.iteritems():
|
||||
if airtime_k in airtime2mutagen:
|
||||
# The unicode cast here is mostly for integers that need to be
|
||||
# strings
|
||||
try:
|
||||
song_file[ airtime2mutagen[airtime_k] ] = unicode(airtime_v)
|
||||
except EasyMP4KeyError as e:
|
||||
ex = e
|
||||
except (EasyMP4KeyError, EasyID3KeyError) as e:
|
||||
exceptions.append(InvalidMetadataElement(e, airtime_k,
|
||||
path))
|
||||
for e in exceptions: raise e
|
||||
song_file.save()
|
||||
if ex: raise ex
|
||||
|
||||
def __init__(self, fpath):
|
||||
# Forcing the unicode through
|
||||
|
|
|
@ -257,6 +257,8 @@ def normalized_metadata(md, original_path):
|
|||
'MDATA_KEY_FILEPATH' : lambda x: os.path.normpath(x),
|
||||
'MDATA_KEY_BPM' : lambda x: x[0:8],
|
||||
'MDATA_KEY_MIME' : lambda x: x.replace('audio/vorbis','audio/ogg'),
|
||||
# Whenever 0 is reported we change it to empty
|
||||
#'MDATA_KEY_BITRATE' : lambda x: '' if str(x) == '0' else x
|
||||
}
|
||||
|
||||
new_md = remove_whitespace(new_md) # remove whitespace fields
|
||||
|
|
Loading…
Reference in New Issue