Auto Playlist options by Folder loaded dynamically
This commit is contained in:
parent
28c2ec5835
commit
c19b3e607d
1 changed files with 47 additions and 3 deletions
|
@ -236,15 +236,25 @@ function getAlbumListBy(id) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getRandomSongList(action, appendto) {
|
function getRandomSongList(action, appendto, genre, folder) {
|
||||||
var size;
|
var size,gstring;
|
||||||
|
gstring = '';
|
||||||
if ($.cookie('AutoPlaylistSize') === null) {
|
if ($.cookie('AutoPlaylistSize') === null) {
|
||||||
size = 25;
|
size = 25;
|
||||||
} else {
|
} else {
|
||||||
size = $.cookie('AutoPlaylistSize');
|
size = $.cookie('AutoPlaylistSize');
|
||||||
}
|
}
|
||||||
|
if (genre !== undefined) {
|
||||||
|
gstring = '&genre=' + genre;
|
||||||
|
}
|
||||||
|
if (genre === 'Random') {
|
||||||
|
gstring = '';
|
||||||
|
}
|
||||||
|
if (folder !== undefined) {
|
||||||
|
gstring = '&musicFolderId=' + folder;
|
||||||
|
}
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: baseURL + '/getRandomSongs.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp&size=' + size,
|
url: baseURL + '/getRandomSongs.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp&size=' + size + gstring,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
|
@ -406,6 +416,40 @@ function search(type, query) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadFolders(refresh) {
|
||||||
|
if (debug) { console.log("LOAD FOLDERS"); }
|
||||||
|
if (refresh) {
|
||||||
|
$('#FolderContainer').empty();
|
||||||
|
}
|
||||||
|
var content = $('#FolderContainer').html();
|
||||||
|
if (content === "") {
|
||||||
|
// Load Folders
|
||||||
|
$.ajax({
|
||||||
|
url: baseURL + '/getMusicFolders.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp',
|
||||||
|
method: 'GET',
|
||||||
|
dataType: 'jsonp',
|
||||||
|
timeout: 10000,
|
||||||
|
success: function (data) {
|
||||||
|
var musicFolders = [];
|
||||||
|
if (data["subsonic-response"].musicFolders.musicFolder.length > 0) {
|
||||||
|
musicFolders = data["subsonic-response"].musicFolders.musicFolder;
|
||||||
|
} else {
|
||||||
|
musicFolders[0] = data["subsonic-response"].musicFolders.musicFolder;
|
||||||
|
}
|
||||||
|
$.each(musicFolders, function (i, musicFolder) {
|
||||||
|
var html = "";
|
||||||
|
html += '<li id=\"' + musicFolder.id + '\" class=\"item\" data-folder=\"' + musicFolder.id + '\">';
|
||||||
|
html += '<span>' + musicFolder.name + '</span>';
|
||||||
|
html += '<div class=\"floatright\"><a class=\"play\" href=\"\" data-folder=\"' + musicFolder.id + '\" title=\"Play\"></a></div>';
|
||||||
|
html += '<div class=\"floatright\"><a class=\"add\" href=\"\" data-folder=\"' + musicFolder.id + '\" title=\"Add To Current Playlist\"></a></div>';
|
||||||
|
html += '</li>';
|
||||||
|
$(html).appendTo("#FolderContainer");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function loadPlaylists(refresh) {
|
function loadPlaylists(refresh) {
|
||||||
if (debug) { console.log("LOAD PLAYLISTS"); }
|
if (debug) { console.log("LOAD PLAYLISTS"); }
|
||||||
if (refresh) {
|
if (refresh) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue