From a418f5777c014145490fd2cd234d39711067c92d Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 12 Sep 2012 15:43:50 -0400 Subject: [PATCH 1/8] CC-4393: Please ignore AAC and Flac items for Playlist Preview and disable to preview it as a single track -initial commit --- airtime_mvc/application/Bootstrap.php | 3 ++ airtime_mvc/application/models/Block.php | 2 +- airtime_mvc/application/models/Playlist.php | 9 ++++-- .../views/scripts/playlist/update.phtml | 2 +- airtime_mvc/public/css/playlist_builder.css | 17 +++++++++- airtime_mvc/public/css/styles.css | 16 ++++++++++ .../public/js/airtime/common/audioplaytest.js | 10 ++++++ .../public/js/airtime/library/library.js | 2 +- airtime_mvc/public/js/airtime/library/spl.js | 32 ++++++++++++++++--- 9 files changed, 82 insertions(+), 11 deletions(-) create mode 100644 airtime_mvc/public/js/airtime/common/audioplaytest.js diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index 454bc4cba..6acb767b7 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -76,6 +76,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap $view->headScript()->appendFile($baseUrl.'/js/airtime/common/common.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $view->headScript()->appendFile($baseUrl.'/js/airtime/common/audioplaytest.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $user = Application_Model_User::getCurrentUser(); if (!is_null($user)){ @@ -85,6 +86,8 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap } $view->headScript()->appendScript("var userType = '$userType';"); + + if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1) { $view->headScript()->appendFile($baseUrl.'/js/libs/google-analytics.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); } diff --git a/airtime_mvc/application/models/Block.php b/airtime_mvc/application/models/Block.php index dc05ab5a0..5abfa443b 100644 --- a/airtime_mvc/application/models/Block.php +++ b/airtime_mvc/application/models/Block.php @@ -193,7 +193,7 @@ class Application_Model_Block implements Application_Model_LibraryEditable $files = array(); $sql = <<<"EOT" SELECT pc.id as id, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout, bl.type, f.length as orig_length, - f.id as item_id, f.track_title, f.artist_name as creator, f.file_exists as exists, f.filepath as path FROM cc_blockcontents AS pc + f.id as item_id, f.track_title, f.artist_name as creator, f.file_exists as exists, f.filepath as path, f.mime as mime FROM cc_blockcontents AS pc LEFT JOIN cc_files AS f ON pc.file_id=f.id LEFT JOIN cc_block AS bl ON pc.block_id = bl.id WHERE pc.block_id = :block_id diff --git a/airtime_mvc/application/models/Playlist.php b/airtime_mvc/application/models/Playlist.php index ae742b6c8..852ff33a7 100644 --- a/airtime_mvc/application/models/Playlist.php +++ b/airtime_mvc/application/models/Playlist.php @@ -172,7 +172,8 @@ class Application_Model_Playlist implements Application_Model_LibraryEditable f.artist_name AS creator, f.file_exists AS EXISTS, f.filepath AS path, - f.length AS orig_length + f.length AS orig_length, + f.mime AS mime FROM cc_playlistcontents AS pc JOIN cc_files AS f ON pc.file_id=f.id WHERE pc.playlist_id = :playlist_id1 @@ -190,7 +191,8 @@ class Application_Model_Playlist implements Application_Model_LibraryEditable sub.login AS creator, 't'::boolean AS EXISTS, ws.url AS path, - ws.length AS orig_length + ws.length AS orig_length, + ws.mime as mime FROM cc_playlistcontents AS pc JOIN cc_webstream AS ws ON pc.stream_id=ws.id LEFT JOIN cc_subjs AS sub ON sub.id = ws.creator_id @@ -209,7 +211,8 @@ class Application_Model_Playlist implements Application_Model_LibraryEditable sbj.login AS creator, 't'::boolean AS EXISTS, NULL::text AS path, - bl.length AS orig_length + bl.length AS orig_length, + NULL::text as mime FROM cc_playlistcontents AS pc JOIN cc_block AS bl ON pc.block_id=bl.id JOIN cc_subjs AS sbj ON bl.creator_id=sbj.id diff --git a/airtime_mvc/application/views/scripts/playlist/update.phtml b/airtime_mvc/application/views/scripts/playlist/update.phtml index dc95ac2da..5c21e22f3 100644 --- a/airtime_mvc/application/views/scripts/playlist/update.phtml +++ b/airtime_mvc/application/views/scripts/playlist/update.phtml @@ -13,7 +13,7 @@ if ($item['type'] == 2) {
-
"> +
" data-mime-type="">
diff --git a/airtime_mvc/public/css/playlist_builder.css b/airtime_mvc/public/css/playlist_builder.css index b386176e2..74728a0bb 100644 --- a/airtime_mvc/public/css/playlist_builder.css +++ b/airtime_mvc/public/css/playlist_builder.css @@ -114,7 +114,6 @@ } .ui-icon-closethick, -.ui-icon-play, .spl_fade_control, .spl_text_input { cursor: pointer; @@ -164,15 +163,31 @@ background: -moz-linear-gradient(top, #707070 0, #666666 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #707070), color-stop(100%, #666666)); } +#spl_sortable div.big_play_disabled { + display:block; + width:20px; + height:50px; + margin:2px 0 0 2px; + text-align:center; + border:1px solid #5b5b5b; + float:left; + background-color: #707070; + background: -moz-linear-gradient(top, #707070 0, #666666 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #707070), color-stop(100%, #666666)); +} #spl_sortable div.big_play:hover { border:1px solid #282828; background-color: #3b3b3b; background: -moz-linear-gradient(top, #3b3b3b 0, #292929 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #3b3b3b), color-stop(100%, #292929)); + cursor: pointer; } #spl_sortable div.big_play .ui-icon { margin: 17px 0 0 1px; } +#spl_sortable div.big_play_disabled .ui-icon { + margin: 17px 0 0 1px; +} #spl_sortable div.big_play:hover .ui-icon-play, #spl_sortable div.big_play:hover .ui-icon-pause { background-image:url(redmond/images/ui-icons_ff5d1a_256x240.png); diff --git a/airtime_mvc/public/css/styles.css b/airtime_mvc/public/css/styles.css index ff0a78974..454b6d456 100644 --- a/airtime_mvc/public/css/styles.css +++ b/airtime_mvc/public/css/styles.css @@ -2888,3 +2888,19 @@ dd .stream-status { outline: 0; border-top-color:#333333 } + +.dark_class +{ + background-color: black; + filter:alpha(opacity=20); /* IE */ + opacity: 0.2; /* Safari, Opera */ + -moz-opacity:0.20; /* FireFox */ + z-index: 20; + height: 100%; + width: 100%; + background-repeat:no-repeat; + background-position:center; + /* position:absolute; */ + top: 0px; + left: 0px; +} diff --git a/airtime_mvc/public/js/airtime/common/audioplaytest.js b/airtime_mvc/public/js/airtime/common/audioplaytest.js new file mode 100644 index 000000000..81bd6c95b --- /dev/null +++ b/airtime_mvc/public/js/airtime/common/audioplaytest.js @@ -0,0 +1,10 @@ +var audio = new Audio(); +supportedAudio = {}; +supportedAudio["audio/ogg"] = !!audio.canPlayType && audio.canPlayType('audio/ogg; codecs="vorbis"') != ""; +supportedAudio["audio/mp3"] = !!audio.canPlayType && audio.canPlayType('audio/mp3') != ""; +supportedAudio["audio/mp4"] = !!audio.canPlayType && audio.canPlayType('audio/mp4') != ""; +supportedAudio["audio/x-flac"] = !!audio.canPlayType && audio.canPlayType('audio/x-flac') != ""; + +function isAudioSupported(mime){ + return mime in supportedAudio && supportedAudio[mime]; +} diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js index f70c13c04..f62169feb 100644 --- a/airtime_mvc/public/js/airtime/library/library.js +++ b/airtime_mvc/public/js/airtime/library/library.js @@ -917,7 +917,7 @@ function addQtipToSCIcons(){ else if($(this).hasClass("soundcloud")){ $(this).qtip({ content: { - text: "Retreiving data from the server...", + text: "Retrieving data from the server...", ajax: { url: "/Library/get-upload-to-soundcloud-status", type: "post", diff --git a/airtime_mvc/public/js/airtime/library/spl.js b/airtime_mvc/public/js/airtime/library/spl.js index 357bf87be..3e8a78a4f 100644 --- a/airtime_mvc/public/js/airtime/library/spl.js +++ b/airtime_mvc/public/js/airtime/library/spl.js @@ -378,10 +378,34 @@ var AIRTIME = (function(AIRTIME){ $pl.delegate(".spl_cue", {"click": openCueEditor}); - //add the play function to the play icon - $pl.delegate(".big_play", - {"click": openAudioPreview}); - + $.each($(".big_play"), function(index, value){ + var mime = $(value).attr("data-mime-type"); + if (isAudioSupported(mime)) { + $(value).bind("click", openAudioPreview); + } else { + $(value).attr("class", "big_play_disabled dark_class"); + $(value).qtip({ + content: 'Your browser does not support playing this file type: "'+ mime +'"', + show: 'mouseover', + 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" + }, + }) + } + }); + $pl.delegate(".spl_block_expand", {"click": function(ev){ var id = parseInt($(this).attr("id").split("_").pop(), 10); From 87fb9998dda5fcc09fb86ca473cfb1467e85d3bc Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 12 Sep 2012 15:44:26 -0400 Subject: [PATCH 2/8] increase mem warning limit to 30MB --- airtime_mvc/application/controllers/plugins/RabbitMqPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/controllers/plugins/RabbitMqPlugin.php b/airtime_mvc/application/controllers/plugins/RabbitMqPlugin.php index 346bfdccc..617e26675 100644 --- a/airtime_mvc/application/controllers/plugins/RabbitMqPlugin.php +++ b/airtime_mvc/application/controllers/plugins/RabbitMqPlugin.php @@ -12,7 +12,7 @@ class RabbitMqPlugin extends Zend_Controller_Plugin_Abstract } } - if (memory_get_peak_usage() > 25*pow(2, 20)) { + if (memory_get_peak_usage() > 30*pow(2, 20)) { Logging::debug("Peak memory usage: " .(memory_get_peak_usage()/1000000) From 64a1dade9b01e26e213d838a5ade7314708b7958 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Wed, 12 Sep 2012 15:59:46 -0400 Subject: [PATCH 3/8] Massive formatting of SQL --- airtime_mvc/application/models/Schedule.php | 66 ++++++++++----------- 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 414980216..d77f5e4da 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -519,41 +519,37 @@ SQL; public static function getItems($p_startTime, $p_endTime) { global $CC_CONFIG; + $baseQuery = << :startTime1 + AND st.starts < :endTime + AND st.playout_status > 0 + AND si.ends > :startTime2 +ORDER BY st.starts +SQL; - $baseQuery = "SELECT st.file_id AS file_id," - ." st.id AS id," - ." st.instance_id AS instance_id," - ." st.starts AS start," - ." st.ends AS end," - ." st.cue_in AS cue_in," - ." st.cue_out AS cue_out," - ." st.fade_in AS fade_in," - ." st.fade_out AS fade_out," - //." st.type AS type," - ." si.starts AS show_start," - ." si.ends AS show_end," - ." s.name AS show_name," - ." f.id AS file_id," - ." f.replay_gain AS replay_gain," - ." ws.id as stream_id," - ." ws.url as url" - ." FROM cc_schedule AS st" - ." LEFT JOIN cc_show_instances AS si" - ." ON st.instance_id = si.id" - ." LEFT JOIN cc_show as s" - ." ON s.id = si.show_id" - ." LEFT JOIN cc_files AS f" - ." ON st.file_id = f.id" - ." LEFT JOIN cc_webstream AS ws" - ." ON st.stream_id = ws.id"; - - $predicates = " WHERE st.ends > :startTime1" - ." AND st.starts < :endTime" - ." AND st.playout_status > 0" - ." AND si.ends > :startTime2" - ." ORDER BY st.starts"; - - $sql = $baseQuery.$predicates; + $sql = $baseQuery." ".$predicates; $rows = Application_Common_Database::prepareAndExecute($sql, array(':startTime1'=>$p_startTime, ':endTime'=>$p_endTime, ':startTime2'=>$p_startTime)); @@ -571,7 +567,7 @@ WHERE st.ends > :startTime1 ORDER BY st.starts LIMIT 3 SQL; - $sql = " ".$baseQuery.$predicates; + $sql = " ".$baseQuery." ".$predicates." "; $rows = Application_Common_Database::prepareAndExecute($sql, array( ':startTime1' => $p_startTime, From 414d1fa5112508b46167ae6e656095386605c191 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Wed, 12 Sep 2012 16:09:28 -0400 Subject: [PATCH 4/8] PDO'd UpdateBroadcastedStatus --- airtime_mvc/application/models/Schedule.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index d77f5e4da..601253b8e 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -381,11 +381,18 @@ SQL; global $CC_CONFIG; $con = Propel::getConnection(); $now = $dateTime->format("Y-m-d H:i:s"); - $sql = "UPDATE ".$CC_CONFIG['scheduleTable'] - ." SET broadcasted=$value" - ." WHERE starts <= '$now' AND ends >= '$now'"; - $retVal = $con->exec($sql); + $sql = <<= :ends::TIMESTAMP +SQL; + + $retVal = Application_Common_Database::prepareAndExecute($sql, array( + ':broadcastedValue' => $value, + ':starts' => $now, + ':ends' => $now), 'execute'); return $retVal; } From db5dbab0862e9660d61231f92adc11109b6d4148 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Wed, 12 Sep 2012 16:09:53 -0400 Subject: [PATCH 5/8] Removed unused local variables --- airtime_mvc/application/models/Schedule.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 601253b8e..1af7b5a88 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -378,8 +378,6 @@ SQL; public static function UpdateBrodcastedStatus($dateTime, $value) { - global $CC_CONFIG; - $con = Propel::getConnection(); $now = $dateTime->format("Y-m-d H:i:s"); $sql = << Date: Wed, 12 Sep 2012 16:10:56 -0400 Subject: [PATCH 6/8] Fixed typo in SQL missing , --- airtime_mvc/application/models/Schedule.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 1af7b5a88..9a0895228 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -525,7 +525,8 @@ SQL; { global $CC_CONFIG; $baseQuery = << Date: Wed, 12 Sep 2012 16:12:00 -0400 Subject: [PATCH 7/8] Formatted comment --- airtime_mvc/application/models/Schedule.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 9a0895228..daf59540f 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -720,8 +720,8 @@ SQL; { global $CC_CONFIG; - /* if $p_fromDateTime and $p_toDateTime function parameters are null, then set range - * from "now" to "now + 24 hours". */ + /* if $p_fromDateTime and $p_toDateTime function parameters are null, + then set range * from "now" to "now + 24 hours". */ if (is_null($p_fromDateTime)) { $t1 = new DateTime("@".time()); $range_start = $t1->format("Y-m-d H:i:s"); From 88604eabcc558af14ee1b4511b2a20d4729a07de Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Wed, 12 Sep 2012 16:24:49 -0400 Subject: [PATCH 8/8] Removed unused variable --- airtime_mvc/application/models/Schedule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index daf59540f..29eb3c354 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -811,7 +811,7 @@ SQL; { global $CC_CONFIG; $sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]." WHERE file_id=:file_id"; - $res = Application_Common_Database::prepareAndExecute($sql, array(':file_id'=>$fileId), 'execute'); + Application_Common_Database::prepareAndExecute($sql, array(':file_id'=>$fileId), 'execute'); } public static function createNewFormSections($p_view)