mirror of https://github.com/lidarr/Lidarr
Rework Tags for Music
This commit is contained in:
parent
d6efae537f
commit
8f45fe0afe
|
@ -49,7 +49,7 @@ class TagsModalContent extends Component {
|
|||
|
||||
render() {
|
||||
const {
|
||||
seriesTags,
|
||||
artistTags,
|
||||
tagList,
|
||||
onModalClose,
|
||||
onApplyTagsPress
|
||||
|
@ -108,7 +108,7 @@ class TagsModalContent extends Component {
|
|||
|
||||
<div className={styles.result}>
|
||||
{
|
||||
seriesTags.map((t) => {
|
||||
artistTags.map((t) => {
|
||||
const tag = _.find(tagList, { id: t });
|
||||
|
||||
if (!tag) {
|
||||
|
@ -140,7 +140,7 @@ class TagsModalContent extends Component {
|
|||
return null;
|
||||
}
|
||||
|
||||
if (seriesTags.indexOf(t) > -1) {
|
||||
if (artistTags.indexOf(t) > -1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ class TagsModalContent extends Component {
|
|||
}
|
||||
|
||||
TagsModalContent.propTypes = {
|
||||
seriesTags: PropTypes.arrayOf(PropTypes.number).isRequired,
|
||||
artistTags: PropTypes.arrayOf(PropTypes.number).isRequired,
|
||||
tagList: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
onModalClose: PropTypes.func.isRequired,
|
||||
onApplyTagsPress: PropTypes.func.isRequired
|
||||
|
|
|
@ -15,10 +15,10 @@ function createMapStateToProps() {
|
|||
return s.id === id;
|
||||
});
|
||||
|
||||
const seriesTags = _.uniq(_.concat(..._.map(series, 'tags')));
|
||||
const artistTags = _.uniq(_.concat(..._.map(series, 'tags')));
|
||||
|
||||
return {
|
||||
seriesTags,
|
||||
artistTags,
|
||||
tagList
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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…
Reference in New Issue