mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-14 11:23:42 +02:00
New: Add tags to Kodi metadata
This commit is contained in:
parent
400838c79a
commit
d52b63e5e9
@ -13,6 +13,7 @@
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.MediaInfo;
|
||||
using NzbDrone.Core.Tags;
|
||||
using NzbDrone.Core.Tv;
|
||||
|
||||
namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
|
||||
@ -21,16 +22,19 @@ public class XbmcMetadata : MetadataBase<XbmcMetadataSettings>
|
||||
{
|
||||
private readonly Logger _logger;
|
||||
private readonly IMapCoversToLocal _mediaCoverService;
|
||||
private readonly ITagService _tagService;
|
||||
private readonly IDetectXbmcNfo _detectNfo;
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
|
||||
public XbmcMetadata(IDetectXbmcNfo detectNfo,
|
||||
IDiskProvider diskProvider,
|
||||
IMapCoversToLocal mediaCoverService,
|
||||
ITagService tagService,
|
||||
Logger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
_mediaCoverService = mediaCoverService;
|
||||
_tagService = tagService;
|
||||
_diskProvider = diskProvider;
|
||||
_detectNfo = detectNfo;
|
||||
}
|
||||
@ -180,6 +184,16 @@ public override MetadataFileResult SeriesMetadata(Series series)
|
||||
tvShow.Add(new XElement("genre", genre));
|
||||
}
|
||||
|
||||
if (series.Tags.Any())
|
||||
{
|
||||
var tags = _tagService.GetTags(series.Tags);
|
||||
|
||||
foreach (var tag in tags)
|
||||
{
|
||||
tvShow.Add(new XElement("tag", tag.Label));
|
||||
}
|
||||
}
|
||||
|
||||
if (series.FirstAired.HasValue)
|
||||
{
|
||||
tvShow.Add(new XElement("premiered", series.FirstAired.Value.ToString("yyyy-MM-dd")));
|
||||
|
@ -12,6 +12,7 @@ public interface ITagService
|
||||
{
|
||||
Tag GetTag(int tagId);
|
||||
Tag GetTag(string tag);
|
||||
List<Tag> GetTags(IEnumerable<int> ids);
|
||||
TagDetails Details(int tagId);
|
||||
List<TagDetails> Details();
|
||||
List<Tag> All();
|
||||
@ -61,6 +62,11 @@ public Tag GetTag(string tag)
|
||||
}
|
||||
}
|
||||
|
||||
public List<Tag> GetTags(IEnumerable<int> ids)
|
||||
{
|
||||
return _repo.Get(ids).ToList();
|
||||
}
|
||||
|
||||
public TagDetails Details(int tagId)
|
||||
{
|
||||
var tag = GetTag(tagId);
|
||||
|
Loading…
Reference in New Issue
Block a user