Exemplo n.º 1
0
        /// <summary>
        /// Analysis media files -> MediaFiles/MediaFilesTotalLength/MediaFilesTotalSize/MediaFilesDecodeDesc/VWidth/VHeight/NRefFrame/VFormat
        /// </summary>
        /// <param name="targetFileNameFromSource">Full name of media file.</param>
        public MovieInfo(string targetFileNameFromSource)
        {
            ActorUIDs  = new List <Guid>();
            MediaFiles = new List <MediaFileInfo>();

            SourcePath         = Path.GetDirectoryName(targetFileNameFromSource);
            SourceMediaFileExt = Path.GetExtension(targetFileNameFromSource);
            if (Directory.Exists(SourcePath))
            {
                List <string> files = Directory.EnumerateFiles(SourcePath, "*" + SourceMediaFileExt, SearchOption.TopDirectoryOnly)
                                      .Where(f => f.EndsWith(SourceMediaFileExt, StringComparison.CurrentCultureIgnoreCase)).ToList();
                files.ForEach(f => MediaFiles.Add(new MediaFileInfo(f)));
            }
            else
            {
                throw new DirectoryNotFoundException(String.Format("源目录{0}不存在!", SourcePath));
            }

            if (MediaFiles == null)
            {
                return;
            }
            if (MediaFiles.Count == 0)
            {
                return;
            }
            VWidth                = MediaFiles[0].VWidth;
            VHeight               = MediaFiles[0].VHeight;
            NRefFrame             = MediaFiles[0].NRefFrame;
            VFormat               = MediaFiles[0].VFormat;
            MediaFilesTotalLength = MediaFiles.Sum(t => t.VLength);
            MediaFilesTotalSize   = MediaFiles.Sum(t => t.VFileSize);
            var _vlength = TimeSpan.FromMinutes(MediaFilesTotalLength);

            MediaFilesDecodeDesc = string.Format("[{0}, {1}*{2}, {3:00}:{4:00}:{5:00}, {6}, {7}]",
                                                 MediaFiles[0].VFormat,
                                                 MediaFiles[0].VWidth,
                                                 MediaFiles[0].VHeight,
                                                 _vlength.Hours,
                                                 _vlength.Minutes,
                                                 _vlength.Seconds,
                                                 XService.Format_MachineSize(MediaFilesTotalSize),
                                                 MediaFiles[0].V2D3DVR);
        }
Exemplo n.º 2
0
        public MediaFileInfo(string fname)
        {
            LocalFileName = fname;
            _mfile        = new MediaFile(LocalFileName);
            VFileSize     = _mfile.General.Size;
            TimeSpan tss = TimeSpan.FromMilliseconds(Convert.ToDouble(_mfile.General.Duration));

            if (_mfile.Video.Count > 0)
            {
                V2D3DVR = "2D";
                int nref = 1;

                VFormat   = _mfile.General.Format;
                VWidth    = _mfile.Video[0].Width;
                VHeight   = _mfile.Video[0].Height;
                VLength   = tss.Minutes;
                NRefFrame = 1;

                if (_mfile.Video[0].encoderSettings.Count > 0)
                {
                    if (int.TryParse(_mfile.Video[0].EncoderSettings["ref"], out nref))
                    {
                        if (nref > 1)
                        {
                            V2D3DVR   = "3D";
                            NRefFrame = nref;
                        }
                    }
                }
                MediaDecodeDesc = string.Format("[{0}, {1}*{2}, {3:00}:{4:00}:{5:00}, {6}, {7}]",
                                                _mfile.General.Format,
                                                _mfile.Video[0].Width,
                                                _mfile.Video[0].Height,
                                                tss.Hours,
                                                tss.Minutes,
                                                tss.Seconds,
                                                XService.Format_MachineSize(_mfile.General.Size),
                                                V2D3DVR);
            }
        }
Exemplo n.º 3
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            long lsize = (long)value;

            return(XService.Format_MachineSize(lsize));
        }
Exemplo n.º 4
0
        private async void Func_NMResolveBResult(string v)
        {
            listInformation.SelectedIndex = listInformation.Items.Add($"READ: {v}...");
            NewMovieInfo.OfficialWeb      = v;
            var streamresult = (await XService.Func_Net_ReadWebData(NewMovieInfo.OfficialWeb)).response;

            CurrentHtmlDocument.LoadHtml(streamresult.Replace(Environment.NewLine, " ").Replace("\t", " "));
            HtmlNode hnode = CurrentHtmlDocument.DocumentNode;

            HtmlNode _errornode = hnode.SelectSingleNode("//div[@class='alert alert-block alert-error']");

            if (_errornode != null)
            {
                listInformation.SelectedIndex = listInformation.Items.Add($"ERR: {v}...");
                return;
            }

            switch (NewMovieQuerySite.QName)
            {
            case "CSite":
            case "USite":
                hnode = hnode.SelectSingleNode("/html/body/div[2]");
                break;

            case "BSite":
                hnode = hnode.SelectSingleNode("/html/body/div[@class='container']");
                break;

            case "LSite":
                break;

            default:
                break;
            }

            foreach (HtmlNode _txt_node in hnode.SelectNodes(".//text()"))
            {
                if (!Regex.IsMatch(_txt_node.InnerText, @"\S", RegexOptions.Singleline))
                {
                    _txt_node.Remove();
                }
            }

            NewMovieInfo.ReleaseName = hnode.SelectSingleNode("//h3[1]").InnerText;
            //TODO: LINE 180
            Func_AnalysisMovie(hnode);

            //刪除重複 Mov
            if (XGlobal.CurrentContext.TotalMovies.Exists(m => m.ReleaseID == NewMovieInfo.ReleaseID))
            {
                if (MessageBox.Show(
                        String.Format(
                            "影片 [{0}] 已有歸類存檔({1}*{2}, {3}),操作取消,刪除影片文件嗎?",
                            NewMovieInfo.ReleaseID,
                            NewMovieInfo.VWidth,
                            NewMovieInfo.VHeight,
                            XService.Format_MachineSize(NewMovieInfo.MediaFilesTotalSize)),
                        "影片已歸檔",
                        MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    XService.DeleteMovies(NewMovieInfo.SourcePath, NewMovieInfo.SourceMediaFileExt);
                    listInformation.SelectedIndex = listInformation.Items.Add($"源目錄 {NewMovieInfo.SourcePath} 已刪除.");
                    return;
                }
                else
                {
                    listInformation.SelectedIndex = listInformation.Items.Add($"影片 [{NewMovieInfo.ReleaseID}] 已有歸類存檔,操作取消.");
                    return;
                }
            }

            //處理 Stars 段
            if (!await Func_AnalysisStars(hnode))
            {
                return;
            }

            //處理Cover
            //if (!await Func_AnalysisMovie_Cover(hnode)) return;

            //處理 Sample Images 段
            //if (!await Func_AnalysisMovie_Samples(hnode)) return;
        }