mirror of
https://github.com/Radarr/Radarr
synced 2025-01-01 21:04:22 +00:00
parent
b3caa87b78
commit
ccc77bfcfe
1 changed files with 36 additions and 0 deletions
|
@ -14,6 +14,7 @@
|
|||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.MediaInfo;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.Movies.Credits;
|
||||
|
||||
namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
|
||||
{
|
||||
|
@ -23,16 +24,19 @@ public class XbmcMetadata : MetadataBase<XbmcMetadataSettings>
|
|||
private readonly Logger _logger;
|
||||
private readonly IDetectXbmcNfo _detectNfo;
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly ICreditService _creditService;
|
||||
|
||||
public XbmcMetadata(IDetectXbmcNfo detectNfo,
|
||||
IDiskProvider diskProvider,
|
||||
IMapCoversToLocal mediaCoverService,
|
||||
ICreditService creditService,
|
||||
Logger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
_mediaCoverService = mediaCoverService;
|
||||
_diskProvider = diskProvider;
|
||||
_detectNfo = detectNfo;
|
||||
_creditService = creditService;
|
||||
}
|
||||
|
||||
private static readonly Regex MovieImagesRegex = new Regex(@"^(?<type>poster|banner|fanart|clearart|discart|landscape|logo|backdrop|clearlogo)\.(?:png|jpg)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
@ -153,6 +157,15 @@ public override MetadataFileResult MovieMetadata(Movie movie, MovieFile movieFil
|
|||
details.Add(new XElement("premiered", movie.InCinemas.Value.ToString("yyyy-MM-dd")));
|
||||
}
|
||||
|
||||
if (movie.Collection?.Name != null)
|
||||
{
|
||||
var setElement = new XElement("set");
|
||||
|
||||
setElement.Add(new XElement("name", movie.Collection.Name));
|
||||
|
||||
details.Add(setElement);
|
||||
}
|
||||
|
||||
foreach (var genre in movie.Genres)
|
||||
{
|
||||
details.Add(new XElement("genre", genre));
|
||||
|
@ -231,6 +244,29 @@ public override MetadataFileResult MovieMetadata(Movie movie, MovieFile movieFil
|
|||
streamDetails.Add(subtitle);
|
||||
}
|
||||
|
||||
var credits = _creditService.GetAllCreditsForMovie(movie.Id);
|
||||
|
||||
foreach (var credit in credits)
|
||||
{
|
||||
if (credit.Name != null && credit.Character != null)
|
||||
{
|
||||
var actorElement = new XElement("actor");
|
||||
|
||||
actorElement.Add(new XElement("name", credit.Name));
|
||||
actorElement.Add(new XElement("role", credit.Character));
|
||||
actorElement.Add(new XElement("order", credit.Order));
|
||||
|
||||
var headshot = credit.Images.FirstOrDefault(m => m.CoverType == MediaCoverTypes.Headshot);
|
||||
|
||||
if (headshot != null && headshot.Url != null)
|
||||
{
|
||||
actorElement.Add(new XElement("thumb", headshot.Url));
|
||||
}
|
||||
|
||||
details.Add(actorElement);
|
||||
}
|
||||
}
|
||||
|
||||
fileInfo.Add(streamDetails);
|
||||
details.Add(fileInfo);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue