diff --git a/airtime_mvc/application/controllers/AudiopreviewController.php b/airtime_mvc/application/controllers/AudiopreviewController.php index bd7505595..3718a86a0 100644 --- a/airtime_mvc/application/controllers/AudiopreviewController.php +++ b/airtime_mvc/application/controllers/AudiopreviewController.php @@ -278,6 +278,7 @@ class AudiopreviewController extends Zend_Controller_Action 'element_artist' => isset($track['creator']) ? $track['creator'] : "", 'element_position' => $position, 'element_id' => ++$position, + 'mime' => isset($track['mime'])?$track['mime']:"" ); $elementMap['type'] = $track['type']; diff --git a/airtime_mvc/application/models/PlayoutHistory.php b/airtime_mvc/application/models/PlayoutHistory.php index ba845fa33..7da1ff2c2 100644 --- a/airtime_mvc/application/models/PlayoutHistory.php +++ b/airtime_mvc/application/models/PlayoutHistory.php @@ -16,12 +16,12 @@ class Application_Model_PlayoutHistory private $opts; private $mDataPropMap = array( - "artist" => "file.artist_name", - "title" => "file.track_title", - "played" => "playout.played", - "length" => "file.length", - "composer" => "file.composer", - "copyright" => "file.copyright", + "artist" => "artist_name", + "title" => "track_title", + "played" => "played", + "length" => "length", + "composer" => "composer", + "copyright" => "copyright", ); public function __construct($p_startDT, $p_endDT, $p_opts) diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php index b08a0e37c..6a513aac4 100644 --- a/airtime_mvc/application/models/ShowInstance.php +++ b/airtime_mvc/application/models/ShowInstance.php @@ -677,7 +677,8 @@ FROM ( f.length AS length, f.artist_name AS creator, f.file_exists AS EXISTS, - f.filepath AS filepath + f.filepath AS filepath, + f.mime AS mime FROM cc_schedule AS s LEFT JOIN cc_files AS f ON f.id = s.file_id WHERE s.instance_id = :instance_id1 @@ -693,7 +694,8 @@ FROM ( ws.length AS length, sub.login AS creator, 't'::boolean AS EXISTS, - ws.url AS filepath + ws.url AS filepath, + ws.mime as mime FROM cc_schedule AS s LEFT JOIN cc_webstream AS ws ON ws.id = s.stream_id LEFT JOIN cc_subjs AS sub ON ws.creator_id = sub.id diff --git a/airtime_mvc/public/js/airtime/audiopreview/preview_jplayer.js b/airtime_mvc/public/js/airtime/audiopreview/preview_jplayer.js index 0f5a0b0fe..e7435ee2e 100644 --- a/airtime_mvc/public/js/airtime/audiopreview/preview_jplayer.js +++ b/airtime_mvc/public/js/airtime/audiopreview/preview_jplayer.js @@ -123,6 +123,7 @@ function buildplaylist(p_url, p_playIndex) { var media; var index; var total = 0; + var skipped = 0; for(index in data) { if (data[index]['type'] == 0) { if (data[index]['element_mp3'] != undefined){ @@ -145,22 +146,30 @@ function buildplaylist(p_url, p_playIndex) { artist: data[index]['element_artist'], wav:data[index]['uri'] }; - } + } else { + // skip this track since it's not supported + console.log("continue"); + skipped++; + continue; + } } else if (data[index]['type'] == 1) { media = {title: data[index]['element_title'], artist: data[index]['element_artist'], mp3:data[index]['uri'] }; } + console.log(data[index]); if (media && isAudioSupported(data[index]['mime'])) { - myPlaylist[index] = media; + // javascript doesn't support associative array with numeric key + // so we need to remove the gap if we skip any of tracks due to + // browser incompatibility. + myPlaylist[index-skipped] = media; } // we should create a map according to the new position in the // player itself total is the index on the player _idToPostionLookUp[data[index]['element_id']] = total; total++; } - _playlist_jplayer.setPlaylist(myPlaylist); _playlist_jplayer.option("autoPlay", true); play(p_playIndex); diff --git a/airtime_mvc/public/js/airtime/library/spl.js b/airtime_mvc/public/js/airtime/library/spl.js index a5937820d..5e300dea6 100644 --- a/airtime_mvc/public/js/airtime/library/spl.js +++ b/airtime_mvc/public/js/airtime/library/spl.js @@ -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 ui-icon-play"), function(index, value){ + $.each($("div .big_play"), function(index, value){ if ($(value).attr('blockId') === undefined) { var mime = $(value).attr("data-mime-type"); if (isAudioSupported(mime)) { diff --git a/python_apps/pypo/pypopush.py b/python_apps/pypo/pypopush.py index aaacc1687..87e1704bf 100644 --- a/python_apps/pypo/pypopush.py +++ b/python_apps/pypo/pypopush.py @@ -399,7 +399,15 @@ class PypoPush(Thread): def date_interval_to_seconds(self, interval): - return (interval.microseconds + (interval.seconds + interval.days * 24 * 3600) * 10 ** 6) / float(10 ** 6) + """ + Convert timedelta object into int representing the number of seconds. If + number of seconds is less than 0, then return 0. + """ + seconds = (interval.microseconds + \ + (interval.seconds + interval.days * 24 * 3600) * 10 ** 6) / float(10 ** 6) + if seconds < 0: seconds = 0 + + return seconds def push_to_liquidsoap(self, event_chain):