コード例 #1
0
        async Task HandleRadarrOnGrab(OnGrabRadarrEvent e)
        {
            var embed = new EmbedBuilder();
            var movie = await GetMovie(e.Movie.Id);

            var history = await GetHistory(e.Movie.Id);

            embed.Title = $"{movie.Title} {movie.Year}";
            embed.WithFooter("Movie Grabbed");
            embed.Color       = Color.Orange;
            embed.Description = Program.Clamp(movie.Overview, 256);
            embed.ImageUrl    = movie.Images.First().RemoteUrl;
            if (!string.IsNullOrWhiteSpace(e.Release.Quality))
            {
                embed.AddField("Quality", e.Release.Quality, true);
            }
            string relStr;

            if (history == null)
            {
                relStr = "*Failed to get release*";
            }
            else
            {
                relStr = $"[{e.Release.ReleaseTitle}]({history.Data.NzbInfoUrl})";
            }
            embed.AddField("Release", relStr, true);
            foreach (var chnl in Channels)
            {
                var shouldSend = await ShouldSendInChannel(e.Movie.Id, chnl);

                if (shouldSend)
                {
                    await chnl.Channel.SendMessageAsync(embed : embed.Build());
                }
            }
        }
コード例 #2
0
 private void RadarrWebhookService_OnGrab(object sender, OnGrabRadarrEvent e)
 {
     new Thread(handleOnSeparateThread).Start(e);
 }