Merge branch '2.2.x' of dev.sourcefabric.org:airtime into 2.2.x

This commit is contained in:
Rudi Grinberg 2012-10-16 12:20:13 -04:00
commit df54a75d5d
6 changed files with 33 additions and 13 deletions

View File

@ -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'];

View File

@ -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)

View File

@ -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

View File

@ -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);

View File

@ -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)) {

View File

@ -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):