示例#1
0
        /// <summary>
        /// 根据选择的电影名称,对电影进行下载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button4_Click(object sender, EventArgs e)
        {
            cmbDownLink.Items.Clear();
            shouMessage(g_currentMovieInfo.title);
            pyRunInfo _temp = new pyRunInfo();

            string urltitle = System.Web.HttpUtility.UrlEncode(g_currentMovieInfo.title, Encoding.GetEncoding("gbk"));

            _temp.url    = urltitle;
            _temp.pyName = "getMovie_dytt.py";
            g_pyRunQue.Enqueue(_temp);


//            _getMovieJsonInDouban(urltitle, "getMovie_dytt.py");
            //todo:对接收到的数据做拆分
            urltitle     = System.Web.HttpUtility.UrlEncode(g_currentMovieInfo.title, Encoding.GetEncoding("utf-8"));
            _temp.url    = urltitle;
            _temp.pyName = "getMovie_qj.py";
            g_pyRunQue.Enqueue(_temp);
            //          _getMovieJsonInDouban(urltitle, "getMovie_qj.py");
        }
示例#2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (g_pyRunQue.Count > 0 && beginRun == false)
            {
                pyRunInfo _temp = g_pyRunQue.Dequeue();
                _getMovieJsonInDouban(_temp.url, _temp.pyName);
                beginRun = true;
            }
            try
            {
                if (strloadJson.IndexOf("end") > -1)
                {
                    shouMessage("movie info get finish\r\n");
                    strloadJson = "";
                    readFileToShow("jsonMovie.json");
                }
                if (strloadJson.IndexOf("readfinish") > -1)
                {
                    shouMessage("movie info get finish\r\n");
                    strloadJson = "";
                    beginRun    = false;
                    //initLoadJson();
                    if (g_sheetRpy.Length > 0)
                    {
                        string data = g_sheetRpy;
                        g_sheetRpy = "";
                        int len = data.Length;
                        try
                        {
                            JObject jaObj = (JObject)JsonConvert.DeserializeObject(data);
                            var     obj   = JArray.Parse(jaObj["movie"].ToString());
                            foreach (var ob in obj)
                            {
                                moviedownLinkInfo temp = new moviedownLinkInfo();
                                temp.name = ob["name"].ToString();
                                temp.link = ob["link"].ToString();
                                //byte[] uni = Encoding.Unicode.GetBytes(temp.name);

                                //temp.name = Encoding.ASCII.GetString(uni);
                                g_moviedownlinkinfo.Add(temp);
                            }
                            foreach (var linkinfo in g_moviedownlinkinfo)
                            {
                                if (linkinfo.name == "showLink")
                                {
                                    shouMessage(linkinfo.link);
                                }
                                else
                                {
                                    cmbDownLink.Items.Add(linkinfo.name);
                                }
                            }
                        }
                        catch (Exception)
                        {
                            shouMessage(data);
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }