CC-3817 : Should use soundcloud icon for recorded & uploaded shows in timeline for past shows to match calendar

This commit is contained in:
Naomi Aro 2013-05-28 14:27:59 -04:00
parent 51573d36c9
commit 4d1a15b7ca
4 changed files with 68 additions and 73 deletions

View File

@ -30,7 +30,7 @@ AND file_id is not null
SQL;
$files = Application_Common_Database::prepareAndExecute( $sql, array());
$real_files = array();
foreach ($files as $f) {
$real_files[] = $f['file_id'];
@ -48,7 +48,7 @@ WHERE ends > now() AT TIME ZONE 'UTC'
AND stream_id is not null
SQL;
$streams = Application_Common_Database::prepareAndExecute( $sql, array());
$real_streams = array();
foreach ($streams as $s) {
$real_streams[] = $s['stream_id'];
@ -322,7 +322,8 @@ SQL;
ft.album_title AS file_album_title,
ft.length AS file_length,
ft.file_exists AS file_exists,
ft.mime AS file_mime
ft.mime AS file_mime,
ft.soundcloud_id AS soundcloud_id
SQL;
$filesJoin = <<<SQL
cc_schedule AS sched
@ -357,7 +358,8 @@ SQL;
ws.description AS file_album_title,
ws.length AS file_length,
't'::BOOL AS file_exists,
ws.mime as file_mime
ws.mime AS file_mime,
(SELECT NULL::integer AS soundcloud_id)
SQL;
$streamJoin = <<<SQL
cc_schedule AS sched
@ -391,17 +393,17 @@ SQL;
$showPredicate = "";
if (count($p_shows) > 0) {
$params = array();
$map = array();
for ($i = 0, $len = count($p_shows); $i < $len; $i++) {
$holder = "show_".$i;
$params[] = $holder;
$map[$holder] = $p_shows[$i];
}
$showPredicate = " AND show_id IN (".implode(",", $params).")";
$paramMap = $paramMap + $map;
} else if (count($p_show_instances) > 0) {
@ -448,13 +450,13 @@ SQL;
":ts_6" => $p_end_str,
);
$paramMap = $paramMap + $map;
$rows = Application_Common_Database::prepareAndExecute(
$sql,
$paramMap,
Application_Common_Database::ALL
);
return $rows;
}
@ -475,7 +477,7 @@ SQL;
$sql .= " WHERE id=:pid";
$map = array(":pid" => $p_id);
Application_Common_Database::prepareAndExecute($sql, $map,
Application_Common_Database::prepareAndExecute($sql, $map,
Application_Common_Database::EXECUTE);
}
@ -501,9 +503,9 @@ SQL;
{
$sql = "SELECT count(*) as cnt FROM cc_schedule";
$res = Application_Common_Database::prepareAndExecute($sql, array(),
$res = Application_Common_Database::prepareAndExecute($sql, array(),
Application_Common_Database::COLUMN);
return $res;
}
@ -706,7 +708,7 @@ SQL;
$key = "{$time}_{$i}";
$i++;
}
$data["media"][$key] = $item;
}
@ -755,7 +757,7 @@ SQL;
$replay_gain = is_null($item["replay_gain"]) ? "0": $item["replay_gain"];
$replay_gain += Application_Model_Preference::getReplayGainModifier();
if ( !Application_Model_Preference::GetEnableReplayGain() ) {
$replay_gain = 0;
}
@ -775,7 +777,7 @@ SQL;
'replay_gain' => $replay_gain,
'independent_event' => $independent_event,
);
if ($schedule_item['cue_in'] > $schedule_item['cue_out']) {
$schedule_item['cue_in'] = $schedule_item['cue_out'];
}
@ -915,10 +917,10 @@ SQL;
} else {
throw new Exception("Unknown schedule type: ".print_r($item, true));
}
}
}
/* Check if two events are less than or equal to 1 second apart
*/
public static function areEventsLinked($event1, $event2) {
@ -996,7 +998,7 @@ SQL;
public static function deleteAll()
{
$sql = "TRUNCATE TABLE cc_schedule";
Application_Common_Database::prepareAndExecute($sql, array(),
Application_Common_Database::prepareAndExecute($sql, array(),
Application_Common_Database::EXECUTE);
}
@ -1279,14 +1281,14 @@ SQL;
$update=false, $instanceId=null, $showId=null)
{
$overlapping = false;
$params = array(
':show_end1' => $show_end->format('Y-m-d H:i:s'),
':show_end2' => $show_end->format('Y-m-d H:i:s'),
':show_end3' => $show_end->format('Y-m-d H:i:s')
);
/* If a show is being edited, exclude it from the query
* In both cases (new and edit) we only grab shows that
* are scheduled 2 days prior
@ -1357,18 +1359,18 @@ SQL;
return 'file';
}
}
public static function GetFileId($p_scheduleId)
{
$scheduledItem = CcScheduleQuery::create()->findPK($p_scheduleId);
return $scheduledItem->getDbFileId();
}
public static function GetStreamId($p_scheduleId)
{
$scheduledItem = CcScheduleQuery::create()->findPK($p_scheduleId);
return $scheduledItem->getDbStreamId();
}
}

View File

@ -150,7 +150,7 @@ class Application_Model_StoredFile
}
}
$dbMd[constant($mdConst)] = $mdValue;
}
}
$this->setDbColMetadata($dbMd);
@ -214,7 +214,7 @@ class Application_Model_StoredFile
if (isset($this->_dbMD[$dbColumn])) {
$propelColumn = $this->_dbMD[$dbColumn];
$method = "set$propelColumn";
/* We need to set track_number to null if it is an empty string
* because propel defaults empty strings to zeros */
if ($dbColumn == "track_number" && empty($mdValue)) $mdValue = null;
@ -330,7 +330,7 @@ SQL;
$stmt = $con->prepare($sql);
$stmt->bindParam(':file_id', $this->id, PDO::PARAM_INT);
if ($stmt->execute()) {
$ids = $stmt->fetchAll();
} else {
@ -386,7 +386,7 @@ SQL;
// set hidden flag to true
$this->_file->setDbHidden(true);
$this->_file->save();
// need to explicitly update any playlist's and block's length
// that contains the file getting deleted
$fileId = $this->_file->getDbId();
@ -396,7 +396,7 @@ SQL;
$pl->setDbLength($pl->computeDbLength(Propel::getConnection(CcPlaylistPeer::DATABASE_NAME)));
$pl->save();
}
$blRows = CcBlockcontentsQuery::create()->filterByDbFileId($fileId)->find();
foreach ($blRows as $row) {
$bl = CcBlockQuery::create()->filterByDbId($row->getDbBlockId())->findOne();
@ -506,19 +506,19 @@ SQL;
public function getFileUrl()
{
$CC_CONFIG = Config::getConfig();
$protocol = empty($_SERVER['HTTPS']) ? "http" : "https";
$serverName = $_SERVER['SERVER_NAME'];
$serverPort = $_SERVER['SERVER_PORT'];
$subDir = $CC_CONFIG['baseDir'];
if ($subDir[0] === "/") {
$subDir = substr($subDir, 1, strlen($subDir) - 1);
}
$baseUrl = "{$protocol}://{$serverName}:{$serverPort}/{$subDir}";
return $this->getRelativeFileUrl($baseUrl);
}
@ -641,7 +641,7 @@ SQL;
public static function searchLibraryFiles($datatables)
{
$baseUrl = Application_Common_OsPath::getBaseDir();
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME);
$displayColumns = self::getLibraryColumns();
@ -796,7 +796,7 @@ SQL;
//soundcloud status
$file = Application_Model_StoredFile::RecallById($row['id']);
$row['soundcloud_status'] = $file->getSoundCloudId();
$row['soundcloud_id'] = $file->getSoundCloudId();
// for audio preview
$row['audioFile'] = $row['id'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION);
@ -1028,7 +1028,7 @@ SQL;
$LIQUIDSOAP_ERRORS = array('TagLib: MPEG::Properties::read() -- Could not find a valid last MPEG frame in the stream.');
// Ask Liquidsoap if file is playable
$ls_command = sprintf('/usr/bin/airtime-liquidsoap -v -c "output.dummy(audio_to_stereo(single(%s)))" 2>&1',
$ls_command = sprintf('/usr/bin/airtime-liquidsoap -v -c "output.dummy(audio_to_stereo(single(%s)))" 2>&1',
escapeshellarg($audio_file));
$command = "export PATH=/usr/local/bin:/usr/bin:/bin/usr/bin/ && $ls_command";
@ -1068,14 +1068,14 @@ SQL;
$stmt = $con->prepare($sql);
$stmt->bindParam(':dir_id', $dir_id);
if ($stmt->execute()) {
$rows = $stmt->fetchAll();
} else {
$msg = implode(',', $stmt->errorInfo());
throw new Exception("Error: $msg");
}
$results = array();
foreach ($rows as $row) {
$results[] = $row["fp"];
@ -1111,10 +1111,10 @@ SQL;
return $rows;
}
public static function getAllFilesWithoutSilan() {
$con = Propel::getConnection();
$sql = <<<SQL
SELECT f.id,
m.directory || f.filepath AS fp
@ -1124,14 +1124,14 @@ WHERE file_exists = 'TRUE'
AND silan_check IS FALSE Limit 100
SQL;
$stmt = $con->prepare($sql);
if ($stmt->execute()) {
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
} else {
$msg = implode(',', $stmt->errorInfo());
throw new Exception("Error: $msg");
}
return $rows;
}
@ -1227,7 +1227,7 @@ SQL;
->save();
}
// This method seems to be unsued everywhere so I've commented it out
// If it's absence does not have any effect then it will be completely
// removed soon
@ -1284,7 +1284,7 @@ SQL;
}
}
}
public static function setIsPlaylist($p_playlistItems, $p_type, $p_status) {
foreach ($p_playlistItems as $item) {
$file = self::RecallById($item->getDbFileId());
@ -1302,7 +1302,7 @@ SQL;
}
}
}
public static function setIsScheduled($p_scheduleItem, $p_status,
$p_fileId=null) {

View File

@ -593,12 +593,12 @@ var AIRTIME = (function(AIRTIME) {
"fnRowCallback": AIRTIME.library.fnRowCallback,
"fnCreatedRow": function( nRow, aData, iDataIndex ) {
//add soundcloud icon
if (aData.soundcloud_status !== undefined) {
if (aData.soundcloud_status === "-2") {
if (aData.soundcloud_id !== undefined) {
if (aData.soundcloud_id === "-2") {
$(nRow).find("td.library_title").append('<span class="small-icon progress"/>');
} else if (aData.soundcloud_status === "-3") {
} else if (aData.soundcloud_id === "-3") {
$(nRow).find("td.library_title").append('<span class="small-icon sc-error"/>');
} else if (aData.soundcloud_status !== null) {
} else if (aData.soundcloud_id !== null) {
$(nRow).find("td.library_title").append('<span class="small-icon soundcloud"/>');
}
}
@ -1140,10 +1140,13 @@ function checkLibrarySCUploadStatus(){
setTimeout(checkLibrarySCUploadStatus, 5000);
}
function addQtipToSCIcons(){
$(".progress, .soundcloud, .sc-error").live('mouseover', function(){
function addQtipToSCIcons() {
$("#content")
.on('mouseover', ".progress, .soundcloud, .sc-error", function() {
var id = $(this).parent().parent().data("aData").id;
var aData = $(this).parents("tr").data("aData"),
id = aData.id,
sc_id = aData.soundcloud_id;
if ($(this).hasClass("progress")){
$(this).qtip({
@ -1163,24 +1166,15 @@ function addQtipToSCIcons(){
classes: "ui-tooltip-dark file-md-long"
},
show: {
ready: true // Needed to make it show on first mouseover
// event
ready: true // Needed to make it show on first mouseover event
}
});
}
else if($(this).hasClass("soundcloud")){
var sc_id = $(this).parent().parent().data("aData").soundcloud_id;
else if ($(this).hasClass("soundcloud")){
$(this).qtip({
content: {
text: $.i18n._("Retrieving data from the server..."),
ajax: {
url: baseUrl+"Library/get-upload-to-soundcloud-status",
type: "post",
data: ({format: "json", id : id, type: "file"}),
success: function(json, status){
this.set('content.text', $.i18n._("The soundcloud id for this file is: ")+json.sc_id);
}
}
text: $.i18n._("The soundcloud id for this file is: ") + sc_id
},
position:{
adjust: {
@ -1195,11 +1189,11 @@ function addQtipToSCIcons(){
classes: "ui-tooltip-dark file-md-long"
},
show: {
ready: true // Needed to make it show on first mouseover
// event
ready: true // Needed to make it show on first mouseover event
}
});
}else if($(this).hasClass("sc-error")){
}
else if ($(this).hasClass("sc-error")) {
$(this).qtip({
content: {
text: $.i18n._("Retreiving data from the server..."),
@ -1227,8 +1221,7 @@ function addQtipToSCIcons(){
classes: "ui-tooltip-dark file-md-long"
},
show: {
ready: true // Needed to make it show on first mouseover
// event
ready: true // Needed to make it show on first mouseover event
}
});
}

View File

@ -546,7 +546,7 @@ var AIRTIME = (function(AIRTIME){
cl = 'sb-footer';
//check the show's content status.
if (aData.runtime > 0) {
if (aData.runtime >= 0) {
$node.html('<span class="ui-icon ui-icon-check"></span>');
cl = cl + ' ui-state-highlight';
}