コード例 #1
0
ファイル: BaseNotification.cs プロジェクト: anojht/Ombi
        private NotificationMessageContent Parse(NotificationOptions model, NotificationTemplates template, NotificationAgent agent)
        {
            var resolver   = new NotificationMessageResolver();
            var curlys     = new NotificationMessageCurlys();
            var preference = GetUserPreference(model.UserId, agent);

            if (model.RequestType == RequestType.Movie)
            {
                _log.LogDebug("Notification options: {@model}, Req: {@MovieRequest}, Settings: {@Customization}", model, MovieRequest, Customization);
                curlys.Setup(model, MovieRequest, Customization, preference);
            }
            else if (model.RequestType == RequestType.TvShow)
            {
                _log.LogDebug("Notification options: {@model}, Req: {@TvRequest}, Settings: {@Customization}", model, TvRequest, Customization);
                curlys.Setup(model, TvRequest, Customization, preference);
            }
            else if (model.RequestType == RequestType.Album)
            {
                _log.LogDebug("Notification options: {@model}, Req: {@AlbumRequest}, Settings: {@Customization}", model, AlbumRequest, Customization);
                curlys.Setup(model, AlbumRequest, Customization, preference);
            }
            var parsed = resolver.ParseMessage(template, curlys);

            return(parsed);
        }
コード例 #2
0
        /// <summary>
        /// Parses the message.
        /// </summary>
        /// <param name="notification">The notification.</param>
        /// <param name="c">The c.</param>
        /// <returns></returns>
        public NotificationMessageContent ParseMessage(NotificationTemplates notification, NotificationMessageCurlys c)
        {
            var content = Resolve(notification.Message, notification.Subject, c.Curlys);

            content.Image      = c.PosterImage;
            content.DetailsUrl = c.DetailsUrl;
            return(content);
        }