New: Add Languages to Webhook Notifications

(cherry picked from commit e039dc45e267cf717e00c0a49ba637012f37e3d7)

Closes #10733
pull/10741/head
Stevie Robinson 3 months ago committed by Bogdan
parent a6d727fe2a
commit 9a107cc8d7

@ -1,6 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using NzbDrone.Core.Languages;
using NzbDrone.Core.MediaFiles; using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Movies; using NzbDrone.Core.Movies;
@ -20,6 +21,7 @@ namespace NzbDrone.Core.Notifications.Webhook
public List<string> Genres { get; set; } public List<string> Genres { get; set; }
public List<WebhookImage> Images { get; set; } public List<WebhookImage> Images { get; set; }
public List<string> Tags { get; set; } public List<string> Tags { get; set; }
public Language OriginalLanguage { get; set; }
public WebhookMovie() public WebhookMovie()
{ {
@ -38,6 +40,7 @@ namespace NzbDrone.Core.Notifications.Webhook
Genres = movie.MovieMetadata.Value.Genres; Genres = movie.MovieMetadata.Value.Genres;
Images = movie.MovieMetadata.Value.Images.Select(i => new WebhookImage(i)).ToList(); Images = movie.MovieMetadata.Value.Images.Select(i => new WebhookImage(i)).ToList();
Tags = tags; Tags = tags;
OriginalLanguage = movie.MovieMetadata.Value.OriginalLanguage;
} }
public WebhookMovie(Movie movie, MovieFile movieFile, List<string> tags) public WebhookMovie(Movie movie, MovieFile movieFile, List<string> tags)

@ -1,4 +1,6 @@
using System; using System;
using System.Collections.Generic;
using NzbDrone.Core.Languages;
using NzbDrone.Core.MediaFiles; using NzbDrone.Core.MediaFiles;
namespace NzbDrone.Core.Notifications.Webhook namespace NzbDrone.Core.Notifications.Webhook
@ -21,6 +23,7 @@ namespace NzbDrone.Core.Notifications.Webhook
IndexerFlags = movieFile.IndexerFlags.ToString(); IndexerFlags = movieFile.IndexerFlags.ToString();
Size = movieFile.Size; Size = movieFile.Size;
DateAdded = movieFile.DateAdded; DateAdded = movieFile.DateAdded;
Languages = movieFile.Languages;
if (movieFile.MediaInfo != null) if (movieFile.MediaInfo != null)
{ {
@ -38,6 +41,7 @@ namespace NzbDrone.Core.Notifications.Webhook
public string IndexerFlags { get; set; } public string IndexerFlags { get; set; }
public long Size { get; set; } public long Size { get; set; }
public DateTime DateAdded { get; set; } public DateTime DateAdded { get; set; }
public List<Language> Languages { get; set; }
public WebhookMovieFileMediaInfo MediaInfo { get; set; } public WebhookMovieFileMediaInfo MediaInfo { get; set; }
public string SourcePath { get; set; } public string SourcePath { get; set; }
public string RecycleBinPath { get; set; } public string RecycleBinPath { get; set; }

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NzbDrone.Core.Languages;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Qualities; using NzbDrone.Core.Qualities;
@ -22,6 +23,7 @@ namespace NzbDrone.Core.Notifications.Webhook
Size = remoteMovie.Release.Size; Size = remoteMovie.Release.Size;
CustomFormats = remoteMovie.CustomFormats?.Select(x => x.Name).ToList(); CustomFormats = remoteMovie.CustomFormats?.Select(x => x.Name).ToList();
CustomFormatScore = remoteMovie.CustomFormatScore; CustomFormatScore = remoteMovie.CustomFormatScore;
Languages = remoteMovie.Languages;
IndexerFlags = Enum.GetValues(typeof(IndexerFlags)).Cast<IndexerFlags>().Where(r => (remoteMovie.Release.IndexerFlags & r) == r).Select(r => r.ToString()).ToList(); IndexerFlags = Enum.GetValues(typeof(IndexerFlags)).Cast<IndexerFlags>().Where(r => (remoteMovie.Release.IndexerFlags & r) == r).Select(r => r.ToString()).ToList();
} }
@ -33,6 +35,7 @@ namespace NzbDrone.Core.Notifications.Webhook
public long Size { get; set; } public long Size { get; set; }
public int CustomFormatScore { get; set; } public int CustomFormatScore { get; set; }
public List<string> CustomFormats { get; set; } public List<string> CustomFormats { get; set; }
public List<Language> Languages { get; set; }
public List<string> IndexerFlags { get; set; } public List<string> IndexerFlags { get; set; }
} }
} }

Loading…
Cancel
Save