mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 21:13:28 -07:00
[UI Work] Artist Detail Page, Album Studio, Wanted, NavSearch, Rename
This commit is contained in:
parent
456ead09da
commit
0054226307
93 changed files with 590 additions and 603 deletions
|
@ -14,6 +14,7 @@ using NzbDrone.Core.Music;
|
|||
using NzbDrone.Core.Music.Events;
|
||||
using NzbDrone.Core.Validation;
|
||||
using NzbDrone.Core.Validation.Paths;
|
||||
using Lidarr.Api.V3.Albums;
|
||||
using NzbDrone.SignalR;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
|
@ -35,12 +36,14 @@ namespace Lidarr.Api.V3.Artist
|
|||
private readonly IAddArtistService _addArtistService;
|
||||
private readonly IArtistStatisticsService _artistStatisticsService;
|
||||
private readonly IMapCoversToLocal _coverMapper;
|
||||
private readonly IAlbumService _albumService;
|
||||
|
||||
public ArtistModule(IBroadcastSignalRMessage signalRBroadcaster,
|
||||
IArtistService artistService,
|
||||
IAddArtistService addArtistService,
|
||||
IArtistStatisticsService artistStatisticsService,
|
||||
IMapCoversToLocal coverMapper,
|
||||
IAlbumService albumService,
|
||||
RootFolderValidator rootFolderValidator,
|
||||
ArtistPathValidator artistPathValidator,
|
||||
ArtistExistsValidator artistExistsValidator,
|
||||
|
@ -55,6 +58,7 @@ namespace Lidarr.Api.V3.Artist
|
|||
_artistStatisticsService = artistStatisticsService;
|
||||
|
||||
_coverMapper = coverMapper;
|
||||
_albumService = albumService;
|
||||
|
||||
GetResourceAll = AllArtists;
|
||||
GetResourceById = GetArtist;
|
||||
|
@ -95,6 +99,7 @@ namespace Lidarr.Api.V3.Artist
|
|||
|
||||
var resource = artist.ToResource();
|
||||
MapCoversToLocal(resource);
|
||||
MapAlbums(resource);
|
||||
FetchAndLinkArtistStatistics(resource);
|
||||
//PopulateAlternateTitles(resource);
|
||||
|
||||
|
@ -107,6 +112,7 @@ namespace Lidarr.Api.V3.Artist
|
|||
var artistsResources = _artistService.GetAllArtists().ToResource();
|
||||
|
||||
MapCoversToLocal(artistsResources.ToArray());
|
||||
MapAlbums(artistsResources.ToArray());
|
||||
LinkArtistStatistics(artistsResources, artistStats);
|
||||
//PopulateAlternateTitles(seriesResources);
|
||||
|
||||
|
@ -144,6 +150,14 @@ namespace Lidarr.Api.V3.Artist
|
|||
}
|
||||
}
|
||||
|
||||
private void MapAlbums(params ArtistResource[] artists)
|
||||
{
|
||||
foreach (var artistResource in artists)
|
||||
{
|
||||
artistResource.Albums = _albumService.GetAlbumsByArtist(artistResource.Id).ToResource();
|
||||
}
|
||||
}
|
||||
|
||||
private void FetchAndLinkArtistStatistics(ArtistResource resource)
|
||||
{
|
||||
LinkArtistStatistics(resource, _artistStatisticsService.ArtistStatistics(resource.Id));
|
||||
|
@ -168,13 +182,13 @@ namespace Lidarr.Api.V3.Artist
|
|||
resource.SizeOnDisk = artistStatistics.SizeOnDisk;
|
||||
resource.AlbumCount = artistStatistics.AlbumCount;
|
||||
|
||||
//if (seriesStatistics.AlbumStatistics != null)
|
||||
//{
|
||||
// foreach (var album in resource.Albums)
|
||||
// {
|
||||
// album.Statistics = seriesStatistics.AlbumStatistics.SingleOrDefault(s => s.AlbumId == album.Id).ToResource();
|
||||
// }
|
||||
//}
|
||||
if (artistStatistics.AlbumStatistics != null)
|
||||
{
|
||||
foreach (var album in resource.Albums)
|
||||
{
|
||||
album.Statistics = artistStatistics.AlbumStatistics.SingleOrDefault(s => s.AlbumId == album.Id).ToResource();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//private void PopulateAlternateTitles(List<ArtistResource> resources)
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.Music;
|
||||
using Lidarr.Api.V3.Albums;
|
||||
using Lidarr.Http.REST;
|
||||
|
||||
namespace Lidarr.Api.V3.Artist
|
||||
|
@ -97,7 +98,7 @@ namespace Lidarr.Api.V3.Artist
|
|||
public List<Member> Members { get; set; }
|
||||
|
||||
public string RemotePoster { get; set; }
|
||||
//public List<AlbumResource> Albums { get; set; }
|
||||
public List<AlbumResource> Albums { get; set; }
|
||||
|
||||
|
||||
//View & Edit
|
||||
|
@ -149,7 +150,7 @@ namespace Lidarr.Api.V3.Artist
|
|||
//AirTime = model.AirTime,
|
||||
Images = model.Images,
|
||||
|
||||
//Albums = model.Albums.ToResource(),
|
||||
Albums = model.Albums.ToResource(),
|
||||
//Year = model.Year,
|
||||
|
||||
Path = model.Path,
|
||||
|
|
|
@ -21,9 +21,9 @@ namespace Lidarr.Api.V3.Tracks
|
|||
{
|
||||
int artistId;
|
||||
|
||||
if (Request.Query.SeriesId.HasValue)
|
||||
if (Request.Query.ArtistId.HasValue)
|
||||
{
|
||||
artistId = (int)Request.Query.SeriesId;
|
||||
artistId = (int)Request.Query.ArtistId;
|
||||
}
|
||||
|
||||
else
|
||||
|
|
|
@ -60,10 +60,10 @@ namespace NzbDrone.Core.Organizer
|
|||
public static readonly Regex SeriesTitleRegex = new Regex(@"(?<token>\{(?:Series)(?<separator>[- ._])(Clean)?Title\})",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
public static readonly Regex ArtistNameRegex = new Regex(@"(?<token>\{(?:Artist)(?<separator>[- ._])(Clean)?Name(The)\})",
|
||||
public static readonly Regex ArtistNameRegex = new Regex(@"(?<token>\{(?:Artist)(?<separator>[- ._])(Clean)?Name(The)?\})",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
public static readonly Regex AlbumTitleRegex = new Regex(@"(?<token>\{(?:Album)(?<separator>[- ._])(Clean)?Title(The)\})",
|
||||
public static readonly Regex AlbumTitleRegex = new Regex(@"(?<token>\{(?:Album)(?<separator>[- ._])(Clean)?Title(The)?\})",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
private static readonly Regex FileNameCleanupRegex = new Regex(@"([- ._])(\1)+", RegexOptions.Compiled);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Text.RegularExpressions;
|
||||
using System.Text.RegularExpressions;
|
||||
using FluentValidation;
|
||||
using FluentValidation.Validators;
|
||||
|
||||
|
@ -56,7 +56,7 @@ namespace NzbDrone.Core.Organizer
|
|||
public static IRuleBuilderOptions<T, string> ValidAlbumFolderFormat<T>(this IRuleBuilder<T, string> ruleBuilder)
|
||||
{
|
||||
ruleBuilder.SetValidator(new NotEmptyValidator(null));
|
||||
return ruleBuilder.SetValidator(new RegularExpressionValidator(FileNameBuilder.AlbumTitleRegex)).WithMessage("Must contain Album name");
|
||||
return ruleBuilder.SetValidator(new RegularExpressionValidator(FileNameBuilder.AlbumTitleRegex)).WithMessage("Must contain Album title");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue