예제 #1
0
 public FourChanAzurePipeline() : base()
 {
     Info("Initializing 4chan Azure pipeline.");
     Aggregator  = new FourChan();
     Db          = new CosmosDB("socialnews");
     Initialized = Aggregator.Initialized && Db.Initialized;
 }
예제 #2
0
        public TitlingResult ThreadTopicToIrc(TitlingRequest req)
        {
            ChanPost post;

            switch (GetSource(req.Url))
            {
            case Source.FourChan:
                post = FourChan.GetPost(req.Url);
                break;

            case Source.ArchiveMoe:
                post = ArchiveMoe.GetPost(req.Url);
                break;

            default:
                // Fail loudly for now, this might change in the future.
                throw new NotSupportedException("Passed TitlingRequest not supported.");
            }
            req.Resource = post;

            if (post.Success)
            {
                string topic = ConstructTopic(post, req.Url);
                if (topic == null)
                {
                    req.AddMessage("Post contained neither subject or comment.");
                    return(req.CreateResult(false));
                }

                req.IrcTitle.SetFormat("[ /{0}/ - {1} ] [ {2} ]", post.Board, post.BoardName, topic);
                return(req.CreateResult(true));
            }
            else
            {
                return(req.CreateResult(false));
            }
        }
예제 #3
0
 public FourChanTests()
 {
     aggregator = new FourChan();
 }