|
@@ -118,17 +118,34 @@ var getAlbums=function(callback){
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-var getAlbumByArtist=function(callback){
|
|
|
|
|
- var query = 'select album from songs group by artist order by album';
|
|
|
|
|
- connection.query(query, function(err, result) {
|
|
|
|
|
|
|
+var getAlbumByArtist=function(artist, callback){
|
|
|
|
|
+ var query = 'select album from songs where artist like ? group by album order by album';
|
|
|
|
|
+ connection.query(query, "%"+artist+"%", function(err, result) {
|
|
|
callback(result);
|
|
callback(result);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+var getAllArtistWithAlbums=function(callback){
|
|
|
|
|
+ var query = 'select artist,album from songs group by artist,album order by artist,album';
|
|
|
|
|
+ var b={};
|
|
|
|
|
+ connection.query(query, function(err, result) {
|
|
|
|
|
+ for (el in result) {
|
|
|
|
|
+ var key=result[el].artist;
|
|
|
|
|
+ if (key==null || key==undefined)
|
|
|
|
|
+ key="";
|
|
|
|
|
+ key=key.toString();
|
|
|
|
|
+ if(b[key]===undefined)
|
|
|
|
|
+ b[key]=[];
|
|
|
|
|
+ b[key].push(result[el].album);
|
|
|
|
|
+ }
|
|
|
|
|
+ callback(b);
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
module.exports.pathFromID=pathFromID;
|
|
module.exports.pathFromID=pathFromID;
|
|
|
module.exports.getArtist=getArtist;
|
|
module.exports.getArtist=getArtist;
|
|
|
module.exports.getArtists=getArtists;
|
|
module.exports.getArtists=getArtists;
|
|
|
module.exports.getAlbums=getAlbums;
|
|
module.exports.getAlbums=getAlbums;
|
|
|
|
|
+module.exports.getAlbumByArtist=getAlbumByArtist;
|
|
|
module.exports.populate=populate;
|
|
module.exports.populate=populate;
|
|
|
-
|
|
|
|
|
|
|
+module.exports.getAllArtistWithAlbums=getAllArtistWithAlbums;
|
|
|
//populate("/storage/samba/Music");
|
|
//populate("/storage/samba/Music");
|