New: Include MediaInfo / CF for Webhooks

Fixes #5166
This commit is contained in:
Qstick 2022-10-15 14:18:14 -05:00
parent 4fc043bb72
commit 47116ea663
3 changed files with 47 additions and 1 deletions

View File

@ -20,6 +20,7 @@ namespace NzbDrone.Core.Notifications.Webhook
SceneName = episodeFile.SceneName;
Size = episodeFile.Size;
DateAdded = episodeFile.DateAdded;
MediaInfo = new WebhookEpisodeFileMediaInfo(episodeFile);
}
public int Id { get; set; }
@ -31,5 +32,6 @@ namespace NzbDrone.Core.Notifications.Webhook
public string SceneName { get; set; }
public long Size { get; set; }
public DateTime DateAdded { get; set; }
public WebhookEpisodeFileMediaInfo MediaInfo { get; set; }
}
}

View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.MediaFiles.MediaInfo;
namespace NzbDrone.Core.Notifications.Webhook
{
public class WebhookEpisodeFileMediaInfo
{
public WebhookEpisodeFileMediaInfo()
{
}
public WebhookEpisodeFileMediaInfo(EpisodeFile episodeFile)
{
AudioChannels = MediaInfoFormatter.FormatAudioChannels(episodeFile.MediaInfo);
AudioCodec = MediaInfoFormatter.FormatAudioCodec(episodeFile.MediaInfo, episodeFile.SceneName);
AudioLanguages = episodeFile.MediaInfo.AudioLanguages.Distinct().ToList();
Height = episodeFile.MediaInfo.Height;
Width = episodeFile.MediaInfo.Width;
Subtitles = episodeFile.MediaInfo.Subtitles.Distinct().ToList();
VideoCodec = MediaInfoFormatter.FormatVideoCodec(episodeFile.MediaInfo, episodeFile.SceneName);
VideoDynamicRange = MediaInfoFormatter.FormatVideoDynamicRange(episodeFile.MediaInfo);
VideoDynamicRangeType = MediaInfoFormatter.FormatVideoDynamicRangeType(episodeFile.MediaInfo);
}
public decimal AudioChannels { get; set; }
public string AudioCodec { get; set; }
public List<string> AudioLanguages { get; set; }
public int Height { get; set; }
public int Width { get; set; }
public List<string> Subtitles { get; set; }
public string VideoCodec { get; set; }
public string VideoDynamicRange { get; set; }
public string VideoDynamicRangeType { get; set; }
}
}

View File

@ -1,4 +1,6 @@
using NzbDrone.Core.Parser.Model;
using System.Collections.Generic;
using System.Linq;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Qualities;
namespace NzbDrone.Core.Notifications.Webhook
@ -17,6 +19,8 @@ namespace NzbDrone.Core.Notifications.Webhook
ReleaseTitle = remoteEpisode.Release.Title;
Indexer = remoteEpisode.Release.Indexer;
Size = remoteEpisode.Release.Size;
CustomFormats = remoteEpisode.CustomFormats?.Select(x => x.Name).ToList();
CustomFormatScore = remoteEpisode.CustomFormatScore;
}
public string Quality { get; set; }
@ -25,5 +29,7 @@ namespace NzbDrone.Core.Notifications.Webhook
public string ReleaseTitle { get; set; }
public string Indexer { get; set; }
public long Size { get; set; }
public int CustomFormatScore { get; set; }
public List<string> CustomFormats { get; set; }
}
}