예제 #1
0
        public override async Task HandleAsync <T>(ContentRequestNotification notification, ILogger <T> logger)
        {
            RawTweet videoTweet = await twitterRepository.FindByIdAsync(notification.IdOfTweetBeingRepliedTo.Value);

            TweetNotification tweetNotification = new TweetNotification(videoTweet, notification.IdOfRequestingTweet, notification.RequestedBy);

            if (tweetNotification.HasVideo())
            {
                var video   = tweetNotification.GetVideo();
                var request = tweetNotification.GetVideoRequest(video.Id);

                await scraperRepository.CaptureTwitterVideoAndRequestAsync(request, video);

                string response = video.GetResponseContent(settings.BaseUrl, request.RequestedBy);
                //send back response
                await twitterRepository.ReplyToTweetAsync(request.RequestingTweetId, response);

                logger.LogInformation($"Sent back this response -> {response}");
            }
            else
            {
                logger.LogWarning($"The tweet being responded to didn't have a video -> {tweetNotification.TweetWithVideo.id}");
                await base.HandleAsync(notification, logger);
            }
        }
예제 #2
0
        public void LoadNotificationForScreenshot(TweetNotification tweet, int width, int height)
        {
            browser.LoadHtml(tweet.GenerateHtml(enableCustomCSS: false), "http://tweetdeck.twitter.com/?" + DateTime.Now.Ticks);

            Location        = ControlExtensions.InvisibleLocation;
            FormBorderStyle = Program.UserConfig.ShowScreenshotBorder ? FormBorderStyle.FixedToolWindow : FormBorderStyle.None;

            SetNotificationSize(width, height, false);
        }
예제 #3
0
        public FormNotificationExample(FormBrowser owner, PluginManager pluginManager) : base(owner, pluginManager, false)
        {
            string exampleTweetHTML = ScriptLoader.LoadResource("pages/example.html", true);

            #if DEBUG
            exampleTweetHTML = exampleTweetHTML.Replace("</p>", @"</p><div style='margin-top:256px'>Scrollbar test padding...</div>");
            #endif

            exampleNotification = TweetNotification.Example(exampleTweetHTML, 95);
        }
예제 #4
0
        protected override string GetTweetHTML(TweetNotification tweet)
        {
            string html = tweet.GenerateHtml("td-screenshot", this);

            foreach (InjectedHTML injection in plugins.NotificationInjections)
            {
                html = injection.InjectInto(html);
            }

            return(html);
        }
예제 #5
0
        public FormNotificationExample(FormBrowser owner, PluginManager pluginManager) : base(owner, pluginManager, false)
        {
            browser.LoadingStateChanged += browser_LoadingStateChanged;

            string exampleTweetHTML = ScriptLoader.LoadResourceSilent("pages/example.html")?.Replace("{avatar}", TweetNotification.AppLogo.Url) ?? string.Empty;

            #if DEBUG
            exampleTweetHTML = exampleTweetHTML.Replace("</p>", @"</p><div style='margin-top:256px'>Scrollbar test padding...</div>");
            #endif

            exampleNotification = new TweetNotification(string.Empty, string.Empty, "Home", exampleTweetHTML, 176, string.Empty, string.Empty);
        }
예제 #6
0
        // notification methods

        public void ShowNotification(TweetNotification notification)
        {
            if (IsPaused)
            {
                tweetQueue.Enqueue(notification);
            }
            else
            {
                tweetQueue.Enqueue(notification);
                UpdateTitle();

                if (totalTime == 0)
                {
                    LoadNextNotification();
                }
            }
        }
예제 #7
0
 private void Awake()
 {
     Instance    = this;
     m_Timestamp = -1f;
 }
 public void LoadNotificationForScreenshot(TweetNotification tweet, int width, int height)
 {
     LoadTweet(tweet);
     SetNotificationSize(width, height);
 }
 protected override string GetTweetHTML(TweetNotification tweet)
 {
     return(tweet.GenerateHtml(enableCustomCSS: false));
 }
예제 #10
0
 public void LoadNotificationHeadContents(string headContents)
 {
     form.InvokeAsyncSafe(() => {
         TweetNotification.SetHeadTag(headContents);
     });
 }
예제 #11
0
 public void LoadFontSizeClass(string fsClass)
 {
     form.InvokeAsyncSafe(() => {
         TweetNotification.SetFontSizeClass(fsClass);
     });
 }