mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 06:07:37 +02:00
Remove legacy hacks and add useful error
This commit is contained in:
@@ -812,52 +812,11 @@ Tomahawk.PluginManager = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof this.objects[objectId][methodName] === 'function') {
|
if (typeof this.objects[objectId][methodName] !== 'function') {
|
||||||
if (!Tomahawk.resolver.instance.apiVersion
|
throw new Error('\'' + methodName + '\' on ScriptObject ' + objectId + ' is not a function', typeof this.objects[objectId][methodName]);
|
||||||
|| Tomahawk.resolver.instance.apiVersion < 0.9) {
|
|
||||||
if (methodName == 'artists') {
|
|
||||||
return new RSVP.Promise(function (resolve, reject) {
|
|
||||||
pluginManager.resolve[requestId] = resolve;
|
|
||||||
Tomahawk.resolver.instance.artists(requestId);
|
|
||||||
});
|
|
||||||
} else if (methodName == 'albums') {
|
|
||||||
return new RSVP.Promise(function (resolve, reject) {
|
|
||||||
pluginManager.resolve[requestId] = resolve;
|
|
||||||
Tomahawk.resolver.instance.albums(requestId, params.artist);
|
|
||||||
});
|
|
||||||
} else if (methodName == 'tracks') {
|
|
||||||
return new RSVP.Promise(function (resolve, reject) {
|
|
||||||
pluginManager.resolve[requestId] = resolve;
|
|
||||||
Tomahawk.resolver.instance.tracks(requestId, params.artist, params.album);
|
|
||||||
});
|
|
||||||
} else if (methodName == 'lookupUrl') {
|
|
||||||
return new RSVP.Promise(function (resolve, reject) {
|
|
||||||
pluginManager.resolve[params.url] = resolve;
|
|
||||||
Tomahawk.resolver.instance.lookupUrl(params.url);
|
|
||||||
});
|
|
||||||
} else if (methodName == 'getStreamUrl') {
|
|
||||||
return new RSVP.Promise(function (resolve, reject) {
|
|
||||||
pluginManager.resolve[requestId] = resolve;
|
|
||||||
Tomahawk.resolver.instance.getStreamUrl(requestId, params.url);
|
|
||||||
});
|
|
||||||
} else if (methodName == 'resolve') {
|
|
||||||
return new RSVP.Promise(function (resolve, reject) {
|
|
||||||
pluginManager.resolve[requestId] = resolve;
|
|
||||||
Tomahawk.resolver.instance.resolve(requestId, params.artist,
|
|
||||||
params.album, params.track);
|
|
||||||
});
|
|
||||||
} else if (methodName == 'search') {
|
|
||||||
return new RSVP.Promise(function (resolve, reject) {
|
|
||||||
pluginManager.resolve[requestId] = resolve;
|
|
||||||
Tomahawk.resolver.instance.search(requestId, params.query);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.objects[objectId][methodName](params);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.objects[objectId][methodName];
|
return this.objects[objectId][methodName](params);
|
||||||
},
|
},
|
||||||
|
|
||||||
invoke: function (requestId, objectId, methodName, params) {
|
invoke: function (requestId, objectId, methodName, params) {
|
||||||
|
Reference in New Issue
Block a user