Albums can now be seen per artist from search.

This commit is contained in:
Joseph Milazzo
2017-04-30 11:34:53 -05:00
parent de21685896
commit 5b0f11b19a
10 changed files with 107 additions and 79 deletions
+1 -2
View File
@@ -15,9 +15,8 @@ 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
console.log('response: ', response);
return response;
}
+13 -11
View File
@@ -6,8 +6,7 @@ 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('../Artist/ArtistCollection');
var ArtistCollection = require('../Artist/ArtistCollection');
var Config = require('../Config');
var Messenger = require('../Shared/Messenger');
var AsValidatedView = require('../Mixins/AsValidatedView');
@@ -94,7 +93,7 @@ var view = Marionette.ItemView.extend({
},
_configureTemplateHelpers : function() {
var existingSeries = SeriesCollection.where({ tvdbId : this.model.get('tvdbId') });
var existingSeries = ArtistCollection.where({ iTunesId : this.model.get('itunesId') });
if (existingSeries.length > 0) {
this.templateHelpers.existing = existingSeries[0].toJSON();
@@ -170,20 +169,22 @@ var view = Marionette.ItemView.extend({
this._addSeries(true);
},
_addSeries : function(searchForMissingEpisodes) {
var addButton = this.ui.addButton;
var addSearchButton = this.ui.addSearchButton;
_addSeries : function(searchForMissing) {
// TODO: Refactor to handle multiple add buttons/albums
var addButton = this.ui.addButton[0];
var addSearchButton = this.ui.addSearchButton[0];
console.log('_addSeries, searchForMissing=', searchForMissing);
addButton.addClass('disabled');
addSearchButton.addClass('disabled');
var profile = this.ui.profile.val();
var rootFolderPath = this.ui.rootFolder.children(':selected').text();
var seriesType = this.ui.seriesType.val();
var seriesType = this.ui.seriesType.val(); // Perhaps make this a differnitator between artist or Album?
var seasonFolder = this.ui.seasonFolder.prop('checked');
var options = this._getAddSeriesOptions();
options.searchForMissingEpisodes = searchForMissingEpisodes;
options.searchForMissing = searchForMissing;
this.model.set({
profileId : profile,
@@ -197,7 +198,7 @@ var view = Marionette.ItemView.extend({
var self = this;
var promise = this.model.save();
if (searchForMissingEpisodes) {
if (searchForMissing) {
this.ui.addSearchButton.spinForPromise(promise);
}
@@ -212,7 +213,7 @@ var view = Marionette.ItemView.extend({
promise.done(function() {
console.log('[SearchResultView] _addSeries promise resolve:', self.model);
SeriesCollection.add(self.model);
ArtistCollection.add(self.model);
self.close();
@@ -222,7 +223,7 @@ var view = Marionette.ItemView.extend({
goToSeries : {
label : 'Go to Series',
action : function() {
Backbone.history.navigate('/series/' + self.model.get('titleSlug'), { trigger : true });
Backbone.history.navigate('/artist/' + self.model.get('titleSlug'), { trigger : true });
}
}
},
@@ -241,6 +242,7 @@ var view = Marionette.ItemView.extend({
_getAddSeriesOptions : function() {
var monitor = this.ui.monitor.val();
//[TODO]: Refactor for albums
var lastSeason = _.max(this.model.get('seasons'), 'seasonNumber');
var firstSeason = _.min(_.reject(this.model.get('seasons'), { seasonNumber : 0 }), 'seasonNumber');
+53 -14
View File
@@ -1,31 +1,26 @@
<div class="search-item {{#unless isExisting}}search-item-new{{/unless}}">
<div class="row">
<div class="col-md-2">
<a href="{{tvdbUrl}}" target="_blank">
{{poster}}
</a>
</div>
<div class="col-md-10">
<div class="row">
<div class="col-md-12">
<h2 class="series-title">
{{titleWithYear}}
<!--{{titleWithYear}}-->
{{artistName}}
<span class="labels">
<!--<span class="labels">
<span class="label label-default">{{network}}</span>
{{#unless_eq status compare="continuing"}}
<span class="label label-danger">Ended</span>
{{/unless_eq}}
</span>
</span>-->
</h2>
</div>
</div>
<div class="row new-series-overview x-overview">
<!-- <div class="row new-series-overview x-overview">
<div class="col-md-12 overview-internal">
{{overview}}
</div>
</div>
</div> -->
<div class="row">
{{#unless existing}}
{{#unless path}}
@@ -56,7 +51,7 @@
</div>-->
<div class="form-group col-md-2">
<label>Season Folders</label>
<label>Album Folders</label>
<div class="input-group">
<label class="checkbox toggle well">
@@ -73,7 +68,7 @@
</div>
<div class="row">
{{#unless existing}}
{{#if title}}
{{#if artistName}}
<div class="form-group col-md-2 col-md-offset-10">
<!--Uncomment if we need to add even more controls to add series-->
<!--<label style="visibility: hidden">Add</label>-->
@@ -82,13 +77,13 @@
<i class="icon-sonarr-add"></i>
</button>
<button class="btn btn-success add x-add-search" title="Add and Search for missing episodes">
<button class="btn btn-success add x-add-search" title="Add and Search for missing tracks">
<i class="icon-sonarr-search"></i>
</button>
</div>
</div>
{{else}}
<div class="col-md-2 col-md-offset-10" title="Series requires an English title">
<div class="col-md-2 col-md-offset-10">
<button class="btn add-series disabled">
Add
</button>
@@ -104,4 +99,48 @@
</div>
</div>
</div>
<div class="row">
{{#each albums}}
<div class="col-md-12" style="border:1px dashed black;">
<div class="col-md-2">
<a href="{{artworkUrl}}" target="_blank">
<!-- {{poster}} -->
<img class="album-poster" src="{{artworkUrl}}">
</a>
</div>
<div class="col-md-8">
<h2>{{albumName}} ({{year}})</h2>
{{#unless existing}}
{{#if albumName}}
<div class="form-group col-md-offset-10">
<!--Uncomment if we need to add even more controls to add series-->
<!--<label style="visibility: hidden">Add</label>-->
<div class="btn-group">
<button class="btn btn-success add x-add" title="Add">
<i class="icon-sonarr-add"></i>
</button>
<button class="btn btn-success add x-add-search" title="Add and Search for missing tracks">
<i class="icon-sonarr-search"></i>
</button>
</div>
</div>
{{else}}
<div class="col-md-2 col-md-offset-10">
<button class="btn add-series disabled">
Add
</button>
</div>
{{/if}}
{{else}}
<div class="col-md-2 col-md-offset-10">
<a class="btn btn-default" href="{{route}}">
Already Exists
</a>
</div>
{{/unless}}
</div>
</div>
{{/each}}
</div>
</div>
+8
View File
@@ -75,6 +75,14 @@
margin : 10px;
}
.album-poster {
min-width : 100px;
min-height : 100px;
max-width : 138px;
max-height : 203px;
margin : 10px;
}
a {
color : #343434;
}