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

This commit is contained in:
James 2012-09-13 10:49:33 -04:00
commit 5067a304d9
49 changed files with 8820 additions and 3978 deletions

View file

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

View file

@ -36,7 +36,7 @@ var AIRTIME = (function(AIRTIME) {
"track_title" : "s",
"track_num" : "n",
"year" : "n",
"owner" : "s",
"owner_id" : "s",
"replay_gain" : "n"
};
@ -351,7 +351,6 @@ var AIRTIME = (function(AIRTIME) {
if (ele.bSearchable) {
var currentColId = ele._ColReorder_iOrigCol;
var label = "";
console.log(ele);
if (ele.mDataProp == "bit_rate") {
label = " (bps)";
} else if (ele.mDataProp == "utime" || ele.mDataProp == "mtime" || ele.mDataProp == "lptime") {
@ -404,32 +403,32 @@ var AIRTIME = (function(AIRTIME) {
"aoColumns": [
/* ftype */ { "sTitle" : "" , "mDataProp" : "ftype" , "bSearchable" : false , "bVisible" : false } ,
/* Checkbox */ { "sTitle" : "" , "mDataProp" : "checkbox" , "bSortable" : false , "bSearchable" : false , "sWidth" : "25px" , "sClass" : "library_checkbox" } ,
/* Type */ { "sTitle" : "" , "mDataProp" : "image" , "bSearchable" : false , "sWidth" : "25px" , "sClass" : "library_type" , "iDataSort" : 0 } ,
/* Type */ { "sTitle" : "" , "mDataProp" : "image" , "bSearchable" : false , "sWidth" : "25px" , "sClass" : "library_type" , "iDataSort" : 0 } ,
/* Title */ { "sTitle" : "Title" , "mDataProp" : "track_title" , "sClass" : "library_title" , "sWidth" : "170px" } ,
/* Creator */ { "sTitle" : "Creator" , "mDataProp" : "artist_name" , "sClass" : "library_creator" , "sWidth" : "160px" } ,
/* Creator */ { "sTitle" : "Creator" , "mDataProp" : "artist_name" , "sClass" : "library_creator" , "sWidth" : "160px" } ,
/* Album */ { "sTitle" : "Album" , "mDataProp" : "album_title" , "sClass" : "library_album" , "sWidth" : "150px" } ,
/* Genre */ { "sTitle" : "Genre" , "mDataProp" : "genre" , "bVisible" : false , "sClass" : "library_genre" , "sWidth" : "100px" } ,
/* Year */ { "sTitle" : "Year" , "mDataProp" : "year" , "bVisible" : false , "sClass" : "library_year" , "sWidth" : "60px" } ,
/* Length */ { "sTitle" : "Length" , "mDataProp" : "length" , "sClass" : "library_length" , "sWidth" : "80px" } ,
/* Upload Time */ { "sTitle" : "Uploaded" , "mDataProp" : "utime" , "sClass" : "library_upload_time" , "sWidth" : "125px" } ,
/* Last Modified */ { "sTitle" : "Last Modified" , "mDataProp" : "mtime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "125px" } ,
/* Last Played */ { "sTitle" : "Last Played " , "mDataProp" : "lptime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "125px" } ,
/* Track Number */ { "sTitle" : "Track" , "mDataProp" : "track_number" , "bVisible" : false , "sClass" : "library_track" , "sWidth" : "65px" } ,
/* Mood */ { "sTitle" : "Mood" , "mDataProp" : "mood" , "bVisible" : false , "sClass" : "library_mood" , "sWidth" : "70px" } ,
/* BPM */ { "sTitle" : "BPM" , "mDataProp" : "bpm" , "bVisible" : false , "sClass" : "library_bpm" , "sWidth" : "50px" } ,
/* Composer */ { "sTitle" : "Composer" , "mDataProp" : "composer" , "bVisible" : false , "sClass" : "library_composer" , "sWidth" : "150px" } ,
/* Website */ { "sTitle" : "Website" , "mDataProp" : "info_url" , "bVisible" : false , "sClass" : "library_url" , "sWidth" : "150px" } ,
/* Bit Rate */ { "sTitle" : "Bit Rate" , "mDataProp" : "bit_rate" , "bVisible" : false , "sClass" : "library_bitrate" , "sWidth" : "80px" } ,
/* Sample Rate */ { "sTitle" : "Sample" , "mDataProp" : "sample_rate" , "bVisible" : false , "sClass" : "library_sr" , "sWidth" : "80px" } ,
/* ISRC Number */ { "sTitle" : "ISRC" , "mDataProp" : "isrc_number" , "bVisible" : false , "sClass" : "library_isrc" , "sWidth" : "150px" } ,
/* BPM */ { "sTitle" : "BPM" , "mDataProp" : "bpm" , "bVisible" : false , "sClass" : "library_bpm" , "sWidth" : "50px" } ,
/* Composer */ { "sTitle" : "Composer" , "mDataProp" : "composer" , "bVisible" : false , "sClass" : "library_composer" , "sWidth" : "150px" } ,
/* Conductor */ { "sTitle" : "Conductor" , "mDataProp" : "conductor" , "bVisible" : false , "sClass" : "library_conductor" , "sWidth" : "125px" },
/* Copyright */ { "sTitle" : "Copyright" , "mDataProp" : "copyright" , "bVisible" : false , "sClass" : "library_copyright" , "sWidth" : "125px" } ,
/* Encoded */ { "sTitle" : "Encoded By" , "mDataProp" : "encoded_by" , "bVisible" : false , "sClass" : "library_encoded" , "sWidth" : "150px" } ,
/* Genre */ { "sTitle" : "Genre" , "mDataProp" : "genre" , "bVisible" : false , "sClass" : "library_genre" , "sWidth" : "100px" } ,
/* ISRC Number */ { "sTitle" : "ISRC" , "mDataProp" : "isrc_number" , "bVisible" : false , "sClass" : "library_isrc" , "sWidth" : "150px" } ,
/* Label */ { "sTitle" : "Label" , "mDataProp" : "label" , "bVisible" : false , "sClass" : "library_label" , "sWidth" : "125px" } ,
/* Copyright */ { "sTitle" : "Copyright" , "mDataProp" : "copyright" , "bVisible" : false , "sClass" : "library_copyright" , "sWidth" : "125px" } ,
/* Mime */ { "sTitle" : "Mime" , "mDataProp" : "mime" , "bVisible" : false , "sClass" : "library_mime" , "sWidth" : "80px" } ,
/* Language */ { "sTitle" : "Language" , "mDataProp" : "language" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" } ,
/* Owner */ { "sTitle" : "Owner" , "mDataProp" : "owner" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" } ,
/* Conductor */ { "sTitle" : "Conductor" , "mDataProp" : "conductor" , "bVisible" : false , "sClass" : "library_conductor" , "sWidth" : "125px" },
/* Replay Gain */ { "sTitle" : "Replay Gain" , "mDataProp" : "replay_gain" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "80px" }
/* Last Modified */ { "sTitle" : "Last Modified" , "mDataProp" : "mtime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "125px" } ,
/* Last Played */ { "sTitle" : "Last Played " , "mDataProp" : "lptime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "125px" } ,
/* Length */ { "sTitle" : "Length" , "mDataProp" : "length" , "sClass" : "library_length" , "sWidth" : "80px" } ,
/* Mime */ { "sTitle" : "Mime" , "mDataProp" : "mime" , "bVisible" : false , "sClass" : "library_mime" , "sWidth" : "80px" } ,
/* Mood */ { "sTitle" : "Mood" , "mDataProp" : "mood" , "bVisible" : false , "sClass" : "library_mood" , "sWidth" : "70px" } ,
/* Owner */ { "sTitle" : "Owner" , "mDataProp" : "owner_id" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" } ,
/* Replay Gain */ { "sTitle" : "Replay Gain" , "mDataProp" : "replay_gain" , "bVisible" : false , "sClass" : "library_replay_gain" , "sWidth" : "80px" },
/* Sample Rate */ { "sTitle" : "Sample Rate" , "mDataProp" : "sample_rate" , "bVisible" : false , "sClass" : "library_sr" , "sWidth" : "80px" } ,
/* Track Number */ { "sTitle" : "Track Number" , "mDataProp" : "track_number" , "bVisible" : false , "sClass" : "library_track" , "sWidth" : "65px" } ,
/* Upload Time */ { "sTitle" : "Uploaded" , "mDataProp" : "utime" , "sClass" : "library_upload_time" , "sWidth" : "125px" } ,
/* Website */ { "sTitle" : "Website" , "mDataProp" : "info_url" , "bVisible" : false , "sClass" : "library_url" , "sWidth" : "150px" } ,
/* Year */ { "sTitle" : "Year" , "mDataProp" : "year" , "bVisible" : false , "sClass" : "library_year" , "sWidth" : "60px" }
],
"bProcessing": true,
@ -718,6 +717,7 @@ var AIRTIME = (function(AIRTIME) {
callback = function() {
var url = '/Playlist/edit';
AIRTIME.playlist.fnEdit(data.id, data.ftype, url);
AIRTIME.playlist.validatePlaylistElements();
};
} else if (data.ftype === "stream") {
callback = function() {
@ -732,6 +732,13 @@ var AIRTIME = (function(AIRTIME) {
//define a play callback.
if (oItems.play !== undefined) {
if (oItems.play.mime !== undefined) {
if (!isAudioSupported(oItems.play.mime)) {
oItems.play.disabled = true;
}
}
callback = function() {
if (data.ftype === 'playlist' && data.length !== '0.0'){
playlistIndex = $(this).parent().attr('id').substring(3); //remove the pl_
@ -929,7 +936,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",
@ -1115,13 +1122,12 @@ var validationTypes = {
"mood" : "s",
"name" : "s",
"orchestra" : "s",
"owner" : "s",
"owner_id" : "s",
"rating" : "i",
"replay_gain" : "n",
"sample_rate" : "i",
"track_title" : "s",
"track_number" : "i",
"info_url" : "s",
"year" : "i",
"lptime" : "t"
"year" : "i"
};

View file

@ -3,13 +3,13 @@ $(document).ready(function() {
$("#plupload_files").pluploadQueue({
// General settings
runtimes : 'gears, html5, html4',
url : '/Plupload/upload/format/json',
chunk_size: '5mb',
unique_names: 'true',
runtimes : 'gears, html5, html4',
url : '/Plupload/upload/format/json',
chunk_size : '5mb',
unique_names : 'true',
multiple_queues : 'true',
filters : [
{title: "Audio Files", extensions: "ogg,mp3,oga,flac,aac,wav"}
{title: "Audio Files", extensions: "ogg,mp3,oga,flac,aac,wav,m4a"}
]
});

View file

@ -346,7 +346,6 @@ var AIRTIME = (function(AIRTIME){
}
function openPlaylist(json) {
$("#side_playlist")
.empty()
.append(json.html);
@ -361,6 +360,39 @@ var AIRTIME = (function(AIRTIME){
appendModAddButton();
removeButtonCheck();
}
//Purpose of this function is to iterate over all playlist elements
//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"), 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"
},
})
}
});
}
//sets events dynamically for playlist entries (each row in the playlist)
function setPlaylistEntryEvents() {
@ -378,10 +410,8 @@ var AIRTIME = (function(AIRTIME){
$pl.delegate(".spl_cue",
{"click": openCueEditor});
//add the play function to the play icon
$pl.delegate(".big_play",
{"click": openAudioPreview});
mod.validatePlaylistElements();
$pl.delegate(".spl_block_expand",
{"click": function(ev){
var id = parseInt($(this).attr("id").split("_").pop(), 10);

View file

@ -204,6 +204,20 @@ function setSmartBlockEvents() {
/********** CRITERIA CHANGE **********/
form.find('select[id^="sp_criteria"]:not([id^="sp_criteria_modifier"])').live("change", function(){
var index = getRowIndex($(this).parent());
//need to change the criteria value for any modifier rows
var critVal = $(this).val();
var divs = $(this).parent().nextAll(':visible');
$.each(divs, function(i, div){
var critSelect = $(div).children('select[id^="sp_criteria_field"]');
if (critSelect.hasClass('sp-invisible')) {
critSelect.val(critVal);
/* If the select box is visible we know the modifier rows
* have ended
*/
} else {
return false;
}
});
// disable extra field and hide the span
disableAndHideExtraField($(this), index);
@ -520,32 +534,32 @@ function disableLoadingIcon() {
}
var criteriaTypes = {
0 : "",
"album_title" : "s",
"artist_name" : "s",
"bit_rate" : "n",
"bpm" : "n",
"comments" : "s",
"composer" : "s",
"conductor" : "s",
"utime" : "n",
"mtime" : "n",
"lptime" : "n",
"disc_number" : "n",
"genre" : "s",
"isrc_number" : "s",
"label" : "s",
"language" : "s",
"length" : "n",
"lyricist" : "s",
"mood" : "s",
"name" : "s",
"orchestra" : "s",
"rating" : "n",
"sample_rate" : "n",
"track_title" : "s",
"track_num" : "n",
"year" : "n"
0 : "",
"album_title" : "s",
"bit_rate" : "n",
"bpm" : "n",
"composer" : "s",
"conductor" : "s",
"copyright" : "s",
"artist_name" : "s",
"encoded_by" : "s",
"utime" : "n",
"mtime" : "n",
"lptime" : "n",
"genre" : "s",
"isrc_number" : "s",
"label" : "s",
"language" : "s",
"length" : "n",
"mime" : "s",
"mood" : "s",
"owner_id" : "s",
"replay_gain" : "n",
"sample_rate" : "n",
"track_title" : "s",
"track_number" : "n",
"info_url" : "s",
"year" : "n"
};
var stringCriteriaOptions = {

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long