mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 05:23:31 -07:00
Rework Tags for Music
This commit is contained in:
parent
d6efae537f
commit
8f45fe0afe
6 changed files with 27 additions and 20 deletions
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Tags;
|
||||
using Lidarr.Api.V3.Notifications;
|
||||
|
@ -14,7 +14,7 @@ namespace Lidarr.Api.V3.Tags
|
|||
public List<DelayProfileResource> DelayProfiles { get; set; }
|
||||
public List<NotificationResource> Notifications { get; set; }
|
||||
public List<RestrictionResource> Restrictions { get; set; }
|
||||
public List<int> SeriesIds { get; set; }
|
||||
public List<int> ArtistIds { get; set; }
|
||||
}
|
||||
|
||||
public static class TagDetailsResourceMapper
|
||||
|
@ -32,7 +32,7 @@ namespace Lidarr.Api.V3.Tags
|
|||
DelayProfiles = model.DelayProfiles.ToResource(),
|
||||
Notifications = model.Notifications.Select(NotificationResourceMapper.ToResource).ToList(),
|
||||
Restrictions = model.Restrictions.ToResource(),
|
||||
SeriesIds = model.Series.Select(s => s.Id).ToList()
|
||||
ArtistIds = model.Artist.Select(s => s.Id).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using NLog;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Music.Events;
|
||||
using NzbDrone.Core.Organizer;
|
||||
|
@ -22,6 +22,7 @@ namespace NzbDrone.Core.Music
|
|||
Artist FindByTitleInexact(string title);
|
||||
void DeleteArtist(int artistId, bool deleteFiles);
|
||||
List<Artist> GetAllArtists();
|
||||
List<Artist> AllForTag(int tagId);
|
||||
Artist UpdateArtist(Artist artist);
|
||||
List<Artist> UpdateArtists(List<Artist> artist);
|
||||
bool ArtistPathExists(string folder);
|
||||
|
@ -89,6 +90,12 @@ namespace NzbDrone.Core.Music
|
|||
return _artistRepository.All().ToList();
|
||||
}
|
||||
|
||||
public List<Artist> AllForTag(int tagId)
|
||||
{
|
||||
return GetAllArtists().Where(s => s.Tags.Contains(tagId))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public Artist GetArtist(int artistDBId)
|
||||
{
|
||||
return _artistRepository.Get(artistDBId);
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Notifications;
|
||||
using NzbDrone.Core.Profiles.Delay;
|
||||
using NzbDrone.Core.Restrictions;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Music;
|
||||
|
||||
namespace NzbDrone.Core.Tags
|
||||
{
|
||||
public class TagDetails : ModelBase
|
||||
{
|
||||
public string Label { get; set; }
|
||||
public List<Series> Series { get; set; }
|
||||
public List<Artist> Artist { get; set; }
|
||||
public List<NotificationDefinition> Notifications { get; set; }
|
||||
public List<Restriction> Restrictions { get; set; }
|
||||
public List<DelayProfile> DelayProfiles { get; set; }
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Notifications;
|
||||
using NzbDrone.Core.Profiles.Delay;
|
||||
using NzbDrone.Core.Restrictions;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Music;
|
||||
|
||||
namespace NzbDrone.Core.Tags
|
||||
{
|
||||
|
@ -26,21 +26,21 @@ namespace NzbDrone.Core.Tags
|
|||
private readonly IDelayProfileService _delayProfileService;
|
||||
private readonly INotificationFactory _notificationFactory;
|
||||
private readonly IRestrictionService _restrictionService;
|
||||
private readonly ISeriesService _seriesService;
|
||||
private readonly IArtistService _artistService;
|
||||
|
||||
public TagService(ITagRepository repo,
|
||||
IEventAggregator eventAggregator,
|
||||
IDelayProfileService delayProfileService,
|
||||
INotificationFactory notificationFactory,
|
||||
IRestrictionService restrictionService,
|
||||
ISeriesService seriesService)
|
||||
IArtistService artistService)
|
||||
{
|
||||
_repo = repo;
|
||||
_eventAggregator = eventAggregator;
|
||||
_delayProfileService = delayProfileService;
|
||||
_notificationFactory = notificationFactory;
|
||||
_restrictionService = restrictionService;
|
||||
_seriesService = seriesService;
|
||||
_artistService = artistService;
|
||||
}
|
||||
|
||||
public Tag GetTag(int tagId)
|
||||
|
@ -66,7 +66,7 @@ namespace NzbDrone.Core.Tags
|
|||
var delayProfiles = _delayProfileService.AllForTag(tagId);
|
||||
var notifications = _notificationFactory.AllForTag(tagId);
|
||||
var restrictions = _restrictionService.AllForTag(tagId);
|
||||
var series = _seriesService.AllForTag(tagId);
|
||||
var artist = _artistService.AllForTag(tagId);
|
||||
|
||||
return new TagDetails
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ namespace NzbDrone.Core.Tags
|
|||
DelayProfiles = delayProfiles,
|
||||
Notifications = notifications,
|
||||
Restrictions = restrictions,
|
||||
Series = series
|
||||
Artist = artist
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue