New: Additional info passed in for Script Import and Custom Script
This commit is contained in:
parent
a6f2db9139
commit
3f0268b79f
|
@ -7,7 +7,9 @@ using NzbDrone.Common.Extensions;
|
|||
using NzbDrone.Common.Processes;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.MediaFiles.MediaInfo;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Tags;
|
||||
|
||||
namespace NzbDrone.Core.MediaFiles
|
||||
{
|
||||
|
@ -22,18 +24,21 @@ namespace NzbDrone.Core.MediaFiles
|
|||
private readonly IVideoFileInfoReader _videoFileInfoReader;
|
||||
private readonly IProcessProvider _processProvider;
|
||||
private readonly IConfigService _configService;
|
||||
private readonly ITagService _tagService;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public ImportScriptService(IProcessProvider processProvider,
|
||||
IVideoFileInfoReader videoFileInfoReader,
|
||||
IConfigService configService,
|
||||
IConfigFileProvider configFileProvider,
|
||||
ITagService tagService,
|
||||
Logger logger)
|
||||
{
|
||||
_processProvider = processProvider;
|
||||
_videoFileInfoReader = videoFileInfoReader;
|
||||
_configService = configService;
|
||||
_configFileProvider = configFileProvider;
|
||||
_tagService = tagService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
@ -66,6 +71,9 @@ namespace NzbDrone.Core.MediaFiles
|
|||
environmentVariables.Add("Sonarr_Series_TvMazeId", series.TvMazeId.ToString());
|
||||
environmentVariables.Add("Sonarr_Series_ImdbId", series.ImdbId ?? string.Empty);
|
||||
environmentVariables.Add("Sonarr_Series_Type", series.SeriesType.ToString());
|
||||
environmentVariables.Add("Sonarr_Series_OriginalLanguage", IsoLanguages.Get(series.OriginalLanguage).ThreeLetterCode);
|
||||
environmentVariables.Add("Sonarr_Series_Genres", string.Join("|", series.Genres));
|
||||
environmentVariables.Add("Sonarr_Series_Tags", string.Join("|", series.Tags.Select(t => _tagService.GetTag(t).Label)));
|
||||
|
||||
environmentVariables.Add("Sonarr_EpisodeFile_EpisodeCount", localEpisode.Episodes.Count.ToString());
|
||||
environmentVariables.Add("Sonarr_EpisodeFile_EpisodeIds", string.Join(",", localEpisode.Episodes.Select(e => e.Id)));
|
||||
|
|
|
@ -12,6 +12,8 @@ using NzbDrone.Core.Configuration;
|
|||
using NzbDrone.Core.HealthCheck;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.MediaInfo;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Tags;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Validation;
|
||||
|
@ -24,18 +26,21 @@ namespace NzbDrone.Core.Notifications.CustomScript
|
|||
private readonly IConfigService _configService;
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly IProcessProvider _processProvider;
|
||||
private readonly ITagRepository _tagRepository;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public CustomScript(IConfigFileProvider configFileProvider,
|
||||
IConfigService configService,
|
||||
IDiskProvider diskProvider,
|
||||
IProcessProvider processProvider,
|
||||
ITagRepository tagRepository,
|
||||
Logger logger)
|
||||
{
|
||||
_configFileProvider = configFileProvider;
|
||||
_configService = configService;
|
||||
_diskProvider = diskProvider;
|
||||
_processProvider = processProvider;
|
||||
_tagRepository = tagRepository;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
@ -63,6 +68,9 @@ namespace NzbDrone.Core.Notifications.CustomScript
|
|||
environmentVariables.Add("Sonarr_Series_ImdbId", series.ImdbId ?? string.Empty);
|
||||
environmentVariables.Add("Sonarr_Series_Type", series.SeriesType.ToString());
|
||||
environmentVariables.Add("Sonarr_Series_Year", series.Year.ToString());
|
||||
environmentVariables.Add("Sonarr_Series_OriginalLanguage", IsoLanguages.Get(series.OriginalLanguage).ThreeLetterCode);
|
||||
environmentVariables.Add("Sonarr_Series_Genres", string.Join("|", series.Genres));
|
||||
environmentVariables.Add("Sonarr_Series_Tags", string.Join("|", series.Tags.Select(t => _tagRepository.Get(t).Label)));
|
||||
environmentVariables.Add("Sonarr_Release_EpisodeCount", remoteEpisode.Episodes.Count.ToString());
|
||||
environmentVariables.Add("Sonarr_Release_SeasonNumber", remoteEpisode.Episodes.First().SeasonNumber.ToString());
|
||||
environmentVariables.Add("Sonarr_Release_EpisodeNumbers", string.Join(",", remoteEpisode.Episodes.Select(e => e.EpisodeNumber)));
|
||||
|
@ -106,6 +114,9 @@ namespace NzbDrone.Core.Notifications.CustomScript
|
|||
environmentVariables.Add("Sonarr_Series_ImdbId", series.ImdbId ?? string.Empty);
|
||||
environmentVariables.Add("Sonarr_Series_Type", series.SeriesType.ToString());
|
||||
environmentVariables.Add("Sonarr_Series_Year", series.Year.ToString());
|
||||
environmentVariables.Add("Sonarr_Series_OriginalLanguage", IsoLanguages.Get(series.OriginalLanguage).ThreeLetterCode);
|
||||
environmentVariables.Add("Sonarr_Series_Genres", string.Join("|", series.Genres));
|
||||
environmentVariables.Add("Sonarr_Series_Tags", string.Join("|", series.Tags.Select(t => _tagRepository.Get(t).Label)));
|
||||
environmentVariables.Add("Sonarr_EpisodeFile_Id", episodeFile.Id.ToString());
|
||||
environmentVariables.Add("Sonarr_EpisodeFile_EpisodeCount", episodeFile.Episodes.Value.Count.ToString());
|
||||
environmentVariables.Add("Sonarr_EpisodeFile_RelativePath", episodeFile.RelativePath);
|
||||
|
@ -167,6 +178,9 @@ namespace NzbDrone.Core.Notifications.CustomScript
|
|||
environmentVariables.Add("Sonarr_Series_ImdbId", series.ImdbId ?? string.Empty);
|
||||
environmentVariables.Add("Sonarr_Series_Type", series.SeriesType.ToString());
|
||||
environmentVariables.Add("Sonarr_Series_Year", series.Year.ToString());
|
||||
environmentVariables.Add("Sonarr_Series_OriginalLanguage", IsoLanguages.Get(series.OriginalLanguage).ThreeLetterCode);
|
||||
environmentVariables.Add("Sonarr_Series_Genres", string.Join("|", series.Genres));
|
||||
environmentVariables.Add("Sonarr_Series_Tags", string.Join("|", series.Tags.Select(t => _tagRepository.Get(t).Label)));
|
||||
environmentVariables.Add("Sonarr_EpisodeFile_Ids", string.Join(",", renamedFiles.Select(e => e.EpisodeFile.Id)));
|
||||
environmentVariables.Add("Sonarr_EpisodeFile_RelativePaths", string.Join("|", renamedFiles.Select(e => e.EpisodeFile.RelativePath)));
|
||||
environmentVariables.Add("Sonarr_EpisodeFile_Paths", string.Join("|", renamedFiles.Select(e => e.EpisodeFile.Path)));
|
||||
|
@ -196,6 +210,9 @@ namespace NzbDrone.Core.Notifications.CustomScript
|
|||
environmentVariables.Add("Sonarr_Series_ImdbId", series.ImdbId ?? string.Empty);
|
||||
environmentVariables.Add("Sonarr_Series_Type", series.SeriesType.ToString());
|
||||
environmentVariables.Add("Sonarr_Series_Year", series.Year.ToString());
|
||||
environmentVariables.Add("Sonarr_Series_OriginalLanguage", IsoLanguages.Get(series.OriginalLanguage).ThreeLetterCode);
|
||||
environmentVariables.Add("Sonarr_Series_Genres", string.Join("|", series.Genres));
|
||||
environmentVariables.Add("Sonarr_Series_Tags", string.Join("|", series.Tags.Select(t => _tagRepository.Get(t).Label)));
|
||||
environmentVariables.Add("Sonarr_EpisodeFile_Id", episodeFile.Id.ToString());
|
||||
environmentVariables.Add("Sonarr_EpisodeFile_EpisodeCount", episodeFile.Episodes.Value.Count.ToString());
|
||||
environmentVariables.Add("Sonarr_EpisodeFile_RelativePath", episodeFile.RelativePath);
|
||||
|
@ -232,6 +249,9 @@ namespace NzbDrone.Core.Notifications.CustomScript
|
|||
environmentVariables.Add("Sonarr_Series_ImdbId", series.ImdbId ?? string.Empty);
|
||||
environmentVariables.Add("Sonarr_Series_Type", series.SeriesType.ToString());
|
||||
environmentVariables.Add("Sonarr_Series_Year", series.Year.ToString());
|
||||
environmentVariables.Add("Sonarr_Series_OriginalLanguage", IsoLanguages.Get(series.OriginalLanguage).ThreeLetterCode);
|
||||
environmentVariables.Add("Sonarr_Series_Genres", string.Join("|", series.Genres));
|
||||
environmentVariables.Add("Sonarr_Series_Tags", string.Join("|", series.Tags.Select(t => _tagRepository.Get(t).Label)));
|
||||
|
||||
ExecuteScript(environmentVariables);
|
||||
}
|
||||
|
@ -253,6 +273,9 @@ namespace NzbDrone.Core.Notifications.CustomScript
|
|||
environmentVariables.Add("Sonarr_Series_ImdbId", series.ImdbId ?? string.Empty);
|
||||
environmentVariables.Add("Sonarr_Series_Type", series.SeriesType.ToString());
|
||||
environmentVariables.Add("Sonarr_Series_Year", series.Year.ToString());
|
||||
environmentVariables.Add("Sonarr_Series_OriginalLanguage", IsoLanguages.Get(series.OriginalLanguage).ThreeLetterCode);
|
||||
environmentVariables.Add("Sonarr_Series_Genres", string.Join("|", series.Genres));
|
||||
environmentVariables.Add("Sonarr_Series_Tags", string.Join("|", series.Tags.Select(t => _tagRepository.Get(t).Label)));
|
||||
environmentVariables.Add("Sonarr_Series_DeletedFiles", deleteMessage.DeletedFiles.ToString());
|
||||
|
||||
ExecuteScript(environmentVariables);
|
||||
|
@ -319,6 +342,9 @@ namespace NzbDrone.Core.Notifications.CustomScript
|
|||
environmentVariables.Add("Sonarr_Series_ImdbId", series.ImdbId ?? string.Empty);
|
||||
environmentVariables.Add("Sonarr_Series_Type", series.SeriesType.ToString());
|
||||
environmentVariables.Add("Sonarr_Series_Year", series.Year.ToString());
|
||||
environmentVariables.Add("Sonarr_Series_OriginalLanguage", IsoLanguages.Get(series.OriginalLanguage).ThreeLetterCode);
|
||||
environmentVariables.Add("Sonarr_Series_Genres", string.Join("|", series.Genres));
|
||||
environmentVariables.Add("Sonarr_Series_Tags", string.Join("|", series.Tags.Select(t => _tagRepository.Get(t).Label)));
|
||||
environmentVariables.Add("Sonarr_Download_Client", message.DownloadClientName ?? string.Empty);
|
||||
environmentVariables.Add("Sonarr_Download_Client_Type", message.DownloadClientType ?? string.Empty);
|
||||
environmentVariables.Add("Sonarr_Download_Id", message.DownloadId ?? string.Empty);
|
||||
|
|
Loading…
Reference in New Issue