mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-08 07:07:05 +02:00
[api 0.9] fix track number in collection, add release year and bitrate to collection storage
This commit is contained in:
@@ -1238,6 +1238,8 @@ Tomahawk.Collection = {
|
|||||||
"duration INTEGER," +
|
"duration INTEGER," +
|
||||||
"albumPos INTEGER," +
|
"albumPos INTEGER," +
|
||||||
"linkUrl TEXT," +
|
"linkUrl TEXT," +
|
||||||
|
'releaseyear INTEGER,' +
|
||||||
|
'bitrate INTEGER,' +
|
||||||
"UNIQUE (track, artistId, albumId) ON CONFLICT IGNORE," +
|
"UNIQUE (track, artistId, albumId) ON CONFLICT IGNORE," +
|
||||||
"FOREIGN KEY(artistId) REFERENCES artists(_id)," +
|
"FOREIGN KEY(artistId) REFERENCES artists(_id)," +
|
||||||
"FOREIGN KEY(albumId) REFERENCES albums(_id))", []);
|
"FOREIGN KEY(albumId) REFERENCES albums(_id))", []);
|
||||||
@@ -1312,17 +1314,6 @@ Tomahawk.Collection = {
|
|||||||
|
|
||||||
this.sql = function (sqlStatement, sqlArgs, mapFunction) {
|
this.sql = function (sqlStatement, sqlArgs, mapFunction) {
|
||||||
this.statements.push({statement: sqlStatement, args: sqlArgs, map: mapFunction});
|
this.statements.push({statement: sqlStatement, args: sqlArgs, map: mapFunction});
|
||||||
//var that = this;
|
|
||||||
//return new RSVP.Promise(function (resolve, reject) {
|
|
||||||
//that.tx.executeSql(sqlStatement, sqlArgs,
|
|
||||||
//function (tx, results) {
|
|
||||||
//resolve(results);
|
|
||||||
//}, function (tx, error) {
|
|
||||||
//Tomahawk.log("Error in tx.executeSql: " + error.code + " - "
|
|
||||||
//+ error.message);
|
|
||||||
//reject(error);
|
|
||||||
//});
|
|
||||||
//})
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.sqlSelect = function (table, mapResults, fields, where, join) {
|
this.sqlSelect = function (table, mapResults, fields, where, join) {
|
||||||
@@ -1520,7 +1511,9 @@ Tomahawk.Collection = {
|
|||||||
url: track.url,
|
url: track.url,
|
||||||
duration: track.duration,
|
duration: track.duration,
|
||||||
linkUrl: track.linkUrl,
|
linkUrl: track.linkUrl,
|
||||||
albumPos: track.albumPos
|
releaseyear: track.releaseyear,
|
||||||
|
bitrate: track.bitrate,
|
||||||
|
albumPos: track.albumpos
|
||||||
});
|
});
|
||||||
})(tracks[i]);
|
})(tracks[i]);
|
||||||
}
|
}
|
||||||
@@ -1601,14 +1594,16 @@ Tomahawk.Collection = {
|
|||||||
duration: row.duration,
|
duration: row.duration,
|
||||||
url: row.url,
|
url: row.url,
|
||||||
linkUrl: row.linkUrl,
|
linkUrl: row.linkUrl,
|
||||||
albumPos: row.albumPos
|
releaseyear: row.releaseyear,
|
||||||
|
bitrate: row.bitrate,
|
||||||
|
albumpos: row.albumPos
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
for (var idx = 0; resultIds && idx < resultIds.length; idx++) {
|
for (var idx = 0; resultIds && idx < resultIds.length; idx++) {
|
||||||
var trackid = resultIds[idx][0];
|
var trackid = resultIds[idx][0];
|
||||||
var where = { _id : trackid };
|
var where = { _id : trackid };
|
||||||
t.sqlSelect("tracks",mapFn,
|
t.sqlSelect("tracks",mapFn,
|
||||||
["artist", "artistDisambiguation", "album", "track", "duration", "url", "linkUrl"],
|
[],
|
||||||
where, [
|
where, [
|
||||||
{
|
{
|
||||||
table: "artists",
|
table: "artists",
|
||||||
@@ -1668,11 +1663,13 @@ Tomahawk.Collection = {
|
|||||||
duration: row.duration,
|
duration: row.duration,
|
||||||
url: row.url,
|
url: row.url,
|
||||||
linkUrl: row.linkUrl,
|
linkUrl: row.linkUrl,
|
||||||
albumPos: row.albumPos
|
releaseyear: row.releaseyear,
|
||||||
|
bitrate: row.bitrate,
|
||||||
|
albumpos: row.albumPos
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
t.sqlSelect("tracks",mapFn,
|
t.sqlSelect("tracks",mapFn,
|
||||||
["artist", "artistDisambiguation", "album", "track", "duration", "url", "linkUrl"],
|
[],
|
||||||
where, [
|
where, [
|
||||||
{
|
{
|
||||||
table: "artists",
|
table: "artists",
|
||||||
|
Reference in New Issue
Block a user