Grab Environment Variables

Sonarr version (exact version): 2.0.0.4143
Mono version (if Sonarr is not running on Windows):4.2.3
OS: Centos 7 1511
Description of issue:
Does Sonarr currently have environment variables for on Grab notifications? It appears that only on rename/download/upgrade have this…

There is OnGrab:
Sonarr/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs

    public override void OnGrab(GrabMessage message)
    {
        var series = message.Series;
        var remoteEpisode = message.Episode;
        var releaseGroup = remoteEpisode.ParsedEpisodeInfo.ReleaseGroup;
        var environmentVariables = new StringDictionary();

        environmentVariables.Add("Sonarr_EventType", "Grab");
        environmentVariables.Add("Sonarr_Series_Id", series.Id.ToString());
        environmentVariables.Add("Sonarr_Series_Title", series.Title);
        environmentVariables.Add("Sonarr_Series_TvdbId", series.TvdbId.ToString());
        environmentVariables.Add("Sonarr_Series_Type", series.SeriesType.ToString());
        environmentVariables.Add("Sonarr_Release_SeasonNumber", remoteEpisode.ParsedEpisodeInfo.SeasonNumber.ToString());
        environmentVariables.Add("Sonarr_Release_EpisodeNumbers", string.Join(",", remoteEpisode.Episodes.Select(e => e.EpisodeNumber)));
        environmentVariables.Add("Sonarr_Release_Title", remoteEpisode.Release.Title);
        environmentVariables.Add("Sonarr_Release_Indexer", remoteEpisode.Release.Indexer);
        environmentVariables.Add("Sonarr_Release_Size", remoteEpisode.Release.Size.ToString());
        environmentVariables.Add("Sonarr_Release_ReleaseGroup", releaseGroup);

        ExecuteScript(environmentVariables);
    }
1 Like

I take it you mean for custom scripts? Wiki is now updated.

2 Likes

Awesome! Thanks @Thirrian for the info and @markus101 for updating that wiki.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.