Forgot to url encode queries

This commit is contained in:
Anders Betnér 2005-03-16 22:35:26 +00:00
parent 5a17d65d98
commit 95eb9caa99

View File

@ -225,6 +225,10 @@ function addOptions(el,label,xmldoc) {
} else { } else {
el.removeAttribute('selected'); el.removeAttribute('selected');
} }
if ('album' == label) {
//### All other boxes are updated, this is the last one, now get the songs
getSongs();
}
} }
function addPlaylists(el,xmldoc) { function addPlaylists(el,xmldoc) {
//items = xmldoc.getElementsByTagName('dmap.listingitem'); //items = xmldoc.getElementsByTagName('dmap.listingitem');
@ -343,7 +347,6 @@ function genreSelect(event) {
} }
g_requestor.addRequest('databases/1/browse/artists' + filter); g_requestor.addRequest('databases/1/browse/artists' + filter);
g_requestor.addRequest('databases/1/browse/albums' + filter); g_requestor.addRequest('databases/1/browse/albums' + filter);
getSongs();
} }
function artistSelect(event) { function artistSelect(event) {
@ -379,29 +382,35 @@ function artistSelect(event) {
filter = '?filter=' + filter.join(','); filter = '?filter=' + filter.join(',');
} }
g_requestor.addRequest('databases/1/browse/albums' + filter); g_requestor.addRequest('databases/1/browse/albums' + filter);
getSongs(); }
function albumSelect(event) {
// just get the songs, the only box changed is this one
getSongs();
} }
function getSongs() { function getSongs() {
genre = document.getElementById('genre').value; genre = document.getElementById('genre').value;
artist = document.getElementById('artist').value; artist = document.getElementById('artist').value;
album = document.getElementById('album').value; album = document.getElementById('album').value;
//alert("genre: "+genre +"\nartist: "+ artist + "\nalbum:"+ album);
query = Array(); query = Array();
if (genre != '1') { if (genre != '1') {
query.push('\'daap.songgenre:' + genre +"'"); query.push('\'daap.songgenre:' + genre.myEncodeURI() +"'");
} }
if (artist != '1') { if (artist != '1') {
query.push('\'daap.songartist:' + artist +"'"); query.push('\'daap.songartist:' + artist.myEncodeURI() +"'");
} }
if (album != '1') { if (album != '1') {
query.push('\'daap.songalbum:' + album +"'"); query.push('\'daap.songalbum:' + album.myEncodeURI() +"'");
} }
if (0 == filter.length) { if (0 == query.length) {
// If filter array is empty then "All genres" is selected // If filter array is empty then "All genres" is selected
// so set filter to empty // so set filter to empty
query = ''; query = '';
} else { } else {
query = '&query=' + query.join(','); query = '&query=' + query.join(',');
} }
//alert(query);
g_requestor.addRequest('databases/1/items' + g_requestor.addRequest('databases/1/items' +
'?meta=dmap.itemname,daap.songalbum,daap.songartist,daap.songgenre,daap.songtime'+query); '?meta=dmap.itemname,daap.songalbum,daap.songartist,daap.songgenre,daap.songtime'+query);
///items?meta=dmap.itemname,daap.songalbum,daap.songartist,daap.songgenre,daap.songtime&output=xml ///items?meta=dmap.itemname,daap.songalbum,daap.songartist,daap.songgenre,daap.songtime&output=xml