Exemplo n.º 1
0
 public SMH_RSSEngine(PublicationSection publicationSection, Publication publication, NewsCrud_DBContext dbContext) : base(publicationSection, publication, dbContext)
 {
 }
Exemplo n.º 2
0
        // GET: /<controller>/PullScrapedQueue/
        public string PullScrapedQueue()
        {
            int i = 0;

            //fetch up to 20 each run (testing!)
            int max = 20;

            while (i < max)
            {
                string articleJsonString = _queueContext.Pop();
                if (String.IsNullOrEmpty(articleJsonString) == true)
                {
                    //nothing found, can do 'break' here if don't want to try 20 more times
                    //but maybe they are empty 'errored' messages that need to be popped
                }
                else
                {
                    dynamic articleJson = null;
                    try
                    {
                        articleJson = Newtonsoft.Json.JsonConvert.DeserializeObject(articleJsonString);
                    }
                    catch (Exception ex)
                    {
                        string exception = ex.ToString();
                        //gulp
                    }

                    if (articleJson != null)
                    {
                        //try parsing all the bits
                        try
                        {
                            Author a1 = new Author();
                            a1      = Author.FindByName("", _dbContext);
                            a1.Name = "test 1";



                            Author a2 = new Author();
                            a2.Name = "test 2";

                            ArticleData art = new ArticleData();
                            art.Body = "art test";


                            AuthorArticle a = new AuthorArticle();

                            //try get pub and section info from input
                            Publication p = new Publication();

                            //otherwise create new publication and/or section
                            PublicationSection psect = new PublicationSection();
                        }
                        catch (Exception ex)
                        {
                            string exception = ex.ToString();
                            //gulp
                        }
                    }
                }
            }

            //return View();
            return("ingest api done");
        }
Exemplo n.º 3
0
 public BaseEngine(PublicationSection publicationSection, Publication publication, NewsCrud_DBContext dbContext)
 {
     _publicationSection = publicationSection;
     _publication        = publication;
     _dbContext          = dbContext;
 }