Esempio n. 1
0
 private static void SaveQueue(UrlQueue url)
 {
     ThriftTool.AddColumn(url.Url, "UrlQueue", "Url", url.Url);
     ThriftTool.AddColumn(url.Url, "UrlQueue", "Title", url.Title);
     ThriftTool.AddColumn(url.Url, "UrlQueue", "Type", url.Type);
     ThriftTool.AddColumn(url.Url, "UrlQueue", "Status", url.Status);
 }
Esempio n. 2
0
        private static void QueuePage(string url, string title)
        {
            var urlQueue = new UrlQueue
            {
                Url    = url,
                Title  = title,
                Type   = "M01",
                Status = QueueType.Queue.ToString()
            };

            SaveQueue(urlQueue);
        }
Esempio n. 3
0
        public static string ProcessQueue()
        {
            //var result = string.Empty;

            int tempi = 0;

            CqlResult cqlResult = ThriftTool.GetByCql("Select * from UrlQueue where 'Status'='" + QueueType.Queue.ToString() + "' and 'Type'='M01' limit 5");

            //result = cqlResult.Rows.Count.ToString();
            //CqlResult cqlResult = ThriftTool.GetByCql("select top 1 * from UrlQueue where Status=" + (int)QueueType.Queue , client);
            //CqlResult cqlResult = client.execute_cql_query(ThriftTool.ToByte("select * from BahamutGames where Title='" + gameList[i] + "'"), Compression.NONE);
            foreach (var row in cqlResult.Rows)
            {
                var url = new UrlQueue();
                foreach (var col in row.Columns)
                {
                    var name = ThriftTool.ToString(col.Name);

                    switch (name)
                    {
                    case "Title":
                        url.Title = ThriftTool.ToString(col.Value);
                        break;

                    case "Url":
                        url.Url = ThriftTool.ToString(col.Value);
                        break;

                    case "Status":
                        url.Status = ThriftTool.ToString(col.Value);
                        break;

                    case "Type":
                        url.Type = ThriftTool.ToString(col.Value);
                        break;
                    }
                    //result = url.Url;
                    //process topic
                    //result += url.Url;
                }

                if (url.Url != null)
                {
                    //result = "http://www.mobile01.com/" + url.Url;
                    ProcessUrl("http://www.mobile01.com/" + url.Url);
                    tempi++;
                }

                //mark as done
                ThriftTool.AddColumn(url.Url, "UrlQueue", "Status", QueueType.Done.ToString());
            }
            return(tempi.ToString());
        }
Esempio n. 4
0
 private static void SaveQueue(UrlQueue url)
 {
     ThriftTool.AddColumn(url.Url, "UrlQueue", "Url", url.Url);
     ThriftTool.AddColumn(url.Url, "UrlQueue", "Title", url.Title);
     ThriftTool.AddColumn(url.Url, "UrlQueue", "Type", url.Type);
     ThriftTool.AddColumn(url.Url, "UrlQueue", "Status", url.Status);
 }
Esempio n. 5
0
        private static void QueuePage(string url, string title)
        {

                var urlQueue = new UrlQueue
                                   {
                                       Url = url,
                                       Title = title,
                                       Type = "M01",
                                       Status = QueueType.Queue.ToString()
                                   };
                SaveQueue(urlQueue);
        }
Esempio n. 6
0
        public static string ProcessQueue()
        {
            //var result = string.Empty;

            int tempi=0;

            CqlResult cqlResult = ThriftTool.GetByCql("Select * from UrlQueue where 'Status'='" + QueueType.Queue.ToString() + "' and 'Type'='M01' limit 5");
            //result = cqlResult.Rows.Count.ToString();
            //CqlResult cqlResult = ThriftTool.GetByCql("select top 1 * from UrlQueue where Status=" + (int)QueueType.Queue , client);
            //CqlResult cqlResult = client.execute_cql_query(ThriftTool.ToByte("select * from BahamutGames where Title='" + gameList[i] + "'"), Compression.NONE);
            foreach (var row in cqlResult.Rows)
            {
                var url = new UrlQueue();
                foreach (var col in row.Columns)
                {
                    var name = ThriftTool.ToString(col.Name);
                    
                    switch (name)
                    {
                        case "Title":
                            url.Title = ThriftTool.ToString(col.Value);
                            break;
                        case "Url":
                            url.Url = ThriftTool.ToString(col.Value);
                            break;
                        case "Status":
                            url.Status = ThriftTool.ToString(col.Value);
                            break;
                        case "Type":
                            url.Type = ThriftTool.ToString(col.Value);
                            break;
                    }
                    //result = url.Url;
                    //process topic
                    //result += url.Url;

                }

                if (url.Url!=null)
                {
                    //result = "http://www.mobile01.com/" + url.Url;
                    ProcessUrl("http://www.mobile01.com/" + url.Url);
                    tempi++;
                }

                //mark as done
                ThriftTool.AddColumn(url.Url, "UrlQueue", "Status", QueueType.Done.ToString());
            }
            return tempi.ToString();
        }