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

This commit is contained in:
Martin Konecny 2012-08-22 15:35:09 -04:00
commit 8573dcb870
18 changed files with 414 additions and 86 deletions

View file

@ -547,26 +547,24 @@ class ApiController extends Zend_Controller_Action
public function reloadMetadataGroupAction()
{
$request = $this->getRequest();
// extract all file metadata params from the request.
// The value is a json encoded hash that has all the information related to this action
// The key(mdXXX) does not have any meaning as of yet but it could potentially correspond
// to some unique id.
$responses = array();
$dry = $request->getParam('dry') || false;
$params = $request->getParams();
$request = $this->getRequest();
$responses = array();
$dry = $request->getParam('dry') || false;
$params = $request->getParams();
$valid_modes = array('delete_dir', 'delete', 'moved', 'modify', 'create');
foreach ($request->getParams() as $k => $raw_json) {
// Valid requests must start with mdXXX where XXX represents at least 1 digit
// Valid requests must start with mdXXX where XXX represents at
// least 1 digit
if( !preg_match('/^md\d+$/', $k) ) { continue; }
$info_json = json_decode($raw_json, $assoc=true);
$recorded = $info_json["is_record"];
$info_json = json_decode($raw_json, $assoc = true);
$recorded = $info_json["is_record"];
unset( $info_json["is_record"] );
//unset( $info_json["MDATA_KEY_DURATION"] );
//unset( $info_json["MDATA_KEY_SAMPLERATE"] );
//unset( $info_json["MDATA_KEY_BITRATE"] );
if( !array_key_exists('mode', $info_json) ) { // Log invalid requests
// Log invalid requests
if( !array_key_exists('mode', $info_json) ) {
Logging::info("Received bad request(key=$k), no 'mode' parameter. Bad request is:");
Logging::info( $info_json );
array_push( $responses, array(
@ -574,8 +572,8 @@ class ApiController extends Zend_Controller_Action
'key' => $k));
continue;
} elseif ( !in_array($info_json['mode'], $valid_modes) ) {
// A request still has a chance of being invalid even if it exists but it's validated
// by $valid_modes array
// A request still has a chance of being invalid even if it
// exists but it's validated by $valid_modes array
$mode = $info_json['mode'];
Logging::info("Received bad request(key=$k). 'mode' parameter was invalid with value: '$mode'. Request:");
Logging::info( $info_json );
@ -588,14 +586,12 @@ class ApiController extends Zend_Controller_Action
// Removing 'mode' key from $info_json might not be necessary...
$mode = $info_json['mode'];
unset( $info_json['mode'] );
$response = $this->dispatchMetadata($info_json, $mode, $dry_run=$dry);
$response = $this->dispatchMetadata($info_json, $mode,
$dry_run=$dry);
// We tack on the 'key' back to every request in case the would like to associate
// his requests with particular responses
$response['key'] = $k;
array_push($responses, $response);
// On recorded show requests we do some extra work here. Not sure what it actually is and it
// was usually called from the python api client. Now we just call it straight from the controller to
// save the http roundtrip
}
die( json_encode($responses) );
}

View file

@ -1065,10 +1065,11 @@ SQL;
if ($update) {
$sql = "SELECT id, starts, ends FROM ".$CC_CONFIG["showInstances"]."
where ends <= '{$show_end->format('Y-m-d H:i:s')}'
and id != ".$instanceId. " order by ends";
and modified_instance = false and id != ".$instanceId. " order by ends";
} else {
$sql = "SELECT id, starts, ends FROM ".$CC_CONFIG["showInstances"]."
where ends <= '{$show_end->format('Y-m-d H:i:s')}' order by ends";
where ends <= '{$show_end->format('Y-m-d H:i:s')}'
and modified_instance = false order by ends";
}
$rows = $con->query($sql);

View file

@ -54,11 +54,11 @@
<?php
$titleMaxStrLen = 35;
if (mb_strlen($row["track_title"], 'UTF-8') > $titleMaxStrLen) {
$row["track_title"] = substr($row["track_title"], 0, 34)."...";
$row["track_title"] = mb_substr($row["track_title"], 0, 34, 'UTF-8')."...";
}
$artistMaxStrLen = 22;
if (strlen($row["creator"]) > $artistMaxStrLen) {
$row["creator"] = substr($row["creator"], 0, 21)."...";
if (mb_strlen($row["creator"], 'UTF-8') > $artistMaxStrLen) {
$row["creator"] = mb_substr($row["creator"], 0, 21, 'UTF-8')."...";
}
?>
<?php if ($row["type"] == 2) {

View file

@ -440,31 +440,37 @@ table.library-get-file-md{
table.library-get-file-md.table-small{
width: 290px !important;
}
}
.file-md-qtip-nowrap{
white-space: nowrap;
overflow: hidden;
}
.file-md-qtip-criteria-width-small{
width:70px;
max-width: 70px;
}
.file-md-qtip-criteria-width{
width:110px;
max-width: 110px;
}
.file-md-qtip-row-width-title{
width:170px;
max-width: 170px;
padding-right:5px !important;
}
.file-md-qtip-row-width-artist{
width:110px;
max-width: 110px;
}
.file-md-qtip-row-width-small{
width:40x;
max-width: 40px;
text-align:right;
}

View file

@ -300,7 +300,7 @@ var AIRTIME = (function(AIRTIME){
.empty()
.val(json.description);
$('#spl_sortable').unbind();
$('#spl_sortable').off('focusout keydown');
$('#spl_sortable')
.empty()
.append(json.html);
@ -423,20 +423,20 @@ var AIRTIME = (function(AIRTIME){
//sets events dynamically for the cue editor.
function setCueEvents() {
var temp = $('#spl_sortable');
temp.on("blur", ".spl_cue_in span", changeCueIn);
temp.on("focusout", ".spl_cue_in span", changeCueIn);
temp.on("keydown", ".spl_cue_in span", submitOnEnter);
temp.on("blur", ".spl_cue_out span", changeCueOut);
temp.on("focusout", ".spl_cue_out span", changeCueOut);
temp.on("keydown", ".spl_cue_out span", submitOnEnter);
}
//sets events dynamically for the fade editor.
function setFadeEvents() {
var temp = $('#spl_sortable');
temp.on("blur", ".spl_fade_in span", changeFadeIn);
temp.on("focusout", ".spl_fade_in span", changeFadeIn);
temp.on("keydown", ".spl_fade_in span", submitOnEnter);
temp.on("blur", ".spl_fade_out span", changeFadeOut);
temp.on("focusout", ".spl_fade_out span", changeFadeOut);
temp.on("keydown", ".spl_fade_out span", submitOnEnter);
}