Updated the code to allow a search to be made from UI to iTunes and return a mock result.

This commit is contained in:
Joseph Milazzo
2017-04-28 17:05:35 -05:00
parent 684e4f4c80
commit 2813fccc78
32 changed files with 1401 additions and 65 deletions
+5 -3
View File
@@ -1,10 +1,10 @@
var Backbone = require('backbone');
var SeriesModel = require('../Series/SeriesModel');
var ArtistModel = require('../Artist/ArtistModel');
var _ = require('underscore');
module.exports = Backbone.Collection.extend({
url : window.NzbDrone.ApiRoot + '/series/lookup',
model : SeriesModel,
url : window.NzbDrone.ApiRoot + '/artist/lookup',
model : ArtistModel,
parse : function(response) {
var self = this;
@@ -15,7 +15,9 @@ module.exports = Backbone.Collection.extend({
if (self.unmappedFolderModel) {
model.path = self.unmappedFolderModel.get('folder').path;
}
console.log('model: ', model);
});
console.log('response: ', response); // Note: this gets called after api responds with artist model
return response;
}
+2 -2
View File
@@ -3,9 +3,9 @@
<div class="btn-group add-series-btn-group btn-group-lg btn-block">
<button type="button" class="btn btn-default col-md-10 col-xs-8 add-series-import-btn x-import">
<i class="icon-sonarr-hdd"/>
Import existing series on disk
Import existing artists on disk
</button>
<button class="btn btn-default col-md-2 col-xs-4 x-add-new"><i class="icon-sonarr-active hidden-xs"></i> Add New Series</button>
<button class="btn btn-default col-md-2 col-xs-4 x-add-new"><i class="icon-sonarr-active hidden-xs"></i> Add New Artist</button>
</div>
</div>
</div>
+1
View File
@@ -28,6 +28,7 @@ module.exports = Marionette.Layout.extend({
initialize : function(options) {
this.isExisting = options.isExisting;
this.collection = new AddSeriesCollection();
console.log('this.collection:', this.collection);
if (this.isExisting) {
this.collection.unmappedFolderModel = this.model;
+1 -1
View File
@@ -11,7 +11,7 @@
{{#if folder}}
<input type="text" class="form-control x-series-search" value="{{folder.name}}">
{{else}}
<input type="text" class="form-control x-series-search" placeholder="Start typing the name of series you want to add ...">
<input type="text" class="form-control x-series-search" placeholder="Start typing the name of music you want to add ...">
{{/if}}
</div>
</div>
+1 -1
View File
@@ -1,3 +1,3 @@
<div class="text-center hint col-md-12">
<span>You can also search by tvdbid using the tvdb: prefixes.</span>
<span>You can also search by iTunes using the itunes: prefixes.</span>
</div>
+1 -1
View File
@@ -3,5 +3,5 @@
There was an error searching for '{{term}}'.
</h3>
If the series title contains non-alphanumeric characters try removing them, otherwise try your search again later.
If the artist name contains non-alphanumeric characters try removing them, otherwise try your search again later.
</div>
@@ -1,5 +1,5 @@
<div class="x-existing-folders">
<div class="loading-folders x-loading-folders">
Loading search results from TheTVDB for your series, this may take a few minutes.
Loading search results from iTunes for your artists, this may take a few minutes.
</div>
</div>
+3 -1
View File
@@ -6,7 +6,8 @@ var Marionette = require('marionette');
var Profiles = require('../Profile/ProfileCollection');
var RootFolders = require('./RootFolders/RootFolderCollection');
var RootFolderLayout = require('./RootFolders/RootFolderLayout');
var SeriesCollection = require('../Series/SeriesCollection');
//var SeriesCollection = require('../Series/SeriesCollection');
var SeriesCollection = require('../Artist/ArtistCollection');
var Config = require('../Config');
var Messenger = require('../Shared/Messenger');
var AsValidatedView = require('../Mixins/AsValidatedView');
@@ -210,6 +211,7 @@ var view = Marionette.ItemView.extend({
});
promise.done(function() {
console.log('[SearchResultView] _addSeries promise resolve:', self.model);
SeriesCollection.add(self.model);
self.close();
@@ -10,6 +10,7 @@
<div class="col-md-12">
<h2 class="series-title">
{{titleWithYear}}
{{artistName}}
<span class="labels">
<span class="label label-default">{{network}}</span>
@@ -41,8 +42,6 @@
<option value="future">Future</option>
<option value="missing">Missing</option>
<option value="existing">Existing</option>
<option value="first">First Season</option>
<option value="latest">Latest Season</option>
<option value="none">None</option>
</select>
</div>
@@ -52,10 +51,9 @@
{{> ProfileSelectionPartial profiles}}
</div>
<div class="form-group col-md-2">
<label>Series Type</label>
{{> SeriesTypeSelectionPartial}}
</div>
<!--<div class="form-group col-md-2">
</div>-->
<div class="form-group col-md-2">
<label>Season Folders</label>