mirror of https://github.com/lidarr/Lidarr
Albums can now be seen per artist from search.
This commit is contained in:
parent
de21685896
commit
5b0f11b19a
|
@ -12,7 +12,9 @@ namespace NzbDrone.Api.Music
|
||||||
public string AlbumName { get; set; }
|
public string AlbumName { get; set; }
|
||||||
public bool Monitored { get; set; }
|
public bool Monitored { get; set; }
|
||||||
public int Year { get; set; }
|
public int Year { get; set; }
|
||||||
public List<string> Genre { get; set; }
|
public List<string> Genres { get; set; }
|
||||||
|
public string ArtworkUrl { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class AlbumResourceMapper
|
public static class AlbumResourceMapper
|
||||||
|
@ -26,7 +28,9 @@ namespace NzbDrone.Api.Music
|
||||||
AlbumId = model.AlbumId,
|
AlbumId = model.AlbumId,
|
||||||
Monitored = model.Monitored,
|
Monitored = model.Monitored,
|
||||||
Year = model.Year,
|
Year = model.Year,
|
||||||
AlbumName = model.Title
|
AlbumName = model.Title,
|
||||||
|
Genres = model.Genres,
|
||||||
|
ArtworkUrl = model.ArtworkUrl
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +43,9 @@ namespace NzbDrone.Api.Music
|
||||||
AlbumId = resource.AlbumId,
|
AlbumId = resource.AlbumId,
|
||||||
Monitored = resource.Monitored,
|
Monitored = resource.Monitored,
|
||||||
Year = resource.Year,
|
Year = resource.Year,
|
||||||
Title = resource.AlbumName
|
Title = resource.AlbumName,
|
||||||
|
Genres = resource.Genres,
|
||||||
|
ArtworkUrl = resource.ArtworkUrl
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,14 @@ namespace NzbDrone.Core.MetadataSource.SkyHook.Resource
|
||||||
public int ArtistId { get; set; }
|
public int ArtistId { get; set; }
|
||||||
public string CollectionName { get; set; }
|
public string CollectionName { get; set; }
|
||||||
public int CollectionId { get; set; }
|
public int CollectionId { get; set; }
|
||||||
|
public string PrimaryGenreName { get; set; }
|
||||||
|
public string ArtworkUrl100 { get; set; }
|
||||||
|
public string Country { get; set; }
|
||||||
|
public string CollectionExplicitness { get; set; }
|
||||||
|
public int TrackCount { get; set; }
|
||||||
|
public string Copyright { get; set; }
|
||||||
|
public DateTime ReleaseDate { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ArtistResource
|
public class ArtistResource
|
||||||
|
|
|
@ -163,32 +163,12 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
|
|
||||||
var httpResponse = _httpClient.Get<ArtistResource>(httpRequest);
|
var httpResponse = _httpClient.Get<ArtistResource>(httpRequest);
|
||||||
|
|
||||||
|
|
||||||
//Console.WriteLine("Response: ", httpResponse.GetType());
|
|
||||||
//_logger.Info("Response: ", httpResponse.Resource.ResultCount);
|
|
||||||
|
|
||||||
//_logger.Info("HTTP Response: ", httpResponse.Resource.ResultCount);
|
|
||||||
//var tempList = new List<Artist>();
|
|
||||||
//var tempSeries = new Artist();
|
|
||||||
//tempSeries.ArtistName = "AFI";
|
|
||||||
//tempList.Add(tempSeries);
|
|
||||||
//return tempList;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Album tempAlbum;
|
Album tempAlbum;
|
||||||
List<Artist> artists = new List<Artist>();
|
List<Artist> artists = new List<Artist>();
|
||||||
ArtistComparer artistComparer = new ArtistComparer();
|
|
||||||
foreach (var album in httpResponse.Resource.Results)
|
foreach (var album in httpResponse.Resource.Results)
|
||||||
{
|
{
|
||||||
tempAlbum = new Album();
|
|
||||||
// TODO: Perform MapAlbum call here
|
|
||||||
tempAlbum.AlbumId = album.CollectionId;
|
|
||||||
tempAlbum.Title = album.CollectionName;
|
|
||||||
|
|
||||||
|
|
||||||
int index = artists.FindIndex(a => a.ItunesId == album.ArtistId);
|
int index = artists.FindIndex(a => a.ItunesId == album.ArtistId);
|
||||||
|
tempAlbum = MapAlbum(album);
|
||||||
|
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
{
|
{
|
||||||
|
@ -200,6 +180,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
// TODO: Perform the MapArtist call here
|
// TODO: Perform the MapArtist call here
|
||||||
tempArtist.ItunesId = album.ArtistId;
|
tempArtist.ItunesId = album.ArtistId;
|
||||||
tempArtist.ArtistName = album.ArtistName;
|
tempArtist.ArtistName = album.ArtistName;
|
||||||
|
tempArtist.Genres.Add(album.PrimaryGenreName);
|
||||||
tempArtist.Albums.Add(tempAlbum);
|
tempArtist.Albums.Add(tempAlbum);
|
||||||
artists.Add(tempArtist);
|
artists.Add(tempArtist);
|
||||||
}
|
}
|
||||||
|
@ -207,10 +188,6 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
}
|
}
|
||||||
|
|
||||||
return artists;
|
return artists;
|
||||||
|
|
||||||
// I need to return a list of mapped artists.
|
|
||||||
|
|
||||||
//return httpResponse.Resource.Results.SelectList(MapArtist);
|
|
||||||
}
|
}
|
||||||
catch (HttpException)
|
catch (HttpException)
|
||||||
{
|
{
|
||||||
|
@ -223,15 +200,16 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Artist MapArtist(ArtistResource artistQuery)
|
private Album MapAlbum(AlbumResource albumQuery)
|
||||||
{
|
{
|
||||||
var artist = new Artist();
|
Album album = new Album();
|
||||||
//artist.ItunesId = artistQuery.ItunesId; ;
|
|
||||||
|
|
||||||
// artist.ArtistName = artistQuery.ArtistName;
|
album.AlbumId = albumQuery.CollectionId;
|
||||||
|
album.Title = albumQuery.CollectionName;
|
||||||
|
album.Year = albumQuery.ReleaseDate.Year;
|
||||||
return artist;
|
album.ArtworkUrl = albumQuery.ArtworkUrl100;
|
||||||
|
album.Explicitness = albumQuery.CollectionExplicitness;
|
||||||
|
return album;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Series MapSeries(ShowResource show)
|
private static Series MapSeries(ShowResource show)
|
||||||
|
|
|
@ -22,5 +22,8 @@ namespace NzbDrone.Core.Music
|
||||||
public bool Monitored { get; set; }
|
public bool Monitored { get; set; }
|
||||||
public List<MediaCover.MediaCover> Images { get; set; }
|
public List<MediaCover.MediaCover> Images { get; set; }
|
||||||
public List<Actor> Actors { get; set; } // These are band members. TODO: Refactor
|
public List<Actor> Actors { get; set; } // These are band members. TODO: Refactor
|
||||||
|
public List<string> Genres { get; set; }
|
||||||
|
public string ArtworkUrl { get; set; }
|
||||||
|
public string Explicitness { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,20 +9,6 @@ using System.Text;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Music
|
namespace NzbDrone.Core.Music
|
||||||
{
|
{
|
||||||
|
|
||||||
public class ArtistComparer : IEqualityComparer<Artist>
|
|
||||||
{
|
|
||||||
public bool Equals(Artist x, Artist y)
|
|
||||||
{
|
|
||||||
return x.ItunesId == y.ItunesId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int GetHashCode(Artist obj)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Artist : ModelBase
|
public class Artist : ModelBase
|
||||||
{
|
{
|
||||||
public Artist()
|
public Artist()
|
||||||
|
@ -46,7 +32,6 @@ namespace NzbDrone.Core.Music
|
||||||
//public SeriesStatusType Status { get; set; }
|
//public SeriesStatusType Status { get; set; }
|
||||||
public string Overview { get; set; }
|
public string Overview { get; set; }
|
||||||
public bool Monitored { get; set; }
|
public bool Monitored { get; set; }
|
||||||
//public int ProfileId { get; set; }
|
|
||||||
public bool AlbumFolder { get; set; }
|
public bool AlbumFolder { get; set; }
|
||||||
public DateTime? LastInfoSync { get; set; }
|
public DateTime? LastInfoSync { get; set; }
|
||||||
//public int Runtime { get; set; }
|
//public int Runtime { get; set; }
|
||||||
|
|
|
@ -15,9 +15,8 @@ module.exports = Backbone.Collection.extend({
|
||||||
if (self.unmappedFolderModel) {
|
if (self.unmappedFolderModel) {
|
||||||
model.path = self.unmappedFolderModel.get('folder').path;
|
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;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,7 @@ var Marionette = require('marionette');
|
||||||
var Profiles = require('../Profile/ProfileCollection');
|
var Profiles = require('../Profile/ProfileCollection');
|
||||||
var RootFolders = require('./RootFolders/RootFolderCollection');
|
var RootFolders = require('./RootFolders/RootFolderCollection');
|
||||||
var RootFolderLayout = require('./RootFolders/RootFolderLayout');
|
var RootFolderLayout = require('./RootFolders/RootFolderLayout');
|
||||||
//var SeriesCollection = require('../Series/SeriesCollection');
|
var ArtistCollection = require('../Artist/ArtistCollection');
|
||||||
var SeriesCollection = require('../Artist/ArtistCollection');
|
|
||||||
var Config = require('../Config');
|
var Config = require('../Config');
|
||||||
var Messenger = require('../Shared/Messenger');
|
var Messenger = require('../Shared/Messenger');
|
||||||
var AsValidatedView = require('../Mixins/AsValidatedView');
|
var AsValidatedView = require('../Mixins/AsValidatedView');
|
||||||
|
@ -94,7 +93,7 @@ var view = Marionette.ItemView.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_configureTemplateHelpers : function() {
|
_configureTemplateHelpers : function() {
|
||||||
var existingSeries = SeriesCollection.where({ tvdbId : this.model.get('tvdbId') });
|
var existingSeries = ArtistCollection.where({ iTunesId : this.model.get('itunesId') });
|
||||||
|
|
||||||
if (existingSeries.length > 0) {
|
if (existingSeries.length > 0) {
|
||||||
this.templateHelpers.existing = existingSeries[0].toJSON();
|
this.templateHelpers.existing = existingSeries[0].toJSON();
|
||||||
|
@ -170,20 +169,22 @@ var view = Marionette.ItemView.extend({
|
||||||
this._addSeries(true);
|
this._addSeries(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
_addSeries : function(searchForMissingEpisodes) {
|
_addSeries : function(searchForMissing) {
|
||||||
var addButton = this.ui.addButton;
|
// TODO: Refactor to handle multiple add buttons/albums
|
||||||
var addSearchButton = this.ui.addSearchButton;
|
var addButton = this.ui.addButton[0];
|
||||||
|
var addSearchButton = this.ui.addSearchButton[0];
|
||||||
|
console.log('_addSeries, searchForMissing=', searchForMissing);
|
||||||
|
|
||||||
addButton.addClass('disabled');
|
addButton.addClass('disabled');
|
||||||
addSearchButton.addClass('disabled');
|
addSearchButton.addClass('disabled');
|
||||||
|
|
||||||
var profile = this.ui.profile.val();
|
var profile = this.ui.profile.val();
|
||||||
var rootFolderPath = this.ui.rootFolder.children(':selected').text();
|
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 seasonFolder = this.ui.seasonFolder.prop('checked');
|
||||||
|
|
||||||
var options = this._getAddSeriesOptions();
|
var options = this._getAddSeriesOptions();
|
||||||
options.searchForMissingEpisodes = searchForMissingEpisodes;
|
options.searchForMissing = searchForMissing;
|
||||||
|
|
||||||
this.model.set({
|
this.model.set({
|
||||||
profileId : profile,
|
profileId : profile,
|
||||||
|
@ -197,7 +198,7 @@ var view = Marionette.ItemView.extend({
|
||||||
var self = this;
|
var self = this;
|
||||||
var promise = this.model.save();
|
var promise = this.model.save();
|
||||||
|
|
||||||
if (searchForMissingEpisodes) {
|
if (searchForMissing) {
|
||||||
this.ui.addSearchButton.spinForPromise(promise);
|
this.ui.addSearchButton.spinForPromise(promise);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +213,7 @@ var view = Marionette.ItemView.extend({
|
||||||
|
|
||||||
promise.done(function() {
|
promise.done(function() {
|
||||||
console.log('[SearchResultView] _addSeries promise resolve:', self.model);
|
console.log('[SearchResultView] _addSeries promise resolve:', self.model);
|
||||||
SeriesCollection.add(self.model);
|
ArtistCollection.add(self.model);
|
||||||
|
|
||||||
self.close();
|
self.close();
|
||||||
|
|
||||||
|
@ -222,7 +223,7 @@ var view = Marionette.ItemView.extend({
|
||||||
goToSeries : {
|
goToSeries : {
|
||||||
label : 'Go to Series',
|
label : 'Go to Series',
|
||||||
action : function() {
|
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() {
|
_getAddSeriesOptions : function() {
|
||||||
var monitor = this.ui.monitor.val();
|
var monitor = this.ui.monitor.val();
|
||||||
|
//[TODO]: Refactor for albums
|
||||||
var lastSeason = _.max(this.model.get('seasons'), 'seasonNumber');
|
var lastSeason = _.max(this.model.get('seasons'), 'seasonNumber');
|
||||||
var firstSeason = _.min(_.reject(this.model.get('seasons'), { seasonNumber : 0 }), 'seasonNumber');
|
var firstSeason = _.min(_.reject(this.model.get('seasons'), { seasonNumber : 0 }), 'seasonNumber');
|
||||||
|
|
||||||
|
|
|
@ -1,31 +1,26 @@
|
||||||
<div class="search-item {{#unless isExisting}}search-item-new{{/unless}}">
|
<div class="search-item {{#unless isExisting}}search-item-new{{/unless}}">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-2">
|
|
||||||
<a href="{{tvdbUrl}}" target="_blank">
|
|
||||||
{{poster}}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<h2 class="series-title">
|
<h2 class="series-title">
|
||||||
{{titleWithYear}}
|
<!--{{titleWithYear}}-->
|
||||||
{{artistName}}
|
{{artistName}}
|
||||||
|
|
||||||
<span class="labels">
|
<!--<span class="labels">
|
||||||
<span class="label label-default">{{network}}</span>
|
<span class="label label-default">{{network}}</span>
|
||||||
{{#unless_eq status compare="continuing"}}
|
{{#unless_eq status compare="continuing"}}
|
||||||
<span class="label label-danger">Ended</span>
|
<span class="label label-danger">Ended</span>
|
||||||
{{/unless_eq}}
|
{{/unless_eq}}
|
||||||
</span>
|
</span>-->
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
</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">
|
<div class="col-md-12 overview-internal">
|
||||||
{{overview}}
|
{{overview}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{#unless existing}}
|
{{#unless existing}}
|
||||||
{{#unless path}}
|
{{#unless path}}
|
||||||
|
@ -56,7 +51,7 @@
|
||||||
</div>-->
|
</div>-->
|
||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label>Season Folders</label>
|
<label>Album Folders</label>
|
||||||
|
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<label class="checkbox toggle well">
|
<label class="checkbox toggle well">
|
||||||
|
@ -73,7 +68,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{#unless existing}}
|
{{#unless existing}}
|
||||||
{{#if title}}
|
{{#if artistName}}
|
||||||
<div class="form-group col-md-2 col-md-offset-10">
|
<div class="form-group col-md-2 col-md-offset-10">
|
||||||
<!--Uncomment if we need to add even more controls to add series-->
|
<!--Uncomment if we need to add even more controls to add series-->
|
||||||
<!--<label style="visibility: hidden">Add</label>-->
|
<!--<label style="visibility: hidden">Add</label>-->
|
||||||
|
@ -82,13 +77,13 @@
|
||||||
<i class="icon-sonarr-add"></i>
|
<i class="icon-sonarr-add"></i>
|
||||||
</button>
|
</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>
|
<i class="icon-sonarr-search"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{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">
|
<button class="btn add-series disabled">
|
||||||
Add
|
Add
|
||||||
</button>
|
</button>
|
||||||
|
@ -104,4 +99,48 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
|
|
|
@ -75,6 +75,14 @@
|
||||||
margin : 10px;
|
margin : 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.album-poster {
|
||||||
|
min-width : 100px;
|
||||||
|
min-height : 100px;
|
||||||
|
max-width : 138px;
|
||||||
|
max-height : 203px;
|
||||||
|
margin : 10px;
|
||||||
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color : #343434;
|
color : #343434;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="well col-md-12">
|
<div class="well col-md-12">
|
||||||
<i class="icon-sonarr-comment"/>
|
<i class="icon-sonarr-comment"/>
|
||||||
You must be new around here, You should add some series.
|
You must be new around here, You should add some music.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4 col-md-offset-4">
|
<div class="col-md-4 col-md-offset-4">
|
||||||
<a href="/addseries" class='btn btn-lg btn-block btn-success x-add-series'>
|
<a href="/addseries" class='btn btn-lg btn-block btn-success x-add-series'>
|
||||||
<i class='icon-sonarr-add'></i>
|
<i class='icon-sonarr-add'></i>
|
||||||
Add Series
|
Add Music
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue