mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 16:44:05 +02:00
[0.9 api]Implement albums view for collections
This commit is contained in:
@@ -1282,7 +1282,6 @@ Tomahawk.Collection = {
|
|||||||
{
|
{
|
||||||
var map = that.statements[originalI].map;
|
var map = that.statements[originalI].map;
|
||||||
that.results[originalI] = [];
|
that.results[originalI] = [];
|
||||||
Tomahawk.log('originalI ' + originalI);
|
|
||||||
for (var ii = 0; ii < results.rows.length; ii++) {
|
for (var ii = 0; ii < results.rows.length; ii++) {
|
||||||
that.results[originalI].push(map(
|
that.results[originalI].push(map(
|
||||||
results.rows.item(ii)
|
results.rows.item(ii)
|
||||||
@@ -1295,7 +1294,6 @@ Tomahawk.Collection = {
|
|||||||
if(that.stmtsToResolve == 0)
|
if(that.stmtsToResolve == 0)
|
||||||
{
|
{
|
||||||
that.statements = [];
|
that.statements = [];
|
||||||
Tomahawk.log(JSON.stringify(that.results));
|
|
||||||
resolve(that.results);
|
resolve(that.results);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1695,40 +1693,43 @@ Tomahawk.Collection = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
//albums: function (params, where) {
|
albums: function (params, where) {
|
||||||
////TODO filter/where support
|
//TODO filter/where support
|
||||||
//var id = params.id;
|
var id = params.id;
|
||||||
//if(typeof id === 'undefined')
|
if(typeof id === 'undefined')
|
||||||
//id = this.settings.id;
|
id = this.settings.id;
|
||||||
|
|
||||||
//var t = new Tomahawk.Collection.Transaction(this, id);
|
var t = new Tomahawk.Collection.Transaction(this, id);
|
||||||
//return t.beginTransaction().then(function () {
|
return t.beginTransaction().then(function () {
|
||||||
//var mapFn = function(row) {
|
var mapFn = function(row) {
|
||||||
//return {
|
return {
|
||||||
//albumArtist: row.artist,
|
albumArtist: row.artist,
|
||||||
//albumArtistDisambiguation: row.artistDisambiguation,
|
albumArtistDisambiguation: row.artistDisambiguation,
|
||||||
//album: row.album
|
album: row.album
|
||||||
//};
|
};
|
||||||
//};
|
};
|
||||||
//t.sqlSelect("albums",mapFn,
|
t.sqlSelect("albums",mapFn,
|
||||||
//["album", "artist", "artistDisambiguation"],
|
["album", "artist", "artistDisambiguation"],
|
||||||
//where, [
|
where, [
|
||||||
//{
|
{
|
||||||
//table: "artists",
|
table: "artists",
|
||||||
//conditions: {
|
conditions: {
|
||||||
//albumArtistId: "_id"
|
albumArtistId: "_id"
|
||||||
//}
|
}
|
||||||
//}
|
}
|
||||||
//]
|
]
|
||||||
//);
|
);
|
||||||
//return t.execDefferedStatements();
|
return t.execDefferedStatements();
|
||||||
//}).then(function (results) {
|
}).then(function (results) {
|
||||||
//return {
|
results = results[0].filter(function(e){
|
||||||
//artists: results[0].map(function(i){ return i.albumArtist;}),
|
return (e.albumArtist != '' && e.album != '');
|
||||||
//albums: results[0].map(function(i){ return i.album;})
|
});
|
||||||
//};
|
return {
|
||||||
//});
|
artists: results.map(function(i){ return i.albumArtist;}),
|
||||||
//},
|
albums: results.map(function(i){ return i.album;})
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
artists: function (params) {
|
artists: function (params) {
|
||||||
//TODO filter/where support
|
//TODO filter/where support
|
||||||
|
Reference in New Issue
Block a user