2013-06-30 19:57:26 +00:00
|
|
|
|
'use strict';
|
2013-06-21 01:43:58 +00:00
|
|
|
|
define(
|
|
|
|
|
[
|
|
|
|
|
'backbone',
|
|
|
|
|
'Series/SeriesModel'
|
2013-06-24 23:41:59 +00:00
|
|
|
|
], function (Backbone, SeriesModel) {
|
2013-06-21 01:43:58 +00:00
|
|
|
|
return Backbone.Collection.extend({
|
2013-09-14 07:10:19 +00:00
|
|
|
|
url : window.NzbDrone.ApiRoot + '/series/lookup',
|
2013-06-21 01:43:58 +00:00
|
|
|
|
model: SeriesModel,
|
2013-05-13 04:24:04 +00:00
|
|
|
|
|
2013-06-30 19:57:26 +00:00
|
|
|
|
initialize: function (options) {
|
|
|
|
|
this.unmappedFolderModel = options.unmappedFolderModel;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
2013-06-21 01:43:58 +00:00
|
|
|
|
parse: function (response) {
|
2013-05-26 05:54:02 +00:00
|
|
|
|
|
2013-06-30 19:57:26 +00:00
|
|
|
|
var self = this;
|
|
|
|
|
|
2013-06-21 01:43:58 +00:00
|
|
|
|
_.each(response, function (model) {
|
|
|
|
|
model.id = undefined;
|
2013-06-30 19:57:26 +00:00
|
|
|
|
|
|
|
|
|
if (self.unmappedFolderModel) {
|
|
|
|
|
model.path = self.unmappedFolderModel.get('folder').path;
|
|
|
|
|
}
|
2013-06-21 01:43:58 +00:00
|
|
|
|
});
|
2013-05-26 05:54:02 +00:00
|
|
|
|
|
2013-06-21 01:43:58 +00:00
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
});
|
2013-05-13 04:24:04 +00:00
|
|
|
|
});
|