Esempio n. 1
0
 /// <summary>
 /// 采集影片资料
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button_update_Click(object sender, EventArgs e)
 {
     if (IsRun)
     {
         ShowToast("有任务正在执行");
         return;
     }
     if (selectCard == null)
     {
         ShowToast("请先选择一部影片");
         return;
     }
     panelEx1.Enabled = false;
     ShowToast("正在采集影片信息...");
     FileProcess.Start(new List <VideoInfo>()
     {
         selectCard.VideoFile
     }, config, new FileProcess.OnCompleteHandle(() =>
     {
         Invoke(new EventHandler((o1, e1) =>
         {
             selectCard.Movie = NfoTools.Load(selectCard.VideoFile.filename);
             panelEx1.Enabled = true;
             ShowToast("影片信息采集成功");
         }));
     }),
                       new FileProcess.OnLogHandle((str, logLevel) =>
     {
         LogAdd(str, logLevel);
     }));
 }
Esempio n. 2
0
        /// <summary>
        /// 处理视频
        /// </summary>
        private static void ProcMoive()
        {
            //获取当前等待处理的文件
            var videoInfo = GetFileName();

            if (!string.IsNullOrEmpty(videoInfo.nfo) || !File.Exists(videoInfo.filename))
            {
                return;
            }
            int i = currentIndex - 1;

            //是否取到文件
            if (string.IsNullOrEmpty(videoInfo.filename) ||
                string.IsNullOrEmpty(videoInfo.name) ||
                string.IsNullOrEmpty(videoInfo.num))
            {
                return;
            }
            Log.Save($"开始处理文件 {videoInfo.filename}");
            try
            {
                OnLog?.Invoke($"==========开始处理{videoInfo.num}==========");
                int value = (int)(i * 10.0 / filelist.Count * 10.0);
                OnProgress?.Invoke(value);
                //获取影片信息
                Log.Save($"准备获取影片信息 {videoInfo.num}");
                Log.Save($"无码影片: {videoInfo.avtype}");
                MovieInfo info = GetMovieInfo(videoInfo.num, config);
                filelist[i].generate = info.Generate;
                filelist[i].info     = "成功";

                //移动视频
                var videoPath = MoveVideo(videoInfo.filename, info, config);
                filelist[i].video = "成功";

                //处理封面图
                ProcessCover(videoInfo.num, videoPath, info, filelist[i]);

                //创建NFO文件
                NfoTools.Create($"{videoPath}{Path.DirectorySeparatorChar}{info.Number}.nfo", info, config);
                OnLog?.Invoke($"创建nfo文件完成", LogLevels.Success);
                Log.Save($"创建nfo文件完成");
                filelist[i].nfo = "成功";
            }
            catch (Exception e)
            {
                OnLog?.Invoke($"处理出错 {e.Message}\n{e.StackTrace}", LogLevels.Error);
            }
        }
Esempio n. 3
0
        private void AddCard()
        {
            Invoke(new EventHandler((o1, e1) =>
            {
                tabControlPanel4.Controls.RemoveByKey("cardPanel");
            }));
            var flowLayoutPanel1 = new Panel()
            {
                Name        = "cardPanel",
                AutoScroll  = true,
                Location    = new Point(55, 44),
                Size        = new Size(tabControlPanel4.Width - 479, tabControlPanel4.Height - 8),
                BorderStyle = BorderStyle.None,
                BackColor   = Color.White
            };
            var count = 6;
            var width = (flowLayoutPanel1.Width - 30) / count;

            for (int i = libPage * 12; i < libPage * 12 + 12; i++)
            {
                if (i >= libFiles.Count)
                {
                    break;
                }
                var item = libFiles[i];
                try
                {
                    //加载影片信息
                    var movieInfo = NfoTools.Load(item);

                    //创建信息卡片
                    var card = new InfoCard()
                    {
                        Width     = width,
                        Height    = (int)(width / 0.55),
                        Cursor    = Cursors.Hand,
                        Movie     = movieInfo,
                        VideoFile = new VideoInfo()
                        {
                            filename = item,
                            name     = Path.GetFileNameWithoutExtension(item),
                            num      = movieInfo.Number,
                            avtype   = NumberTools.IsUncensored(movieInfo.Number) ? "无码" : ""
                        }
                    };
                    //双击播放事件
                    card.DoubleClick += (o1, e1) =>
                    {
                        Process.Start(item);
                    };
                    //单击信息查看
                    card.Click += (o1, e1) =>
                    {
                        ShowMovieDetail(card);
                    };
                    //计算位置
                    var x = (i % 12) % count * card.Width + ((i % 12) % count) + 4;
                    var y = (i % 12) / count * card.Height + ((i % 12) / count * 20) + 10;
                    card.Location = new Point(x, y);
                    flowLayoutPanel1.Controls.Add(card);
                }
                catch (Exception e1)
                {
                    Console.WriteLine(e1.Message);
                }
            }
            if (flowLayoutPanel1.Controls.Count > 0)
            {
                Invoke(new EventHandler((o1, e1) =>
                {
                    tabControlPanel4.Controls.Add(flowLayoutPanel1);
                }));
            }
            else
            {
                flowLayoutPanel1.Dispose();
            }
        }