playlist.js: Possible to browse playlists
This commit is contained in:
parent
476ee42faf
commit
453aa41077
|
@ -36,7 +36,18 @@ var Search = {
|
||||||
};
|
};
|
||||||
var EventHandler = {
|
var EventHandler = {
|
||||||
sourceChange: function (e) {
|
sourceChange: function (e) {
|
||||||
alert('Playlist id:'+$('source').value);
|
Query.clearSelection('genres');
|
||||||
|
Query.clearSelection('artists');
|
||||||
|
Query.clearSelection('albums');
|
||||||
|
Query.setSearchString('');
|
||||||
|
Field.clear('search');
|
||||||
|
var playlistId = $('source').value;
|
||||||
|
if (1 == playlistId) {
|
||||||
|
Query.playlistUrl = '';
|
||||||
|
} else {
|
||||||
|
Query.playlistUrl = 'containers/' + playlistId + '/';
|
||||||
|
}
|
||||||
|
Query.send('genres');
|
||||||
},
|
},
|
||||||
search: function () {
|
search: function () {
|
||||||
Query.setSearchString($('search').value);
|
Query.setSearchString($('search').value);
|
||||||
|
@ -68,6 +79,8 @@ var EventHandler = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var Query = {
|
var Query = {
|
||||||
|
baseUrl: '/databases/1/',
|
||||||
|
playlistUrl: '',
|
||||||
genres: [],
|
genres: [],
|
||||||
artists:[],
|
artists:[],
|
||||||
albums: [],
|
albums: [],
|
||||||
|
@ -137,19 +150,19 @@ var Query = {
|
||||||
var index = '';
|
var index = '';
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'genres':
|
case 'genres':
|
||||||
url = '/databases/1/browse/genres';
|
url = 'browse/genres';
|
||||||
handler = ResponseHandler.genreAlbumArtist;
|
handler = ResponseHandler.genreAlbumArtist;
|
||||||
break;
|
break;
|
||||||
case 'artists':
|
case 'artists':
|
||||||
url = '/databases/1/browse/artists';
|
url = 'browse/artists';
|
||||||
handler = ResponseHandler.genreAlbumArtist;
|
handler = ResponseHandler.genreAlbumArtist;
|
||||||
break;
|
break;
|
||||||
case 'albums':
|
case 'albums':
|
||||||
url = '/databases/1/browse/albums';
|
url = 'browse/albums';
|
||||||
handler = ResponseHandler.genreAlbumArtist;
|
handler = ResponseHandler.genreAlbumArtist;
|
||||||
break;
|
break;
|
||||||
case 'songs':
|
case 'songs':
|
||||||
url = '/databases/1/items';
|
url = 'items';
|
||||||
meta = '&meta=daap.songalbum,daap.songartist,daap.songgenre,dmap.itemid,daap.songtime,dmap.itemname';
|
meta = '&meta=daap.songalbum,daap.songartist,daap.songgenre,dmap.itemid,daap.songtime,dmap.itemname';
|
||||||
index = '&index=0-50';
|
index = '&index=0-50';
|
||||||
handler = rsSongs;
|
handler = rsSongs;
|
||||||
|
@ -158,7 +171,7 @@ var Query = {
|
||||||
alert("Shouldn't happen 2");
|
alert("Shouldn't happen 2");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
url = url + '?output=xml' + index + meta + this.getUrl(type);
|
url = this.baseUrl + this.playlistUrl + url + '?output=xml' + index + meta + this.getUrl(type);
|
||||||
new Ajax.Request(url ,{method: 'get',onComplete:handler});
|
new Ajax.Request(url ,{method: 'get',onComplete:handler});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue