2013-02-01 01:40:51 +03:00
|
|
|
'use strict';
|
|
|
|
|
2013-02-14 05:28:56 +03:00
|
|
|
define(['app'], function () {
|
2013-02-01 01:40:51 +03:00
|
|
|
|
|
|
|
|
2013-02-14 05:28:56 +03:00
|
|
|
NzbDrone.AddSeries.Existing.UnmappedFolderModel = Backbone.Model.extend({
|
2013-02-01 01:40:51 +03:00
|
|
|
|
|
|
|
|
2013-02-14 05:28:56 +03:00
|
|
|
});
|
2013-02-01 01:40:51 +03:00
|
|
|
|
2013-02-14 05:28:56 +03:00
|
|
|
NzbDrone.AddSeries.Existing.UnmappedFolderCollection = Backbone.Collection.extend({
|
|
|
|
model: NzbDrone.AddSeries.Existing.UnmappedFolderModel,
|
2013-02-01 01:40:51 +03:00
|
|
|
|
2013-02-02 06:33:23 +03:00
|
|
|
|
2013-02-14 05:28:56 +03:00
|
|
|
importItems: function (rootFolderModel, quality) {
|
2013-02-02 06:33:23 +03:00
|
|
|
|
2013-02-14 05:28:56 +03:00
|
|
|
if (!rootFolderModel) {
|
|
|
|
throw "folder array is required";
|
|
|
|
}
|
2013-02-02 06:33:23 +03:00
|
|
|
|
2013-02-14 05:28:56 +03:00
|
|
|
if (!quality) {
|
|
|
|
throw "quality is required";
|
|
|
|
}
|
2013-02-01 01:40:51 +03:00
|
|
|
|
2013-02-14 05:28:56 +03:00
|
|
|
this.reset();
|
2013-02-01 01:40:51 +03:00
|
|
|
|
2013-02-14 05:28:56 +03:00
|
|
|
var qualityCollection = quality;
|
|
|
|
var rootFolder = rootFolderModel.get('path');
|
2013-02-01 01:40:51 +03:00
|
|
|
|
2013-02-14 05:28:56 +03:00
|
|
|
_.each(rootFolderModel.get('unmappedFolders'), function (folder) {
|
|
|
|
this.push(new NzbDrone.AddSeries.Existing.UnmappedFolderModel({ rootFolder: rootFolder, folder: folder, quality: qualityCollection }));
|
|
|
|
}, this);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|