diff --git a/data/js/tomahawk.js b/data/js/tomahawk.js index e14927d91..4563f60ef 100644 --- a/data/js/tomahawk.js +++ b/data/js/tomahawk.js @@ -62,8 +62,12 @@ RSVP.on('error', function (reason) { * (version1 > version2) == 1 */ Tomahawk.versionCompare = function (version1, version2) { - var v1 = version1.split('.').map(function (item) { return parseInt(item); }); - var v2 = version2.split('.').map(function (item) { return parseInt(item); }); + var v1 = version1.split('.').map(function (item) { + return parseInt(item); + }); + var v2 = version2.split('.').map(function (item) { + return parseInt(item); + }); var length = Math.max(v1.length, v2.length); var i = 0; @@ -79,7 +83,7 @@ Tomahawk.versionCompare = function (version1, version2) { return -1; } } else if (typeof v2[i] == "undefined" || v2[i] === null) { - if ( v1[i] === 0 ) { + if (v1[i] === 0) { continue; } else { // v1 > v2 @@ -104,7 +108,6 @@ Tomahawk.atLeastVersion = function (version) { return (Tomahawk.versionCompare(Tomahawk.apiVersion, version) >= 0); }; - Tomahawk.resolver = { scriptPath: Tomahawk.resolverData().scriptPath }; @@ -113,14 +116,14 @@ Tomahawk.timestamp = function () { return Math.round(new Date() / 1000); }; -Tomahawk.htmlDecode = (function() { +Tomahawk.htmlDecode = (function () { // this prevents any overhead from creating the object each time var element = document.createElement('textarea'); - function decodeHTMLEntities (str) { - if(str && typeof str === 'string') { - str = str.replace(//g,">"); + function decodeHTMLEntities(str) { + if (str && typeof str === 'string') { + str = str.replace(//g, ">"); element.innerHTML = str; str = element.textContent; element.textContent = ''; @@ -133,10 +136,9 @@ Tomahawk.htmlDecode = (function() { })(); Tomahawk.dumpResult = function (result) { - var results = result.results, - i = 0; + var results = result.results; Tomahawk.log("Dumping " + results.length + " results for query " + result.qid + "..."); - for (i = 0; i < results.length; i++) { + for (var i = 0; i < results.length; i++) { Tomahawk.log(results[i].artist + " - " + results[i].track + " | " + results[i].url); } @@ -156,7 +158,6 @@ Tomahawk.extend = function (object, members) { return newObject; }; - var TomahawkResolverCapability = { NullCapability: 0, Browsable: 1, @@ -188,7 +189,7 @@ var TomahawkConfigTestResultType = { * Resolver BaseObject, inherit it to implement your own resolver. */ var TomahawkResolver = { - init: function() { + init: function () { }, scriptPath: function () { return Tomahawk.resolverData().scriptPath; @@ -201,7 +202,7 @@ var TomahawkResolver = { }, saveUserConfig: function () { var configJson = JSON.stringify(Tomahawk.resolverData().config); - window.localStorage[ this.scriptPath() ] = configJson; + window.localStorage[this.scriptPath()] = configJson; this.newConfigSaved(); }, newConfigSaved: function () { @@ -212,7 +213,7 @@ var TomahawkResolver = { }; }, search: function (qid, searchString) { - return this.resolve( qid, "", "", searchString ); + return this.resolve(qid, "", "", searchString); }, artists: function (qid) { return { @@ -233,8 +234,8 @@ var TomahawkResolver = { return {}; }, _testConfig: function (config) { - return Promise.resolve(this.testConfig(config)).then(function() { - return { result: Tomahawk.ConfigTestResultType.Success }; + return Promise.resolve(this.testConfig(config)).then(function () { + return {result: Tomahawk.ConfigTestResultType.Success}; }); }, testConfig: function () { @@ -267,10 +268,10 @@ Tomahawk.Resolver = { return params; }, - _convertUrls: function(results) { + _convertUrls: function (results) { var that = this; - return results.map(function(r){ - if(r && r.url) { + return results.map(function (r) { + if (r && r.url) { r.url = that._urlProtocol + '://' + r.url; } return r; @@ -280,15 +281,20 @@ Tomahawk.Resolver = { _adapter_resolve: function (qid, artist, album, title) { var that = this; var collectionPromises = []; - Tomahawk.collections.forEach(function(col) { - if(col.resolve) - collectionPromises.push(col.resolve({artist: artist, album: album, track:title})); + Tomahawk.collections.forEach(function (col) { + if (col.resolve) { + collectionPromises.push(col.resolve({artist: artist, album: album, track: title})); + } }); - Promise.all(collectionPromises).then(function(collectionResults){ + Promise.all(collectionPromises).then(function (collectionResults) { var merged = []; - return merged.concat.apply(merged,collectionResults); - }).then(function(collectionResults) { - Promise.resolve(that.resolve({artist: artist, album: album, track:title})).then(function(results){ + return merged.concat.apply(merged, collectionResults); + }).then(function (collectionResults) { + Promise.resolve(that.resolve({ + artist: artist, + album: album, + track: title + })).then(function (results) { Tomahawk.addTrackResults({ 'qid': qid, 'results': that._convertUrls(results.concat(collectionResults)) @@ -297,34 +303,33 @@ Tomahawk.Resolver = { }); }, - _adapter_init: function () - { + _adapter_init: function () { this._urlProtocol = this.settings.name.replace(/[^a-zA-Z]/g, '').toLowerCase(); - Tomahawk.addCustomUrlHandler( this._urlProtocol, 'getStreamUrl', true ); + Tomahawk.addCustomUrlHandler(this._urlProtocol, 'getStreamUrl', true); Tomahawk.log('Registered custom url handler for protocol "' + this._urlProtocol + '"'); this.init(); }, _adapter_getStreamUrl: function (params) { params.url = params.url.slice(this._urlProtocol.length + 3); - Promise.resolve(this.getStreamUrl(params)).then(function(result){ + Promise.resolve(this.getStreamUrl(params)).then(function (result) { Tomahawk.reportStreamUrl(params.qid, result.url, result.headers); }); }, - _adapter_search: function (qid, query) - { + _adapter_search: function (qid, query) { var that = this; var collectionPromises = []; - Tomahawk.collections.forEach(function(col) { - if(col.search) + Tomahawk.collections.forEach(function (col) { + if (col.search) { collectionPromises.push(col.search({query: query})); + } }); - Promise.all(collectionPromises).then(function(collectionResults){ + Promise.all(collectionPromises).then(function (collectionResults) { var merged = []; - return merged.concat.apply(merged,collectionResults); - }).then(function(collectionResults) { - Promise.resolve(that.search({query:query})).then(function(results){ + return merged.concat.apply(merged, collectionResults); + }).then(function (collectionResults) { + Promise.resolve(that.search({query: query})).then(function (results) { Tomahawk.addTrackResults({ 'qid': qid, 'results': that._convertUrls(results.concat(collectionResults)) @@ -334,8 +339,8 @@ Tomahawk.Resolver = { }, _adapter_testConfig: function (config) { - return Promise.resolve(this.testConfig(config)).then(function() { - return { result: Tomahawk.ConfigTestResultType.Success }; + return Promise.resolve(this.testConfig(config)).then(function () { + return {result: Tomahawk.ConfigTestResultType.Success}; }); } }; @@ -469,7 +474,7 @@ Tomahawk.retrieveMetadata = function (url, mimetype, sizehint, options, callback * * Internal use only! */ -Tomahawk.retrievedMetadata = function(metadataId, metadata, error) { +Tomahawk.retrievedMetadata = function (metadataId, metadata, error) { // Check that we have a matching callback stored. if (!Tomahawk.retrieveMetadataCallbacks.hasOwnProperty(metadataId)) { return; @@ -558,7 +563,8 @@ Tomahawk.asyncRequest = function (url, callback, extraHeaders, options) { } } xmlHttpRequest.onreadystatechange = function () { - if (xmlHttpRequest.readyState == 4 && httpSuccessStatuses.indexOf(xmlHttpRequest.status) != -1) { + if (xmlHttpRequest.readyState == 4 + && httpSuccessStatuses.indexOf(xmlHttpRequest.status) != -1) { callback.call(window, xmlHttpRequest); } else if (xmlHttpRequest.readyState === 4) { Tomahawk.log("Failed to do " + method + " request: to: " + url); @@ -585,7 +591,7 @@ var shouldDoNativeRequest = function (url, callback, extraHeaders, options) { || extraHeaders.hasOwnProperty("User-Agent"))); }; -Tomahawk.ajax = function(url, settings) { +Tomahawk.ajax = function (url, settings) { if (typeof url === "object") { settings = url; } else { @@ -598,10 +604,10 @@ Tomahawk.ajax = function(url, settings) { settings.dataFormat = settings.dataFormat || 'form'; if (settings.data) { - var formEncode = function(obj) { + var formEncode = function (obj) { var str = []; - for(var p in obj) { - if(obj[p] !== undefined) { + for (var p in obj) { + if (obj[p] !== undefined) { if (Array.isArray(obj[p])) { for (var i = 0; i < obj[p].length; i++) { str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p][i])); @@ -624,7 +630,8 @@ Tomahawk.ajax = function(url, settings) { settings.data = JSON.stringify(settings.data); settings.contentType = settings.contentType || 'application/json'; } else { - throw new Error("Tomahawk.ajax: unknown dataFormat requested: " + settings.dataFormat); + throw new Error("Tomahawk.ajax: unknown dataFormat requested: " + + settings.dataFormat); } } else { throw new Error("Tomahawk.ajax: data should be either object or string"); @@ -644,7 +651,7 @@ Tomahawk.ajax = function(url, settings) { return new Promise(function (resolve, reject) { settings.errorHandler = reject; Tomahawk.asyncRequest(settings.url, resolve, settings.headers, settings); - }).then(function(xhr) { + }).then(function (xhr) { if (settings.rawResponse) { return xhr; } @@ -675,7 +682,7 @@ Tomahawk.ajax = function(url, settings) { }); }; -Tomahawk.post = function(url, settings) { +Tomahawk.post = function (url, settings) { if (typeof url === "object") { settings = url; } else { @@ -688,7 +695,7 @@ Tomahawk.post = function(url, settings) { return Tomahawk.ajax(settings); }; -Tomahawk.get = function(url, settings) { +Tomahawk.get = function (url, settings) { return Tomahawk.ajax(url, settings); }; @@ -696,10 +703,10 @@ Tomahawk.assert = function (assertion, message) { Tomahawk.nativeAssert(assertion, message); }; -Tomahawk.sha256 = Tomahawk.sha256 || function(message) { +Tomahawk.sha256 = Tomahawk.sha256 || function (message) { return CryptoJS.SHA256(message).toString(CryptoJS.enc.Hex); }; -Tomahawk.md5 = Tomahawk.md5 || function(message) { +Tomahawk.md5 = Tomahawk.md5 || function (message) { return CryptoJS.MD5(message).toString(CryptoJS.enc.Hex); }; // Return a HMAC (md5) signature of the input text with the desired key @@ -823,19 +830,19 @@ Tomahawk.hmac = function (key, message) { })(); Tomahawk.removeDiacritics = function (str) { - return str.replace(/[^\u0000-\u007E]/g, function(c) { + return str.replace(/[^\u0000-\u007E]/g, function (c) { return Tomahawk.diacriticsMap[c] || c; }); }; Tomahawk.localStorage = Tomahawk.localStorage || { - setItem: function(key, value) { + setItem: function (key, value) { window.localStorage[key] = value; }, - getItem: function(key) { + getItem: function (key) { return window.localStorage[key]; }, - removeItem: function(key) { + removeItem: function (key) { delete window.localStorage[key]; } }; @@ -843,14 +850,18 @@ Tomahawk.localStorage = Tomahawk.localStorage || { // some aliases Tomahawk.setTimeout = Tomahawk.setTimeout || window.setTimeout; Tomahawk.setInterval = Tomahawk.setInterval || window.setInterval; -Tomahawk.base64Decode = function(a) { return window.atob(a); }; -Tomahawk.base64Encode = function(b) { return window.btoa(b); }; +Tomahawk.base64Decode = function (a) { + return window.atob(a); +}; +Tomahawk.base64Encode = function (b) { + return window.btoa(b); +}; Tomahawk.PluginManager = { objects: {}, objectCounter: 0, identifyObject: function (object) { - if( !object.hasOwnProperty('id') ) { + if (!object.hasOwnProperty('id')) { object.id = this.objectCounter++; } @@ -858,8 +869,7 @@ Tomahawk.PluginManager = { }, registerPlugin: function (type, object) { this.objects[this.identifyObject(object)] = object; - if (type === 'collection') - { + if (type === 'collection') { Tomahawk.collections.push(object); } @@ -867,7 +877,7 @@ Tomahawk.PluginManager = { Tomahawk.registerScriptPlugin(type, object.id); }, - unregisterPlugin: function(type, object) { + unregisterPlugin: function (type, object) { this.objects[this.identifyObject(object)] = object; Tomahawk.log("unregisterPlugin: " + type + " id: " + object.id); @@ -879,7 +889,7 @@ Tomahawk.PluginManager = { if (!Tomahawk.resolver.instance.apiVersion || Tomahawk.resolver.instance.apiVersion < 0.9) { if (methodName === 'artistAlbums') { methodName = 'albums'; - } else if ( methodName === 'albumTracks' ) { + } else if (methodName === 'albumTracks') { methodName = 'tracks'; } } @@ -894,7 +904,8 @@ Tomahawk.PluginManager = { } if (typeof this.objects[objectId][methodName] === 'function') { - if (!Tomahawk.resolver.instance.apiVersion || Tomahawk.resolver.instance.apiVersion < 0.9) { + if (!Tomahawk.resolver.instance.apiVersion + || Tomahawk.resolver.instance.apiVersion < 0.9) { if (methodName == 'artists') { return new Promise(function (resolve, reject) { pluginManager.resolve[requestId] = resolve; @@ -940,18 +951,19 @@ Tomahawk.PluginManager = { return this.objects[objectId][methodName]; }, - invoke: function (requestId, objectId, methodName, params ) { - Promise.resolve(this.invokeSync(requestId, objectId, methodName, params)).then(function (result) { - Tomahawk.reportScriptJobResults({ - requestId: requestId, - data: result + invoke: function (requestId, objectId, methodName, params) { + Promise.resolve(this.invokeSync(requestId, objectId, methodName, params)) + .then(function (result) { + Tomahawk.reportScriptJobResults({ + requestId: requestId, + data: result + }); + }, function (error) { + Tomahawk.reportScriptJobResults({ + requestId: requestId, + error: error + }); }); - }, function (error) { - Tomahawk.reportScriptJobResults({ - requestId: requestId, - error: error - }); - }); } }; @@ -1257,8 +1269,6 @@ Tomahawk.Collection = { Transaction: function (collection, id) { this.ensureDb = function () { - var that = this; - return new RSVP.Promise(function (resolve, reject) { if (!collection.cachedDbs.hasOwnProperty(id)) { Tomahawk.log("Opening database"); @@ -1332,14 +1342,14 @@ Tomahawk.Collection = { var that = this; that.stmtsToResolve = that.statements.length; that.results = that.statements.slice(); - Tomahawk.log('Executing ' + that.stmtsToResolve + ' deffered SQL statements in transaction'); + Tomahawk.log('Executing ' + that.stmtsToResolve + + ' deferred SQL statements in transaction'); return new Promise(function (resolve, reject) { - if (that.statements.length == 0) + if (that.statements.length == 0) { resolve([]); - else{ + } else { that.db.transaction(function (tx) { - for (var i = 0; i < that.statements.length; ++i) - { + for (var i = 0; i < that.statements.length; ++i) { var stmt = that.statements[i]; tx.executeSql(stmt.statement, stmt.args, (function () { @@ -1347,8 +1357,7 @@ Tomahawk.Collection = { //capture value of i var originalI = i; return function (tx, results) { - if (typeof that.statements[originalI].map !== 'undefined') - { + if (typeof that.statements[originalI].map !== 'undefined') { var map = that.statements[originalI].map; that.results[originalI] = []; for (var ii = 0; ii < results.rows.length; ii++) { @@ -1357,11 +1366,11 @@ Tomahawk.Collection = { )); } } - else + else { that.results[originalI] = results; + } that.stmtsToResolve--; - if(that.stmtsToResolve == 0) - { + if (that.stmtsToResolve == 0) { that.statements = []; resolve(that.results); } @@ -1377,11 +1386,11 @@ Tomahawk.Collection = { }); } }); - }, + }; - this.sql = function (sqlStatement, sqlArgs, mapFunction) { - this.statements.push({statement: sqlStatement, args: sqlArgs, map: mapFunction}); - }; + this.sql = function (sqlStatement, sqlArgs, mapFunction) { + this.statements.push({statement: sqlStatement, args: sqlArgs, map: mapFunction}); + }; this.sqlSelect = function (table, mapResults, fields, where, join) { var whereKeys = []; @@ -1435,6 +1444,7 @@ Tomahawk.Collection = { }; }, + addTracks: function (params) { var that = this; var id = params.id; @@ -1474,14 +1484,14 @@ Tomahawk.Collection = { return t.execDefferedStatements(); }).then(function () { // Get all artists' and albumArtists' db ids - t.sqlSelect("albumArtists", function(r) { + t.sqlSelect("albumArtists", function (r) { return { albumArtist: r.albumArtist, albumArtistDisambiguation: r.albumArtistDisambiguation, _id: r._id }; }); - t.sqlSelect("artists", function(r) { + t.sqlSelect("artists", function (r) { return { artist: r.artist, artistDisambiguation: r.artistDisambiguation, @@ -1524,7 +1534,6 @@ Tomahawk.Collection = { } }).then(function () { // Insert all albums - var promises = []; for (var i = 0; i < tracks.length; i++) { (function (track) { var albumArtistId = cachedAlbumArtists[track.album].albumArtistId; @@ -1537,7 +1546,7 @@ Tomahawk.Collection = { return t.execDefferedStatements(); }).then(function () { // Get the albums' db ids - t.sqlSelect("albums", function(r) { + t.sqlSelect("albums", function (r) { return { album: r.album, albumArtistId: r.albumArtistId, @@ -1558,7 +1567,6 @@ Tomahawk.Collection = { } }).then(function () { // Now we are ready to insert the tracks - var promises = []; for (var i = 0; i < tracks.length; i++) { (function (track) { // Get all relevant ids that we stored in the previous steps @@ -1588,7 +1596,7 @@ Tomahawk.Collection = { }).then(function () { var resultMap = function (r) { return { - _id : r._id, + _id: r._id, artistId: r.artistId, albumId: r.albumId, track: r.track @@ -1646,13 +1654,13 @@ Tomahawk.Collection = { }); }, - _fuzzyIndexIdsToTracks: function(resultIds, id) { - var that = this; - if(typeof id === 'undefined') + _fuzzyIndexIdsToTracks: function (resultIds, id) { + if (typeof id === 'undefined') { id = this.settings.id; + } var t = new Tomahawk.Collection.Transaction(this, id); return t.beginTransaction().then(function () { - var mapFn = function(row) { + var mapFn = function (row) { return { artist: row.artist, artistDisambiguation: row.artistDisambiguation, @@ -1668,8 +1676,8 @@ Tomahawk.Collection = { }; for (var idx = 0; resultIds && idx < resultIds.length; idx++) { var trackid = resultIds[idx][0]; - var where = { _id : trackid }; - t.sqlSelect("tracks",mapFn, + var where = {_id: trackid}; + t.sqlSelect("tracks", mapFn, [], where, [ { @@ -1690,25 +1698,19 @@ Tomahawk.Collection = { }).then(function (results) { var merged = []; return merged.concat.apply(merged, - results.map(function(e){ + results.map(function (e) { //every result has one track return e[0]; })); }); }, - resolve: function(params) { - var id = params.id; - if(typeof id === 'undefined') - id = this.settings.id; + resolve: function (params) { var resultIds = Tomahawk.resolveFromFuzzyIndex(params.artist, params.album, params.track); return this._fuzzyIndexIdsToTracks(resultIds); }, - search: function(params) { - var id = params.id; - if(typeof id === 'undefined') - id = this.settings.id; + search: function (params) { var resultIds = Tomahawk.searchFuzzyIndex(params.query); return this._fuzzyIndexIdsToTracks(resultIds); }, @@ -1716,12 +1718,13 @@ Tomahawk.Collection = { tracks: function (params, where) { //TODO filter/where support var id = params.id; - if(typeof id === 'undefined') + if (typeof id === 'undefined') { id = this.settings.id; + } var t = new Tomahawk.Collection.Transaction(this, id); return t.beginTransaction().then(function () { - var mapFn = function(row) { + var mapFn = function (row) { return { artist: row.artist, artistDisambiguation: row.artistDisambiguation, @@ -1735,7 +1738,7 @@ Tomahawk.Collection = { albumpos: row.albumPos }; }; - t.sqlSelect("tracks",mapFn, + t.sqlSelect("tracks", mapFn, [], where, [ { @@ -1760,19 +1763,20 @@ Tomahawk.Collection = { albums: function (params, where) { //TODO filter/where support var id = params.id; - if(typeof id === 'undefined') + if (typeof id === 'undefined') { id = this.settings.id; + } var t = new Tomahawk.Collection.Transaction(this, id); return t.beginTransaction().then(function () { - var mapFn = function(row) { + var mapFn = function (row) { return { albumArtist: row.artist, albumArtistDisambiguation: row.artistDisambiguation, album: row.album }; }; - t.sqlSelect("albums",mapFn, + t.sqlSelect("albums", mapFn, ["album", "artist", "artistDisambiguation"], where, [ { @@ -1785,12 +1789,16 @@ Tomahawk.Collection = { ); return t.execDefferedStatements(); }).then(function (results) { - results = results[0].filter(function(e){ + results = results[0].filter(function (e) { return (e.albumArtist != '' && e.album != ''); }); - return { - artists: results.map(function(i){ return i.albumArtist;}), - albums: results.map(function(i){ return i.album;}) + return { + artists: results.map(function (i) { + return i.albumArtist; + }), + albums: results.map(function (i) { + return i.album; + }) }; }); }, @@ -1798,13 +1806,13 @@ Tomahawk.Collection = { artists: function (params) { //TODO filter/where support var id = params.id; - if(typeof id === 'undefined') + if (typeof id === 'undefined') { id = this.settings.id; + } var t = new Tomahawk.Collection.Transaction(this, id); return t.beginTransaction().then(function () { - var mapFn = function(r) - { + var mapFn = function (r) { return r.artist; }; t.sqlSelect("artists", mapFn, ["artist", "artistDisambiguation"]); @@ -1836,26 +1844,29 @@ Tomahawk.Collection = { artistAlbums: function (params) { //TODO filter/where support var id = params.id; - if(typeof id === 'undefined') + if (typeof id === 'undefined') { id = this.settings.id; + } var artist = params.artist; //var artistDisambiguation = params.artistDisambiguation; - var that = this; - var t = new Tomahawk.Collection.Transaction(this, id); return t.beginTransaction().then(function () { - t.sqlSelect("artists",function(r){return r._id;}, ["_id"], { + t.sqlSelect("artists", function (r) { + return r._id; + }, ["_id"], { artist: artist //artistDisambiguation: artistDisambiguation }); return t.execDefferedStatements(); }).then(function (results) { var artistId = results[0][0]; - t.sqlSelect("artistAlbums",function(r){return r.album;}, ["albumId", 'album'], { + t.sqlSelect("artistAlbums", function (r) { + return r.album; + }, ["albumId", 'album'], { artistId: artistId - },[ + }, [ { table: "albums", conditions: { @@ -1875,8 +1886,9 @@ Tomahawk.Collection = { albumTracks: function (params) { //TODO filter/where support var id = params.id; - if(typeof id === 'undefined') + if (typeof id === 'undefined') { id = this.settings.id; + } var albumArtist = params.artist; //var albumArtistDisambiguation = params.albumArtistDisambiguation; var album = params.album; @@ -1885,14 +1897,18 @@ Tomahawk.Collection = { var t = new Tomahawk.Collection.Transaction(this, id); return t.beginTransaction().then(function () { - t.sqlSelect("artists", function(r){return r._id;},["_id"], { - artist: albumArtist, + t.sqlSelect("artists", function (r) { + return r._id; + }, ["_id"], { + artist: albumArtist //artistDisambiguation: albumArtistDisambiguation }); return t.execDefferedStatements(); }).then(function (results) { var albumArtistId = results[0][0]; - t.sqlSelect("albums",function(r){return r._id;}, ["_id"], { + t.sqlSelect("albums", function (r) { + return r._id; + }, ["_id"], { album: album, albumArtistId: albumArtistId }); @@ -1907,15 +1923,16 @@ Tomahawk.Collection = { collection: function () { this.settings.trackcount = this._trackCount; - if(! this.settings.description) + if (!this.settings.description) { this.settings.description = this.settings.prettyname; + } this.settings.capabilities = [Tomahawk.Collection.BrowseCapability.Artists, - Tomahawk.Collection.BrowseCapability.Albums, Tomahawk.Collection.BrowseCapability.Tracks]; + Tomahawk.Collection.BrowseCapability.Albums, + Tomahawk.Collection.BrowseCapability.Tracks]; return this.settings; } }; - // Legacy compability for 0.8 and before Tomahawk.reportCapabilities = function (capabilities) { if (capabilities & TomahawkResolverCapability.Browsable) { @@ -1925,7 +1942,8 @@ Tomahawk.reportCapabilities = function (capabilities) { Tomahawk.nativeReportCapabilities(capabilities); }; -Tomahawk.addArtistResults = Tomahawk.addAlbumResults = Tomahawk.addAlbumTrackResults = function (result) { +Tomahawk.addArtistResults = Tomahawk.addAlbumResults = Tomahawk.addAlbumTrackResults + = function (result) { Tomahawk.PluginManager.resolve[result.qid](result); delete Tomahawk.PluginManager.resolve[result.qid]; }; @@ -1943,7 +1961,7 @@ Tomahawk.reportStreamUrl = function (qid, streamUrl, headers) { delete Tomahawk.PluginManager.resolve[qid]; }; -Tomahawk.addUrlResult = function(url, result) { +Tomahawk.addUrlResult = function (url, result) { /* Merge the whole mess into one consistent result which is independent of type var cleanResult = { type: result.type,