New: HDR metadata for Trakt connection

This commit is contained in:
Bogdan 2023-12-11 21:42:00 +02:00 committed by Mark McDowall
parent 1f82b9fb78
commit be937ec581
2 changed files with 17 additions and 0 deletions

View File

@ -9,6 +9,7 @@ namespace NzbDrone.Core.Notifications.Trakt.Resource
[JsonProperty(PropertyName = "collected_at")]
public DateTime CollectedAt { get; set; }
public string Resolution { get; set; }
public string Hdr { get; set; }
[JsonProperty(PropertyName = "audio_channels")]
public string AudioChannels { get; set; }

View File

@ -160,6 +160,7 @@ namespace NzbDrone.Core.Notifications.Trakt
};
var traktResolution = MapResolution(episodeFile.Quality.Quality.Resolution, episodeFile.MediaInfo?.ScanType);
var hdr = MapHdr(episodeFile);
var mediaType = MapMediaType(episodeFile.Quality.Quality.Source);
var audio = MapAudio(episodeFile);
var audioChannels = MapAudioChannels(episodeFile, audio);
@ -173,6 +174,7 @@ namespace NzbDrone.Core.Notifications.Trakt
Number = episode.EpisodeNumber,
CollectedAt = DateTime.Now,
Resolution = traktResolution,
Hdr = hdr,
MediaType = mediaType,
AudioChannels = audioChannels,
Audio = audio,
@ -316,6 +318,20 @@ namespace NzbDrone.Core.Notifications.Trakt
return traktResolution;
}
private string MapHdr(EpisodeFile episodeFile)
{
var traktHdr = episodeFile.MediaInfo?.VideoHdrFormat switch
{
HdrFormat.DolbyVision or HdrFormat.DolbyVisionSdr => "dolby_vision",
HdrFormat.Hdr10 or HdrFormat.DolbyVisionHdr10 => "hdr10",
HdrFormat.Hdr10Plus or HdrFormat.DolbyVisionHdr10Plus => "hdr10_plus",
HdrFormat.Hlg10 or HdrFormat.DolbyVisionHlg => "hlg",
_ => null
};
return traktHdr;
}
private string MapAudio(EpisodeFile episodeFile)
{
var audioCodec = episodeFile.MediaInfo != null ? MediaInfoFormatter.FormatAudioCodec(episodeFile.MediaInfo, episodeFile.SceneName) : string.Empty;