2013-08-31 06:08:19 +03:00
|
|
|
'use strict';
|
|
|
|
define(
|
|
|
|
[
|
|
|
|
'backbone'
|
|
|
|
], function (Backbone) {
|
|
|
|
return Backbone.Model.extend({
|
2013-09-14 10:10:19 +03:00
|
|
|
url: window.NzbDrone.ApiRoot + '/command',
|
2013-09-11 09:33:47 +03:00
|
|
|
|
|
|
|
parse: function (response) {
|
|
|
|
response.name = response.name.toLocaleLowerCase();
|
|
|
|
return response;
|
|
|
|
},
|
|
|
|
|
|
|
|
isActive: function () {
|
|
|
|
return this.get('state') !== 'completed' && this.get('state') !== 'failed';
|
|
|
|
},
|
|
|
|
|
|
|
|
isSameCommand: function (command) {
|
|
|
|
|
|
|
|
if (command.name.toLocaleLowerCase() != this.get('name').toLocaleLowerCase()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (var key in command) {
|
|
|
|
if (key !== 'name' && command[key] !== this.get(key)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2013-08-31 06:08:19 +03:00
|
|
|
});
|
|
|
|
});
|