Exemplo n.º 1
0
        /// <summary>
        /// 移动视频
        /// </summary>
        /// <param name="filename">原始文件名</param>
        /// <param name="info">影片信息</param>
        /// <param name="config">用户配置</param>
        private static string MoveVideo(string filename, MovieInfo info, Config config)
        {
            try
            {
                Log.Save($"准备移动视频");
                var extName = Path.GetExtension(filename);
                var star    = (info.Star == null ? "未知" : info.Star[0]);
                star = star.Replace("/", " ").Replace(@"\", "").Replace("?", "");
                var starPath = $"{config.LibraryPath}{Path.DirectorySeparatorChar}{star}";
                //创建演员文件夹
                Log.Save($"创建演员文件夹 {starPath}");
                Directory.CreateDirectory(starPath);
                //移动视频
                string newName = config.PathTemplate.Replace("$番号", info.Number).Replace("$标题", info.Title).Replace("$年代", info.Year).Replace("$女优", info.Star == null?"": info.Star[0]);
                newName = newName.Replace(" : ", "").Replace(":", "").Replace("?", "").Replace("/", "").Replace("*", "").Replace("\n", "").Replace(@"\", "").TrimStart().TrimEnd();
                string videoPath = $"{starPath}{Path.DirectorySeparatorChar}{(newName.Length > 50 ? newName.Substring(0, 50) : newName)}".TrimEnd();
                Log.Save($"创建视频文件夹 {videoPath}");
                Directory.CreateDirectory(videoPath);
                string newFilePath = $"{videoPath}{Path.DirectorySeparatorChar}{info.Number}{extName}";
                //判断是否两个视频
                var dirName = Path.GetDirectoryName(filename);
                var name    = Path.GetFileNameWithoutExtension(filename);
                name = name.Remove(name.Length - 2);
                var filename2 = $"{dirName}{Path.DirectorySeparatorChar}{name}_2{extName}";
                var filename3 = $"{dirName}{Path.DirectorySeparatorChar}{name}_3{extName}";
                var filename4 = $"{dirName}{Path.DirectorySeparatorChar}{name}_4{extName}";
                var filename5 = $"{dirName}{Path.DirectorySeparatorChar}{name}_5{extName}";
                if (File.Exists(filename2))
                {
                    newFilePath = $"{videoPath}{Path.DirectorySeparatorChar}{info.Number}-cd1{extName}";
                    File.Move(filename, newFilePath);
                    Log.Save($"移动1完成 {newFilePath}");

                    newFilePath = $"{videoPath}{Path.DirectorySeparatorChar}{info.Number}-cd2{extName}";
                    File.Move(filename2, newFilePath);
                    Log.Save($"移动2完成 {newFilePath}");
                    if (File.Exists(filename3))
                    {
                        newFilePath = $"{videoPath}{Path.DirectorySeparatorChar}{info.Number}-cd3{extName}";
                        File.Move(filename3, newFilePath);
                        Log.Save($"移动3完成 {newFilePath}");
                    }
                    if (File.Exists(filename4))
                    {
                        newFilePath = $"{videoPath}{Path.DirectorySeparatorChar}{info.Number}-cd4{extName}";
                        File.Move(filename4, newFilePath);
                        Log.Save($"移动4完成 {newFilePath}");
                    }
                    if (File.Exists(filename5))
                    {
                        newFilePath = $"{videoPath}{Path.DirectorySeparatorChar}{info.Number}-cd5{extName}";
                        File.Move(filename5, newFilePath);
                        Log.Save($"移动5完成 {newFilePath}");
                    }
                    OnLog?.Invoke($"移动多个视频完成", LogLevels.Success);

                    return(videoPath);
                }
                else
                {
                    File.Move(filename, newFilePath);
                    OnLog?.Invoke($"移动视频完成", LogLevels.Success);
                    Log.Save($"移动视频完成 {newFilePath}");
                    return(videoPath);
                }
            }
            catch (Exception e)
            {
                OnLog?.Invoke($"移动视频出错 {info.Number}", LogLevels.Error);
                throw e;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 处理封面图
        /// </summary>
        /// <param name="videoPath">视频文件夹</param>
        /// <param name="backdropPath">背景图</param>
        private static void ProcessCover(string num, string videoPath, MovieInfo info, VideoInfo videoInfo)
        {
            //下载背景图
            var backdropPath = DownImage(videoPath, info.Backdrop, "Backdrop.jpg", config.SkipExistsImage);

            if (backdropPath == "")
            {
                if (info.Generate == "avsox")//avsox 老片子个别没图片,用javbus 在尝试一次
                {
                    Log.Save($"下载 avsox 图片失败, 换 javbus");
                    info.Backdrop = GetMovieInfo(num, config, SiteTypes.javbus).Backdrop;
                    if (info != null)
                    {
                        backdropPath = DownImage(videoPath, info.Backdrop, "Backdrop.jpg", config.SkipExistsImage);
                    }
                }
            }
            if (backdropPath == "")
            {
                Log.Save($"下载背景图失败失败");
                throw new Exception("下载背景图失败");
            }
            OnLog?.Invoke($"下载背景图完成", LogLevels.Success);
            videoInfo.back = "成功";

            string coverPath;

            //如果有现成的就下载
            if (!string.IsNullOrEmpty(info.Cover))
            {
                Log.Save($"下载网站上的封面");
                //下载封面
                coverPath = DownImage(videoPath, info.Cover, "Cover.png");
                if (coverPath != "")
                {
                    var img = Image.FromFile(coverPath);
                    if (img.Height >= 396 && Math.Abs(img.Height * 0.7029702970297 - img.Width) <= 5)
                    {
                        //封面图高度大于396,可以用,不再处理
                        img.Dispose();
                        return;
                    }
                    img.Dispose();
                    img = Image.FromFile(backdropPath);
                    if (img.Height <= 350)
                    {
                        //背景图高度<396,没有截图的必要,不再处理
                        img.Dispose();
                        return;
                    }
                    img.Dispose();
                }
            }

            Log.Save($"下载识别,或者下载的尺寸太小,准备截图");
            //没发下载,或者下载的尺寸太小 需要截图
            new ImageTools(config).ClipCover(videoPath, backdropPath, config.CensoredNoAI && videoInfo.avtype != "无码");
            videoInfo.cover = "成功";
            Log.Save($"处理封面图完成");
            OnLog?.Invoke($"处理封面图完成", LogLevels.Success);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取影片信息
        /// </summary>
        /// <param name="num">番号</param>
        /// <param name="config">用户配置</param>
        /// <returns></returns>
        private static MovieInfo GetMovieInfo(string num, Config config, SiteTypes userSite = SiteTypes.Auto)
        {
            MovieInfo info = null;
            var       site = userSite != SiteTypes.Auto ? userSite : (SiteTypes)Enum.Parse(typeof(SiteTypes), config.Site.ToString());

            switch (site)
            {
            case SiteTypes.All:
                Log.Save($"使用系统默认采集顺序");
                if (NumberTools.IsUncensored(num))     //无码处理
                {
                    if (num.StartsWith("fc2", StringComparison.CurrentCultureIgnoreCase))
                    {
                        Log.Save($"使用 Fc2Club 影片采集");
                        //fc2 单独处理
                        info = new Fc2Club().GetInfoAsync(num);
                        if (info == null)
                        {
                            Log.Save($"Fc2Club 采集失败,使用 Javdb 采集");
                            //未找到再 Javdb
                            info = new Javdb().GetInfoAsync(num);
                        }
                    }
                    else
                    {
                        // 先 Avsox
                        Log.Save($"使用 Avsox 影片采集");
                        info = Avsox.Instance.GetInfoAsync(num);
                        if (info == null)
                        {
                            //未找到再 JavBus
                            Log.Save($"Avsox 采集失败,使用 JavBus 采集");
                            info = JavBus.Instance.GetInfoAsync(num);
                            if (info == null)
                            {
                                Log.Save($"JavBus 采集失败,使用 Javdb 采集");
                                //未找到再 Javdb
                                info = new Javdb().GetInfoAsync(num);
                            }
                        }
                    }
                }
                else
                {
                    //先 Avmoo
                    Log.Save($"使用 Avmoo 影片采集");
                    info = new Avmoo().GetInfoAsync(num);
                    if (info == null)
                    {
                        //未找到再 avBus
                        Log.Save($"Avmoo 采集失败,使用 JavBus 采集");
                        info = JavBus.Instance.GetInfoAsync(num);
                        if (info == null)
                        {
                            //未找到再 Javdb
                            Log.Save($"JavBus 采集失败,使用 Javdb 采集");
                            info = new Javdb().GetInfoAsync(num);

                            /*if (info == null)
                             * {
                             *  //未找到再 JavLibrary
                             *  info = new JavLibrary().GetInfoAsync(num);
                             * }*/
                        }
                    }
                    else
                    {
                        if (info.Star == null)
                        {
                            //未找到再 avBus
                            Log.Save($"Avmoo 未采集到演员,使用 JavBus 采集");
                            info = JavBus.Instance.GetInfoAsync(num);
                        }
                    }
                }
                break;

            case SiteTypes.javbus:
                Log.Save($"使用 JavBus 采集");
                info = JavBus.Instance.GetInfoAsync(num);
                break;

            case SiteTypes.avsox:
                Log.Save($"使用 Avsox 采集");
                info = Avsox.Instance.GetInfoAsync(num);
                break;

            case SiteTypes.javlibrary:
                Log.Save($"使用 JavLibrary 采集");
                info = new JavLibrary().GetInfoAsync(num);
                break;

            case SiteTypes.fc2club:
                Log.Save($"使用 Fc2Club 采集");
                info = new Fc2Club().GetInfoAsync(num);
                break;

            case SiteTypes.avmoo:
                Log.Save($"使用 Avmoo 采集");
                info = new Avmoo().GetInfoAsync(num);
                break;

            case SiteTypes.javdb:
                Log.Save($"使用 Javdb 采集");
                info = new Javdb().GetInfoAsync(num);
                break;
            }
            if (info != null)
            {
                info.Number = num;
                Log.Save($"获取影片信息完成 <= [{info.Generate}]");
                OnLog?.Invoke($"获取影片信息完成 <= [{info.Generate}]", LogLevels.Success);
                return(info);
            }
            else
            {
                Log.Save($"未获取到影片信息");
                throw new Exception($"未获取到影片信息 {num}");
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 搜索资料
        /// </summary>
        /// <param name="num">番号</param>
        /// <returns></returns>
        private MovieInfo SearchInfoFromNum(string num)
        {
            HtmlWeb web = new HtmlWeb();
            //搜索番号
            var doc   = web.Load($"https://javdb.com/search?q={num}&f=all");
            var movie = new MovieInfo();
            var body  = doc.DocumentNode;
            var nodes = body.SelectNodes("/html/body/section/div/div[4]/div/div");

            if (nodes != null)
            {
                HtmlNode node = null;
                foreach (var item in nodes)
                {
                    if (item.SelectSingleNode("a/div[2]").InnerText.ToLower() == num.ToLower())
                    {
                        node = item;
                        break;
                    }
                }
                if (node != null)
                {
                    //详情页链接
                    var url = "https://javdb.com" + node.SelectSingleNode("a").Attributes["href"].Value;
                    //封面 太小 放弃
                    //var img = node.SelectSingleNode("a/div/img");
                    //movie.Cover = img.Attributes["src"].Value;
                    //标题
                    movie.Title = node.SelectSingleNode("a").Attributes["title"].Value;
                    //加载详情页
                    doc  = web.Load(url);
                    body = doc.DocumentNode;
                    //背景图
                    movie.Backdrop = body.SelectSingleNode("/html/body/section/div/div[3]/div[1]/a/img").Attributes["src"].Value;
                    //没有图片
                    if (!movie.Backdrop.EndsWith(".jpg", StringComparison.CurrentCultureIgnoreCase))
                    {
                        return(null);
                    }
                    nodes        = body.SelectNodes("/html/body/section/div/div[3]/div[2]/nav/div");
                    movie.Year   = nodes[1].SelectSingleNode("span[2]").InnerText.Replace(" ", "");
                    movie.Length = nodes[2].SelectSingleNode("span[2]").InnerText.Replace(" ", "");

                    foreach (var item in nodes)
                    {
                        if (item.ChildNodes[1].InnerText.Contains("導演"))
                        {
                            movie.Direct = item.ChildNodes[3].InnerText.Replace(" ", "").Replace("\t", "").Replace("\n", "").Replace("\r", "");
                        }
                        if (item.ChildNodes[1].InnerText.Contains("片商"))
                        {
                            movie.Studio = item.ChildNodes[3].InnerText.Replace(" ", "").Replace("\t", "").Replace("\n", "").Replace("\r", "");
                        }
                        if (item.ChildNodes[1].InnerText.Contains("發行"))
                        {
                            movie.Publisher = item.ChildNodes[3].InnerText.Replace(" ", "").Replace("\t", "").Replace("\n", "").Replace("\r", "");
                        }
                        if (item.ChildNodes[1].InnerText.Contains("系列"))
                        {
                            movie.Series = item.ChildNodes[3].InnerText.Replace(" ", "").Replace("\t", "").Replace("\n", "").Replace("\r", "");
                        }
                        if (item.ChildNodes[1].InnerText.Contains("类别"))
                        {
                            var genres = item.ChildNodes[3].SelectNodes("a");
                            if (genres != null)
                            {
                                List <string> list = new List <string>();
                                foreach (var sub in genres)
                                {
                                    list.Add(sub.InnerText);
                                }
                                movie.Genre = list;
                            }
                        }
                        if (item.ChildNodes[1].InnerText.Contains("演員"))
                        {
                            var stars = item.ChildNodes[3].SelectNodes("a");
                            if (stars != null)
                            {
                                List <string> list = new List <string>();
                                foreach (var sub in stars)
                                {
                                    list.Add(sub.InnerText);
                                }
                                movie.Star = list;
                            }
                        }
                    }
                    movie.WebSite  = url;
                    movie.Generate = "javdb";
                    return(movie);
                }
            }
            return(null);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 搜索资料
        /// </summary>
        /// <param name="num">番号</param>
        /// <returns></returns>
        private MovieInfo SearchInfoFromNum(string num)
        {
            //HtmlWeb web = new HtmlWeb();
            //搜索番号
            //var doc = web.Load($"https://avsox.host/cn/search/{num}");
            var searchUrl = $"https://avsox.host/cn/search/{num}";
            var html      = client.GetStringAsync(searchUrl).Result;

            if (string.IsNullOrEmpty(html))
            {
                //没抓取到html
                return(null);
            }
            var doc = new HtmlDocument();

            doc.LoadHtml(html);
            var notFound = doc.DocumentNode.SelectSingleNode("/html/body/div[2]/div[1]/h4");

            if (notFound != null)
            {
                //页面放回404节点
                return(null);
            }
            var movie = new MovieInfo();
            var body  = doc.DocumentNode;
            var node  = body.SelectSingleNode("/html/body/div[2]/div/div/div/a");

            if (node == null)
            {
                //没有找到详情链接
                return(null);
            }
            //详情页链接
            var img = node.SelectSingleNode("div[1]/img");

            //封面
            movie.Cover = img.Attributes["src"].Value;
            //标题
            movie.Title = img.Attributes["title"].Value;
            //番号
            movie.Number = node.SelectSingleNode("div[2]/span/date[1]").InnerText;
            //加载详情页
            var detailUrl = node.Attributes["href"].Value;

            client.DefaultRequestHeaders.Referrer = new Uri(searchUrl);
            html = client.GetStringAsync(detailUrl).Result;
            doc.LoadHtml(html);
            body = doc.DocumentNode;
            //背景图
            var imgNode = body.SelectSingleNode("/html/body/div[2]/div[1]/div[1]/a/img");

            if (imgNode == null)
            {
                return(null);
            }
            movie.Backdrop = imgNode.Attributes["src"].Value;
            //没有图片
            if (!movie.Backdrop.EndsWith(".jpg", StringComparison.CurrentCultureIgnoreCase))
            {
                return(null);
            }
            var nodes = body.SelectNodes("/html/body/div[2]/div[1]/div[2]/p");

            if (nodes == null)
            {
                return(null);
            }
            for (int i = 0; i < nodes.Count; i++)
            {
                var text = nodes[i].InnerText;
                if (text.Contains("发行时间"))
                {
                    movie.Year = text.Replace("发行时间:", "").Replace(" ", "");
                }
                else if (text.Contains("长度"))
                {
                    movie.Length = text.Replace("长度:", "").Replace(" ", "");
                }
                else if (text.Contains("制作商"))
                {
                    movie.Studio = nodes[i + 1].InnerText;
                }
                else if (text.Contains("系列:"))
                {
                    movie.Series = nodes[i + 1].InnerText;
                }
                else if (text.Contains("类别:"))
                {
                    var genres = nodes[i + 1].SelectNodes("span");
                    if (genres != null)
                    {
                        List <string> list = new List <string>();
                        foreach (var sub in genres)
                        {
                            list.Add(sub.InnerText);
                        }
                        movie.Genre = list;
                    }
                }
            }
            nodes = body.SelectNodes("//*[@id=\"avatar-waterfall\"]/a");
            if (nodes != null)
            {
                List <string> list = new List <string>();
                foreach (var sub in nodes)
                {
                    list.Add(sub.InnerText.Replace("\t", "").Replace("\n", "").Replace("\r", "").Replace(" ", ""));
                }
                movie.Star = list;
            }
            movie.WebSite  = detailUrl;
            movie.Generate = "avsox";
            return(movie);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 搜索资料
        /// </summary>
        /// <param name="num">番号</param>
        /// <returns></returns>
        private MovieInfo SearchInfoFromNum(string num)
        {
            HtmlWeb web = new HtmlWeb();
            //搜索番号
            var doc      = web.Load($"https://avmask.com/cn/search/{num}");
            var notFound = doc.DocumentNode.SelectSingleNode("/html/body/div[2]/div[1]/h4");

            if (notFound != null)
            {
                //没找到
            }
            else
            {
                var      movie = new MovieInfo();
                var      body  = doc.DocumentNode;
                var      nodes = body.SelectNodes("/html/body/div[2]/div/div/div");
                HtmlNode node  = null;
                foreach (var item in nodes)
                {
                    if (item.SelectSingleNode("a/div[2]/span/date[1]").InnerText.Replace("-", "").Replace("_", "").ToLower() == num.Replace("-", "").Replace("_", "").ToLower())
                    {
                        node = item;
                        break;
                    }
                }
                if (node != null)
                {
                    //详情页链接
                    var url = node.SelectSingleNode("a").Attributes["href"].Value;
                    var img = node.SelectSingleNode("a/div/img");
                    //封面
                    movie.Cover = img.Attributes["src"].Value;
                    //标题
                    movie.Title = img.Attributes["title"].Value;
                    //加载详情页
                    doc  = web.Load(url);
                    body = doc.DocumentNode;
                    //背景图
                    movie.Backdrop = body.SelectSingleNode("/html/body/div[2]/div[1]/div[1]/a/img").Attributes["src"].Value;
                    //没有图片
                    if (!movie.Backdrop.EndsWith(".jpg", StringComparison.CurrentCultureIgnoreCase))
                    {
                        return(null);
                    }
                    nodes        = body.SelectNodes("/html/body/div[2]/div[1]/div[2]/p");
                    movie.Year   = nodes[1].InnerText.Replace("发行时间:", "").Replace(" ", "");
                    movie.Length = nodes[2].InnerText.Replace("长度:", "").Replace(" ", "");
                    if (nodes[3].InnerText.Contains("导演:"))
                    {
                        movie.Direct = nodes[3].InnerText.Replace("导演:", "").Replace(" ", "").Replace("\t", "").Replace("\n", "").Replace("\r", "");
                        if (nodes[4].InnerText.Contains("制作商:"))
                        {
                            movie.Studio = nodes[5].InnerText;
                            if (nodes[6].InnerText.Contains("发行商:"))
                            {
                                movie.Publisher = nodes[7].InnerText;
                                if (nodes[8].InnerText.Contains("系列:"))
                                {
                                    movie.Series = nodes[9].InnerText;
                                }
                            }
                        }
                        else
                        {
                            if (nodes[4].InnerText.Contains("发行商:"))
                            {
                                movie.Publisher = nodes[5].InnerText;
                            }
                        }
                    }
                    else
                    {
                        if (nodes[3].InnerText.Contains("制作商:"))
                        {
                            movie.Studio = nodes[4].InnerText;
                            if (nodes[5].InnerText.Contains("发行商:"))
                            {
                                movie.Publisher = nodes[6].InnerText;
                                if (nodes[7].InnerText.Contains("系列:"))
                                {
                                    movie.Series = nodes[8].InnerText;
                                }
                            }
                        }
                        else
                        {
                            if (nodes[3].InnerText.Contains("发行商:"))
                            {
                                movie.Publisher = nodes[4].InnerText;
                            }
                        }
                        //movie.Series = nodes[4].InnerText;
                    }
                    //类别
                    nodes = nodes[nodes.Count - 1].SelectNodes("span/a");
                    if (nodes != null)
                    {
                        List <string> list = new List <string>();
                        foreach (var sub in nodes)
                        {
                            list.Add(sub.InnerText);
                        }
                        movie.Genre = list;
                    }
                    nodes = body.SelectNodes("//*[@id=\"avatar-waterfall\"]/a");
                    if (nodes != null)
                    {
                        List <string> list = new List <string>();
                        foreach (var sub in nodes)
                        {
                            list.Add(sub.InnerText.Replace("\t", "").Replace("\n", "").Replace("\r", "").Replace(" ", ""));
                        }
                        movie.Star = list;
                    }
                    movie.WebSite  = url;
                    movie.Generate = "avmoo";
                    return(movie);
                }
            }
            return(null);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 加载视频同名nfo文件
        /// </summary>
        /// <param name="videoPath">视频路径</param>
        /// <returns>影片信息</returns>
        internal static MovieInfo Load(string videoPath)
        {
            try
            {
                var filename     = Path.GetFileNameWithoutExtension(videoPath);
                var dirName      = Path.GetDirectoryName(videoPath);
                var nfoPath      = $"{dirName}{Path.DirectorySeparatorChar}{filename.Replace("-cd1", "").Replace("-cd2", "").Replace("-cd3", "").Replace("-cd4", "").Replace("-cd5", "")}.nfo";
                var coverPath    = $"{dirName}{Path.DirectorySeparatorChar}Cover.png";
                var backdropPath = $"{dirName}{Path.DirectorySeparatorChar}Backdrop.jpg";
                var doc          = new XmlDocument();
                doc.Load(nfoPath);
                var title     = doc.GetElementsByTagName("title")[0].InnerText;
                var num       = doc.GetElementsByTagName("num")[0].InnerText;
                var genres    = doc.GetElementsByTagName("genre");
                var actors    = doc.GetElementsByTagName("actor");
                var node      = doc.GetElementsByTagName("premiered");
                var premiered = node == null || node.Count == 0? "": node[0].InnerText;
                var website   = doc.GetElementsByTagName("website")[0].InnerText;
                var attr      = Regex.Match(filename, @"-cd(\d{1})").Groups[1].Value;
                var movieInfo = new MovieInfo()
                {
                    Number   = num,
                    Title    = title,
                    Cover    = coverPath,
                    Year     = premiered,
                    WebSite  = website,
                    Backdrop = backdropPath,
                    Attr     = attr
                };

                var list = new List <string>();
                foreach (XmlNode genre in genres)
                {
                    if (genre.InnerText.Contains("发行商"))
                    {
                        movieInfo.Publisher = genre.InnerText.Replace("发行商:", "");
                    }
                    else if (genre.InnerText.Contains("制作商"))
                    {
                        movieInfo.Studio = genre.InnerText.Replace("制作商:", "");
                    }
                    else if (genre.InnerText.Contains("导演"))
                    {
                        movieInfo.Direct = genre.InnerText.Replace("导演:", "");
                    }
                    else if (genre.InnerText.Contains("系列"))
                    {
                        movieInfo.Series = genre.InnerText.Replace("系列:", "");
                    }
                    else
                    {
                        list.Add(genre.InnerText);
                    }
                }
                movieInfo.Genre = list;
                list            = new List <string>();
                foreach (XmlNode actor in actors)
                {
                    list.Add(actor.ChildNodes[0].InnerText);
                }
                movieInfo.Star = list;
                return(movieInfo);
            }
            catch (Exception e)
            {
                throw new Exception($"加载nfo出错{e.Message}");
            }
        }
Exemplo n.º 8
0
        internal static void Create(string path, MovieInfo data, Config config)
        {
            if (!config.CreateNfo)
            {
                //不创建就返回
                return;
            }
            try
            {
                XmlDocument    doc = new XmlDocument();
                XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "utf-8", "yes");
                doc.AppendChild(dec);

                XmlElement root = doc.CreateElement("movie");
                doc.AppendChild(root);

                XmlElement title = doc.CreateElement("title");
                title.InnerText = config.TitleTemplate.Replace("$番号", data.Number).Replace("$标题", data.Title).Replace("$年代", data.Year).Replace("$女优", data.Star == null?"": data.Star[0]);
                root.AppendChild(title);

                XmlElement year = doc.CreateElement("year");
                year.InnerText = string.IsNullOrEmpty(data.Year) ? "未知" : data.Year.Substring(0, 4);
                root.AppendChild(year);

                XmlElement poster = doc.CreateElement("poster");
                poster.InnerText = "Cover.png";
                root.AppendChild(poster);

                XmlElement thumb = doc.CreateElement("thumb");
                thumb.InnerText = "Cover.png";
                root.AppendChild(thumb);

                XmlElement fanart = doc.CreateElement("fanart");
                fanart.InnerText = "Backdrop.jpg";
                root.AppendChild(fanart);

                XmlElement premiered = doc.CreateElement("premiered");
                premiered.InnerText = data.Year;
                root.AppendChild(premiered);

                if (!string.IsNullOrEmpty(data.Length))
                {
                    XmlElement runtime = doc.CreateElement("runtime");
                    runtime.InnerText = data.Length.Replace("分钟", "").Replace("分鐘", "");
                    root.AppendChild(runtime);
                }
                if (data.Star == null)
                {
                    XmlElement actor = doc.CreateElement("actor");
                    root.AppendChild(actor);

                    XmlElement name = doc.CreateElement("name");
                    name.InnerText = "未知";
                    actor.AppendChild(name);

                    XmlElement type = doc.CreateElement("type");
                    type.InnerText = "Actor";
                    actor.AppendChild(type);
                }
                else
                {
                    foreach (var item in data.Star)
                    {
                        XmlElement actor = doc.CreateElement("actor");
                        root.AppendChild(actor);

                        XmlElement name = doc.CreateElement("name");
                        name.InnerText = item;
                        actor.AppendChild(name);

                        XmlElement type = doc.CreateElement("type");
                        type.InnerText = "Actor";
                        actor.AppendChild(type);
                    }
                }

                if (data.Genre != null)
                {
                    foreach (var item in data.Genre)
                    {
                        XmlElement genre = doc.CreateElement("genre");
                        genre.InnerText = item;
                        root.AppendChild(genre);

                        XmlElement tag = doc.CreateElement("tag");
                        tag.InnerText = item;
                        root.AppendChild(tag);
                    }
                }

                if (!string.IsNullOrEmpty(data.Series))
                {
                    XmlElement genre = doc.CreateElement("genre");
                    genre.InnerText = $"系列:{data.Series}";
                    root.AppendChild(genre);

                    XmlElement tag = doc.CreateElement("tag");
                    tag.InnerText = $"系列:{data.Series}";
                    root.AppendChild(tag);
                }

                if (!string.IsNullOrEmpty(data.Direct))
                {
                    XmlElement genre = doc.CreateElement("genre");
                    genre.InnerText = $"导演:{data.Direct}";
                    root.AppendChild(genre);

                    XmlElement tag = doc.CreateElement("tag");
                    tag.InnerText = $"导演:{data.Direct}";
                    root.AppendChild(tag);
                }

                if (!string.IsNullOrEmpty(data.Publisher))
                {
                    XmlElement genre = doc.CreateElement("genre");
                    genre.InnerText = $"发行商:{data.Publisher}";
                    root.AppendChild(genre);

                    XmlElement tag = doc.CreateElement("tag");
                    tag.InnerText = $"发行商:{data.Publisher}";
                    root.AppendChild(tag);
                }

                if (!string.IsNullOrEmpty(data.Studio))
                {
                    XmlElement studio = doc.CreateElement("studio");
                    studio.InnerText = data.Studio;
                    root.AppendChild(studio);

                    XmlElement maker = doc.CreateElement("maker");
                    maker.InnerText = data.Studio;
                    root.AppendChild(maker);

                    XmlElement genre = doc.CreateElement("genre");
                    genre.InnerText = $"制作商:{data.Studio}";
                    root.AppendChild(genre);

                    XmlElement tag = doc.CreateElement("tag");
                    tag.InnerText = $"制作商:{data.Studio}";
                    root.AppendChild(tag);
                }

                XmlElement num = doc.CreateElement("num");
                num.InnerText = data.Number;
                root.AppendChild(num);

                XmlElement cover = doc.CreateElement("cover");
                cover.InnerText = data.Backdrop;
                root.AppendChild(cover);

                XmlElement website = doc.CreateElement("website");
                website.InnerText = data.WebSite;
                root.AppendChild(website);

                doc.Save(path);
            }
            catch (Exception e)
            {
                Log.Save($"生成nfo出错 {e.Message}");
                throw new Exception($"生成nfo出错 {e.Message}");
            }
        }