示例#1
0
        private void pbOut_Click(object sender, EventArgs e)
        {
            string title = TextKit.selectVideoText;
            //获取文件路路径
            string videoPath = FileKit.select(title);

            if (string.IsNullOrEmpty(videoPath))
            {
                return;
            }
            pbOutPath = videoPath;
            string prewPic = VideoHandleKit.getPrewPic(videoPath);

            if (FileKit.isexist(prewPic))
            {
                this.pbOut.Load(prewPic);
            }
            else
            {
                MessageBox.Show(TextKit.thrumnailNotFoundMsg);
            }
        }
示例#2
0
        public void monitorQueue()
        {
            Thread videoThread = new Thread(delegate()
            {
                while (1 > 0)
                {
                    if (QueueKit.q.Count > 0)
                    {
                        DataModel data      = (DataModel)QueueKit.q.Dequeue();
                        string phonePath    = "";
                        DataGridViewRow row = dataGridView.Rows[data.sort];

                        DataGridViewTextBoxCell phone       = (DataGridViewTextBoxCell)row.Cells["phone"];
                        DataGridViewTextBoxCell transStatus = (DataGridViewTextBoxCell)row.Cells["transStatus"];
                        transStatus.Value = "转码中";
                        phonePath         = phone.Value.ToString();
                        wirteGridData();

                        CmdKit.RunCmd(data.op);

                        transStatus.Value = TextKit.transStatusSuccess;
                        wirteGridData();
                        QueueKit.qftp.Enqueue(data);
                    }
                    Thread.Sleep(50);
                }
            });

            videoThread.Start();

            Thread ftpThread = new Thread(delegate()
            {
                while (1 > 0)
                {
                    if (QueueKit.qftp.Count > 0)
                    {
                        DataModel data = (DataModel)QueueKit.qftp.Dequeue();

                        DataGridViewRow row = dataGridView.Rows[data.sort];

                        DataGridViewTextBoxCell phone     = (DataGridViewTextBoxCell)row.Cells["phone"];
                        DataGridViewTextBoxCell ftpStatus = (DataGridViewTextBoxCell)row.Cells["ftpStatus"];
                        ftpStatus.Value = "上传中";

                        wirteGridData();

                        List <FtpModel> ftp = JsonConvert.DeserializeObject <List <FtpModel> >(FileKit.getData(FileKit.ftpPath));
                        foreach (FtpModel m in ftp)
                        {
                            FtpKit.FtpServerIP = m.ftpip;
                            FtpKit.FtpUserID   = m.ftpuser;
                            FtpKit.FtpPassword = m.ftppassword;
                            string path        = System.IO.Directory.GetCurrentDirectory() + @"\ffmpeg\output\" + data.phone;
                            FtpKit.MakeDir(m.ftpdir + data.phone);

                            string mp4path = path + ".mp4";
                            FtpKit.FtpUploadBroken(mp4path, m.ftpdir + data.phone);
                            string jsonpath = path + ".json";
                            if (FileKit.isexist(jsonpath))
                            {
                                FtpKit.FtpUploadBroken(jsonpath, m.ftpdir + data.phone);
                            }
                            string jpgpath = path + ".jpg";
                            if (FileKit.isexist(jpgpath))
                            {
                                FtpKit.FtpUploadBroken(jpgpath, m.ftpdir + data.phone);
                            }
                        }

                        ftpStatus.Value = TextKit.ftpStatusSuccess;
                        wirteGridData();
                    }
                    Thread.Sleep(50);
                }
            });

            ftpThread.Start();
        }