示例#1
0
文件: Crawler.cs 项目: ellolee/Jvedio
        public static void SaveInfo(Dictionary <string, string> Info, WebSite webSite)
        {
            string id = "";

            try { id = Info["id"].ToUpper(); }
            catch { return; }
            if (id == "")
            {
                return;
            }
            //保存信息
            DataBase.UpdateInfoFromNet(Info, webSite);
            DetailMovie detailMovie = DataBase.SelectDetailMovieById(id);


            //nfo 信息保存到视频同目录
            if (Properties.Settings.Default.SaveInfoToNFO)
            {
                if (Directory.Exists(Properties.Settings.Default.NFOSavePath))
                {
                    //固定位置
                    SaveToNFO(detailMovie, Path.Combine(Properties.Settings.Default.NFOSavePath, $"{id}.nfo"));
                }
                else
                {
                    //与视频同路径
                    string path = detailMovie.filepath;
                    if (System.IO.File.Exists(path))
                    {
                        SaveToNFO(detailMovie, Path.Combine(new FileInfo(path).DirectoryName, $"{id}.nfo"));
                    }
                }
            }
        }
示例#2
0
        private void BigImage_Drop(object sender, DragEventArgs e)
        {
            //分为文件夹和文件
            string[] dragdropFiles = (string[])e.Data.GetData(DataFormats.FileDrop);
            string   file          = dragdropFiles[0];

            if (StaticClass.IsFile(file))
            {
                FileInfo fileInfo = new FileInfo(file);
                if (fileInfo.Extension.ToLower() == ".jpg")
                {
                    try
                    {
                        File.Copy(fileInfo.FullName, BasePicPath + $"BigPic\\{vieModel.DetailMovie.id.ToUpper()}.jpg", true);
                        DetailMovie detailMovie = vieModel.DetailMovie;
                        detailMovie.bigimage = null;
                        vieModel.DetailMovie = null;
                        detailMovie.bigimage = StaticClass.BitmapImageFromFile(fileInfo.FullName);
                        vieModel.DetailMovie = detailMovie;

                        RefreshUI("", fileInfo.FullName);
                    }
                    catch (Exception ex)
                    {
                        new Msgbox(this, ex.Message).ShowDialog();
                    }
                }
                else
                {
                    new Msgbox(this, "仅支持 jpg").ShowDialog();
                }
            }
        }
示例#3
0
        public void SaveInfo(Dictionary <string, string> Info)
        {
            if (!Info.ContainsKey("id"))
            {
                Info.Add("id", ID);
            }
            //保存信息
            DataBase.UpdateInfoFromNet(Info);
            DetailMovie detailMovie = DataBase.SelectDetailMovieById(ID);


            //nfo 信息保存到视频同目录
            if (Properties.Settings.Default.SaveInfoToNFO)
            {
                if (Directory.Exists(Properties.Settings.Default.NFOSavePath))
                {
                    //固定位置
                    nfo.SaveToNFO(detailMovie, Path.Combine(Properties.Settings.Default.NFOSavePath, $"{ID}.nfo"));
                }
                else
                {
                    //与视频同路径
                    string path = detailMovie.filepath;
                    if (File.Exists(path))
                    {
                        nfo.SaveToNFO(detailMovie, Path.Combine(new FileInfo(path).DirectoryName, $"{ID}.nfo"));
                    }
                }
            }
        }
示例#4
0
        public DetailMovie SelectDetailMovieBySql(string sqltext)
        {
            DetailMovie result = null;

            if (string.IsNullOrEmpty(sqltext))
            {
                return(result);
            }
            else
            {
                cmd.CommandText = sqltext;
            }

            using (SQLiteDataReader sr = cmd.ExecuteReader())
            {
                try
                {
                    while (sr.Read())
                    {
                        DetailMovie detailMovie = GetDetailMovieFromSQLiteDataReader(sr);
                        if (detailMovie != null)
                        {
                            return(detailMovie);
                        }
                    }
                }
                catch (Exception e) { Logger.LogD(e); }
            }
            return(result);
        }
示例#5
0
        private async void DownLoadBigPic(DetailMovie dm)
        {
            HttpStatusCode sc = HttpStatusCode.Forbidden;

            if (dm.bigimageurl != "")
            {
                (bool success, string cookie) = await Task.Run(() =>
                {
                    return(MyNet.DownLoadImage(dm.bigimageurl, ImageType.BigImage, dm.id, callback: (statuscode) => { sc = (HttpStatusCode)statuscode; }));
                });

                if (success)
                {
                    BigImageDownLoadCompleted?.Invoke(this, new MessageCallBackEventArgs(dm.id));
                }
                else
                {
                    MessageCallBack?.Invoke(this, new MessageCallBackEventArgs($"{Jvedio.Language.Resources.DownloadBPicFailFor} {sc.ToStatusMessage()} {Jvedio.Language.Resources.Message_ViewLog}"));
                }
            }
            InfoUpdate?.Invoke(this, new DetailMovieEventArgs()
            {
                DetailMovie = dm, value = Value, maximum = Maximum
            });
        }
示例#6
0
        public static string[] ToFileName(this DetailMovie movie)
        {
            string          txt      = Properties.Settings.Default.RenameFormat;
            FileInfo        fileInfo = new FileInfo(movie.filepath);
            string          oldName  = movie.filepath;
            string          name     = Path.GetFileNameWithoutExtension(movie.filepath);
            string          dir      = fileInfo.Directory.FullName;
            string          ext      = fileInfo.Extension;
            string          newName  = "";
            MatchCollection matches  = Regex.Matches(txt, "\\{[a-z]+\\}");

            if (matches != null && matches.Count > 0)
            {
                newName = txt;
                foreach (Match match in matches)
                {
                    string property = match.Value.Replace("{", "").Replace("}", "");
                    ReplaceWithValue(property, movie, ref newName);
                }
            }

            //替换掉特殊字符
            foreach (char item in BANFILECHAR)
            {
                newName = newName.Replace(item.ToString(), "");
            }

            if (Properties.Settings.Default.DelRenameTitleSpace)
            {
                newName = newName.Replace(" ", "");
            }
            if (movie.hassubsection)
            {
                string[] result = new string[movie.subsectionlist.Count];
                for (int i = 0; i < movie.subsectionlist.Count; i++)
                {
                    if (Properties.Settings.Default.AddLabelTagWhenRename && Identify.IsCHS(oldName))
                    {
                        result[i] = Path.Combine(dir, $"{newName}-{i + 1}_{Jvedio.Language.Resources.Translated}{ext}");
                    }
                    else
                    {
                        result[i] = Path.Combine(dir, $"{newName}-{i + 1}{ext}");
                    }
                }
                return(result);
            }
            else
            {
                if (Properties.Settings.Default.AddLabelTagWhenRename && Identify.IsCHS(oldName))
                {
                    return(new string[] { Path.Combine(dir, $"{newName}_{Jvedio.Language.Resources.Translated}{ext}") });
                }
                else
                {
                    return(new string[] { Path.Combine(dir, $"{newName}{ext}") });
                }
            }
        }
示例#7
0
        private DetailMovie GetDetailMovieFromSQLiteDataReader(SQLiteDataReader sr)
        {
            if (sr["id"] == null || string.IsNullOrEmpty(sr["id"].ToString()))
            {
                return(null);
            }
            DetailMovie detailMovie = new DetailMovie()
            {
                id              = sr["id"].ToString(),
                title           = sr["title"].ToString(),
                filepath        = sr["filepath"].ToString(),
                subsection      = sr["subsection"].ToString(),
                scandate        = sr["scandate"].ToString(),
                releasedate     = sr["releasedate"].ToString(),
                director        = sr["director"].ToString(),
                genre           = sr["genre"].ToString(),
                tag             = sr["tag"].ToString(),
                actor           = sr["actor"].ToString(),
                actorid         = sr["actorid"].ToString(),
                studio          = sr["studio"].ToString(),
                chinesetitle    = sr["chinesetitle"].ToString(),
                label           = sr["label"].ToString(),
                plot            = sr["plot"].ToString(),
                outline         = sr["outline"].ToString(),
                country         = sr["country"].ToString(),
                otherinfo       = sr["otherinfo"].ToString(),
                actressimageurl = sr["actressimageurl"].ToString(),
                smallimageurl   = sr["smallimageurl"].ToString(),
                bigimageurl     = sr["bigimageurl"].ToString(),
                extraimageurl   = sr["extraimageurl"].ToString(),
                sourceurl       = sr["sourceurl"].ToString(),
                source          = sr["source"].ToString()
            };

            double.TryParse(sr["filesize"].ToString(), out double filesize);
            int.TryParse(sr["vediotype"].ToString(), out int vediotype);
            int.TryParse(sr["visits"].ToString(), out int visits);
            int.TryParse(sr["favorites"].ToString(), out int favorites);
            int.TryParse(sr["year"].ToString(), out int year);
            int.TryParse(sr["countrycode"].ToString(), out int countrycode);
            int.TryParse(sr["runtime"].ToString(), out int runtime);
            float.TryParse(sr["rating"].ToString(), out float rating);
            detailMovie.filesize    = filesize;
            detailMovie.vediotype   = vediotype;
            detailMovie.visits      = visits;
            detailMovie.rating      = rating;
            detailMovie.favorites   = favorites;
            detailMovie.year        = year;
            detailMovie.countrycode = countrycode;
            detailMovie.runtime     = runtime;

            if (Properties.Settings.Default.ShowFileNameIfTitleEmpty &&
                string.IsNullOrEmpty(detailMovie.title) &&
                !string.IsNullOrEmpty(detailMovie.filepath))
            {
                detailMovie.title = Path.GetFileNameWithoutExtension(detailMovie.filepath);
            }
            return(detailMovie);
        }
示例#8
0
 private async void DownLoadSmallPic(DetailMovie dm)
 {
     if (dm.smallimageurl != "")
     {
         await Task.Run(() =>
         {
             return(Net.DownLoadImage(dm.smallimageurl, ImageType.SmallImage, dm.id));
         });
     }
 }
示例#9
0
 public DetailDownLoad(DetailMovie detailMovie)
 {
     Value       = 0;
     Maximum     = 1;
     DetailMovie = detailMovie;
     cts         = new CancellationTokenSource();
     cts.Token.Register(() => { Console.WriteLine("取消当前下载任务"); });
     lockobject    = new object();
     IsDownLoading = false;
 }
示例#10
0
        public async void DownLoad()
        {
            IsDownLoading = true;
            //下载信息
            if (DetailMovie.IsToDownLoadInfo())
            {
                HttpResult httpResult = await Net.DownLoadFromNet(DetailMovie);

                if (httpResult != null)
                {
                    if (!httpResult.Success)
                    {
                        string error = httpResult.Error != "" ? httpResult.Error : httpResult.StatusCode.ToStatusMessage();
                        MessageCallBack?.Invoke(this, new MessageCallBackEventArgs($" {DetailMovie.id} {Jvedio.Language.Resources.DownloadMessageFailFor}:{error}"));
                    }
                }
            }
            DetailMovie dm = new DetailMovie();

            dm = DataBase.SelectDetailMovieById(DetailMovie.id);
            if (string.IsNullOrEmpty(dm.title))
            {
                InfoUpdate?.Invoke(this, new DetailMovieEventArgs()
                {
                    DetailMovie = dm, value = 1, maximum = 1
                });
                return;
            }
            InfoUpdate?.Invoke(this, new DetailMovieEventArgs()
            {
                DetailMovie = dm, value = Value, maximum = Maximum
            });
            InfoDownloadCompleted?.Invoke(this, new MessageCallBackEventArgs(DetailMovie.id));

            if (!File.Exists(BasePicPath + $"BigPic\\{dm.id}.jpg"))
            {
                DownLoadBigPic(dm);                                                     //下载大图
            }
            if (!File.Exists(BasePicPath + $"SmallPic\\{dm.id}.jpg"))
            {
                DownLoadSmallPic(dm);                                                       //下载小图
            }
            List <string> urlList = new List <string>();

            foreach (var item in dm.extraimageurl?.Split(';'))
            {
                if (!string.IsNullOrEmpty(item))
                {
                    urlList.Add(item);
                }
            }
            Maximum = urlList.Count() == 0 ? 1 : urlList.Count;

            DownLoadExtraPic(dm);//下载预览图
        }
示例#11
0
        public static void SaveToNFO(DetailMovie vedio, string NfoPath)
        {
            var nfo = new NFO(NfoPath, "movie");

            // nfo.SetNodeText("source", Settings.BusWebSite)
            nfo.SetNodeText("title", vedio.title);
            nfo.SetNodeText("director", vedio.director);
            nfo.SetNodeText("rating", vedio.rating.ToString());
            nfo.SetNodeText("year", vedio.year.ToString());
            nfo.SetNodeText("countrycode", vedio.countrycode.ToString());
            nfo.SetNodeText("release", vedio.releasedate);
            nfo.SetNodeText("runtime", vedio.runtime.ToString());
            nfo.SetNodeText("country", vedio.country);
            nfo.SetNodeText("studio", vedio.studio);
            nfo.SetNodeText("id", vedio.id);
            nfo.SetNodeText("num", vedio.id);

            // 类别
            foreach (var item in vedio.genre.Split(' '))
            {
                if (!string.IsNullOrEmpty(item))
                {
                    nfo.AppendNewNode("genre", item);
                }
            }
            // 系列
            foreach (var item in vedio.tag.Split(' '))
            {
                if (!string.IsNullOrEmpty(item))
                {
                    nfo.AppendNewNode("tag", item);
                }
            }

            // 演员
            foreach (var item in vedio.actor.Split(actorSplitDict[vedio.vediotype]))
            {
                if (!string.IsNullOrEmpty(item))
                {
                    nfo.AppendNewNode("actor");
                    nfo.AppendNodeToNode("actor", "name", item);
                    nfo.AppendNodeToNode("actor", "type", "Actor");
                }
            }

            // Fanart
            nfo.AppendNewNode("fanart");
            foreach (var item in vedio.extraimageurl.Split(';'))
            {
                if (!string.IsNullOrEmpty(item))
                {
                    nfo.AppendNodeToNode("fanart", "thumb", item, "preview", item);
                }
            }
        }
示例#12
0
 private async Task <(bool, string)> DownLoadBigPic(DetailMovie dm)
 {
     if (!File.Exists(StaticVariable.BasePicPath + $"BigPic\\{dm.id}.jpg"))
     {
         return(await Net.DownLoadImage(dm.bigimageurl, ImageType.BigImage, dm.id));
     }
     else
     {
         return(false, "");
     }
 }
示例#13
0
        public static void SaveInfo(Dictionary <string, string> Info, string id)
        {
            //保存信息
            if (!Info.ContainsKey("id"))
            {
                Info.Add("id", id);
            }
            DataBase.UpdateInfoFromNet(Info);
            DetailMovie detailMovie = DataBase.SelectDetailMovieById(id);

            FileProcess.SaveNfo(detailMovie);
        }
示例#14
0
 private async Task <(bool, string)> DownLoadSmallPic(DetailMovie dm)
 {
     Console.WriteLine("开始下载小图");
     Console.WriteLine(dm.source);
     if (dm.source == "javdb")
     {
         return(false, "");
     }
     else
     {
         return(await Net.DownLoadImage(dm.smallimageurl, ImageType.SmallImage, dm.id));
     }
 }
示例#15
0
 private async void DownLoadBigPic(DetailMovie dm)
 {
     if (dm.bigimageurl != "")
     {
         await Task.Run(() =>
         {
             return(Net.DownLoadImage(dm.bigimageurl, ImageType.BigImage, dm.id));
         });
     }
     InfoUpdate?.Invoke(this, new DetailMovieEventArgs()
     {
         DetailMovie = dm, value = Value, maximum = Maximum
     });
 }
示例#16
0
        private (bool, string) Rename(string id)
        {
            DetailMovie detailMovie = DataBase.SelectDetailMovieById(id);

            if (!File.Exists(detailMovie.filepath))
            {
                return(false, $"文件不存在:{detailMovie.filepath}");
            }
            DetailMovie movie = DataBase.SelectDetailMovieById(id);

            //try
            //{
            string[] newPath = movie.ToFileName();
            if (movie.hassubsection)
            {
                for (int i = 0; i < newPath.Length; i++)
                {
                    if (File.Exists(newPath[i]))
                    {
                        return(false, $"新文件已存在:{newPath[i]},原文件为:{detailMovie.filepath}");
                    }
                }

                for (int i = 0; i < newPath.Length; i++)
                {
                    File.Move(movie.subsectionlist[i], newPath[i]);
                }
                movie.filepath   = newPath[0];
                movie.subsection = string.Join(";", newPath);
                DataBase.UpdateMovieByID(movie.id, "filepath", movie.filepath, "string");     //保存
                DataBase.UpdateMovieByID(movie.id, "subsection", movie.subsection, "string"); //保存
            }
            else
            {
                if (File.Exists(newPath[0]))
                {
                    return(false, $"新文件已存在:{newPath[0]},原文件为:{detailMovie.filepath}");
                }
                File.Move(movie.filepath, newPath[0]);
                movie.filepath = newPath[0];
                DataBase.UpdateMovieByID(movie.id, "filepath", movie.filepath, "string");    //保存
            }
            return(true, "");
            //}
            //catch (Exception ex)
            //{
            //    return (false, ex.Message);
            //}
        }
示例#17
0
        private async void DownLoadExtraPic(DetailMovie dm)
        {
            List <string> urlList = dm.extraimageurl?.Split(';').Where(arg => arg.IsProperUrl()).ToList();
            bool          dlimageSuccess = false; string cookies = "";

            for (int i = 0; i < urlList.Count(); i++)
            {
                HttpStatusCode sc = HttpStatusCode.Forbidden;
                if (cts.IsCancellationRequested)
                {
                    CancelEvent?.Invoke(this, EventArgs.Empty); break;
                }
                string filepath = "";
                filepath = BasePicPath + "ExtraPic\\" + dm.id + "\\" + Path.GetFileName(new Uri(urlList[i]).LocalPath);
                if (!File.Exists(filepath))
                {
                    (dlimageSuccess, cookies) = await Task.Run(() => { return(MyNet.DownLoadImage(urlList[i], ImageType.ExtraImage, dm.id, Cookie: cookies, callback: (statuscode) => { sc = (HttpStatusCode)statuscode; })); });

                    if (dlimageSuccess)
                    {
                        ExtraImageDownLoadCompleted?.Invoke(this, new MessageCallBackEventArgs(filepath));
                        if (urlList[i].IndexOf("dmm") > 0)
                        {
                            Thread.Sleep(Delay.MEDIUM);
                        }
                        else
                        {
                            Thread.Sleep(Delay.SHORT_3);
                        }
                    }
                    else
                    {
                        Logger.LogN($" {Jvedio.Language.Resources.Preview} {i + 1} {Jvedio.Language.Resources.Message_Fail}:{urlList[i]}, {Jvedio.Language.Resources.Reason} : {sc.ToStatusMessage()}");
                        MessageCallBack?.Invoke(this, new MessageCallBackEventArgs($" {Jvedio.Language.Resources.Preview} {i + 1} {Jvedio.Language.Resources.Message_Fail},{Jvedio.Language.Resources.Reason} :{sc.ToStatusMessage()} ,{Jvedio.Language.Resources.Message_ViewLog}"));
                    }
                }
                lock (lockobject) Value += 1;
                InfoUpdate?.Invoke(this, new DetailMovieEventArgs()
                {
                    DetailMovie = dm, value = Value, maximum = Maximum
                });
            }
            lock (lockobject) Value = Maximum;
            InfoUpdate?.Invoke(this, new DetailMovieEventArgs()
            {
                DetailMovie = dm, value = Value, maximum = Maximum
            });
            IsDownLoading = false;
        }
示例#18
0
        public async void DownLoad()
        {
            IsDownLoading = true;
            //下载信息
            if (DetailMovie.title == "" | DetailMovie.bigimageurl == "" | DetailMovie.extraimageurl == "" | DetailMovie.sourceurl == "")
            {
                string[] url       = new string[] { Properties.Settings.Default.Bus, Properties.Settings.Default.BusEurope, Properties.Settings.Default.DB, Properties.Settings.Default.Library };
                bool[]   enableurl = new bool[] { Properties.Settings.Default.EnableBus, Properties.Settings.Default.EnableBusEu, Properties.Settings.Default.EnableDB, Properties.Settings.Default.EnableLibrary, Properties.Settings.Default.EnableFC2 };
                string[] cookies   = new string[] { Properties.Settings.Default.DBCookie };

                bool success; string resultMessage;
                (success, resultMessage) = await Task.Run(() =>
                {
                    return(Net.DownLoadFromNet((Movie)DetailMovie));
                });
            }

            DetailMovie dm = new DetailMovie(); DataBase cdb = new DataBase("");

            dm = cdb.SelectDetailMovieById(DetailMovie.id);
            cdb.CloseDB();
            InfoUpdate?.Invoke(this, new DetailMovieEventArgs()
            {
                DetailMovie = dm, value = Value, maximum = Maximum
            });

            if (!File.Exists(StaticVariable.BasePicPath + $"BigPic\\{dm.id}.jpg"))
            {
                DownLoadBigPic(dm);                                                                    //下载大图
            }
            if (!File.Exists(StaticVariable.BasePicPath + $"SmallPic\\{dm.id}.jpg"))
            {
                DownLoadSmallPic(dm);                                                                      //下载小图
            }
            List <string> urlList = new List <string>();

            foreach (var item in dm.extraimageurl?.Split(';'))
            {
                if (!string.IsNullOrEmpty(item))
                {
                    urlList.Add(item);
                }
            }
            Maximum = urlList.Count() == 0 ? 1 : urlList.Count();

            //下载预览图
            DownLoadExtraPic(dm);
        }
示例#19
0
 public static void addTag(ref DetailMovie movie)
 {
     //添加标签戳
     if (Identify.IsHDV(movie.filepath) || movie.genre?.IndexOfAnyString(TagStrings_HD) >= 0 || movie.tag?.IndexOfAnyString(TagStrings_HD) >= 0 || movie.label?.IndexOfAnyString(TagStrings_HD) >= 0)
     {
         movie.tagstamps += Jvedio.Language.Resources.HD;
     }
     if (Identify.IsCHS(movie.filepath) || movie.genre?.IndexOfAnyString(TagStrings_Translated) >= 0 || movie.tag?.IndexOfAnyString(TagStrings_Translated) >= 0 || movie.label?.IndexOfAnyString(TagStrings_Translated) >= 0)
     {
         movie.tagstamps += Jvedio.Language.Resources.Translated;
     }
     if (Identify.IsFlowOut(movie.filepath) || movie.genre?.IndexOfAnyString(TagStrings_FlowOut) >= 0 || movie.tag?.IndexOfAnyString(TagStrings_FlowOut) >= 0 || movie.label?.IndexOfAnyString(TagStrings_FlowOut) >= 0)
     {
         movie.tagstamps += Jvedio.Language.Resources.FlowOut;
     }
 }
示例#20
0
        public static void SavePartialInfo(Dictionary <string, string> Info, string key, string id)
        {
            //保存信息
            if (!Info.ContainsKey("id"))
            {
                Info.Add("id", id);
            }
            if (!Info.ContainsKey(key))
            {
                return;
            }
            DataBase.UpdateMovieByID(id, key, Info[key], "String");
            DetailMovie detailMovie = DataBase.SelectDetailMovieById(id);

            SaveNfo(detailMovie);
        }
示例#21
0
        public static void SaveInfo(Dictionary <string, string> Info, string id, int vt = 1)
        {
            //保存信息
            if (!Info.ContainsKey("id"))
            {
                Info.Add("id", id);
            }
            if (!Info.ContainsKey("vediotype"))
            {
                Info.Add("vediotype", vt.ToString());
            }
            DataBase.UpdateInfoFromNet(Info);
            DetailMovie detailMovie = DataBase.SelectDetailMovieById(id);

            SaveNfo(detailMovie);
        }
示例#22
0
文件: Net.cs 项目: smmadman/Jvedio
 public async static Task <(bool, string)> DownLoadSmallPic(DetailMovie dm, bool overWrite = false)
 {
     if (overWrite)
     {
         return(await Net.DownLoadImage(dm.smallimageurl, ImageType.SmallImage, dm.id));
     }
     //不存在才下载
     if (!File.Exists(GlobalVariable.BasePicPath + $"SmallPic\\{dm.id}.jpg"))
     {
         return(await Net.DownLoadImage(dm.smallimageurl, ImageType.SmallImage, dm.id));
     }
     else
     {
         return(false, "");
     }
 }
示例#23
0
 public static void addTag(ref DetailMovie movie)
 {
     //添加标签戳
     if (Identify.IsHDV(movie.filepath) || movie.genre?.IndexOf("高清") >= 0 || movie.tag?.IndexOf("高清") >= 0 || movie.label?.IndexOf("高清") >= 0)
     {
         movie.tagstamps += "高清";
     }
     if (Identify.IsCHS(movie.filepath) || movie.genre?.IndexOf("中文") >= 0 || movie.tag?.IndexOf("中文") >= 0 || movie.label?.IndexOf("中文") >= 0)
     {
         movie.tagstamps += "中文";
     }
     if (Identify.IsFlowOut(movie.filepath) || movie.genre?.IndexOf("流出") >= 0 || movie.tag?.IndexOf("流出") >= 0 || movie.label?.IndexOf("流出") >= 0)
     {
         movie.tagstamps += "流出";
     }
 }
示例#24
0
        private async void DownLoadExtraPic(DetailMovie dm)
        {
            List <string> urlList = new List <string>();

            foreach (var item in dm.extraimageurl?.Split(';'))
            {
                if (!string.IsNullOrEmpty(item))
                {
                    urlList.Add(item);
                }
            }
            bool dlimageSuccess = false; string cookies = "";

            for (int i = 0; i < urlList.Count(); i++)
            {
                if (cts.IsCancellationRequested)
                {
                    CancelEvent?.Invoke(this, EventArgs.Empty); break;
                }
                string filepath = "";
                if (urlList[i].Length > 0)
                {
                    filepath = StaticVariable.BasePicPath + "ExtraPic\\" + dm.id + "\\" + Path.GetFileName(new Uri(urlList[i]).LocalPath);
                    if (!File.Exists(filepath))
                    {
                        (dlimageSuccess, cookies) = await Task.Run(() => { return(Net.DownLoadImage(urlList[i], ImageType.ExtraImage, dm.id, Cookie: cookies)); });

                        if (dlimageSuccess)
                        {
                            Thread.Sleep(1500);
                        }
                    }
                }
                lock (lockobject) Value += 1;
                InfoUpdate?.Invoke(this, new DetailMovieEventArgs()
                {
                    DetailMovie = dm, value = Value, maximum = Maximum
                });
            }
            lock (lockobject) Value = Maximum;
            InfoUpdate?.Invoke(this, new DetailMovieEventArgs()
            {
                DetailMovie = dm, value = Value, maximum = Maximum
            });
            IsDownLoading = false;
        }
示例#25
0
        public async static Task <(bool, string)> DownLoadBigPic(DetailMovie dm, bool overWrite = false)
        {
            if (overWrite)
            {
                return(await DownLoadImage(dm.bigimageurl, ImageType.BigImage, dm.id));
            }


            if (!File.Exists(GlobalVariable.BasePicPath + $"BigPic\\{dm.id}.jpg"))
            {
                return(await DownLoadImage(dm.bigimageurl, ImageType.BigImage, dm.id));
            }
            else
            {
                return(false, "");
            }
        }
示例#26
0
        private async void DownLoadSmallPic(DetailMovie dm)
        {
            HttpStatusCode sc = HttpStatusCode.Forbidden;

            if (dm.smallimageurl != "")
            {
                (bool success, string cookie) = await Task.Run(() => { return(MyNet.DownLoadImage(dm.smallimageurl, ImageType.SmallImage, dm.id, callback: (statuscode) => { sc = (HttpStatusCode)statuscode; })); });

                if (success)
                {
                    SmallImageDownLoadCompleted?.Invoke(this, new MessageCallBackEventArgs(dm.id));
                }
                else
                {
                    MessageCallBack?.Invoke(this, new MessageCallBackEventArgs($"{Jvedio.Language.Resources.DownloadSPicFailFor} {sc.ToStatusMessage()} {Jvedio.Language.Resources.Message_ViewLog}"));
                }
            }
        }
示例#27
0
        public string GetNfoPath(DetailMovie dm)
        {
            string result = AppDomain.CurrentDomain.BaseDirectory + "DownLoad\\NFO";

            if (!Directory.Exists(result))
            {
                Directory.CreateDirectory(result);
            }
            if (Properties.Settings.Default.NFOSaveComBoxIndex == 0)
            {
                if (File.Exists(dm.filepath))
                {
                    FileInfo fileInfo = new FileInfo(dm.filepath);
                    result = fileInfo.DirectoryName;
                }
            }
            return(System.IO.Path.Combine(result, dm.id + ".nfo"));
        }
示例#28
0
 private async Task <(bool, string)> DownLoadSmallPic(DetailMovie dm)
 {
     //不存在才下载
     if (!File.Exists(StaticVariable.BasePicPath + $"SmallPic\\{dm.id}.jpg"))
     {
         Console.WriteLine("开始下载小图");
         Console.WriteLine(dm.source);
         if (dm.source == "javdb")
         {
             return(false, "");
         }
         else
         {
             return(await Net.DownLoadImage(dm.smallimageurl, ImageType.SmallImage, dm.id));
         }
     }
     else
     {
         return(false, "");
     }
 }
示例#29
0
        public DetailMovie GetDetailMovieFromSQLiteDataReader(SQLiteDataReader sr)
        {
            DetailMovie detailMovie = new DetailMovie()
            {
                id              = sr["id"].ToString(),
                title           = sr["title"].ToString(),
                filesize        = double.Parse(sr["filesize"].ToString()),
                filepath        = sr["filepath"].ToString(),
                subsection      = sr["subsection"].ToString(),
                vediotype       = int.Parse(sr["vediotype"].ToString()),
                scandate        = sr["scandate"].ToString(),
                releasedate     = sr["releasedate"].ToString(),
                visits          = int.Parse(sr["visits"].ToString()),
                director        = sr["director"].ToString(),
                genre           = sr["genre"].ToString(),
                tag             = sr["tag"].ToString(),
                actor           = sr["actor"].ToString(),
                actorid         = sr["actorid"].ToString(),
                studio          = sr["studio"].ToString(),
                rating          = float.Parse(sr["rating"].ToString()),
                chinesetitle    = sr["chinesetitle"].ToString(),
                favorites       = int.Parse(sr["favorites"].ToString()),
                label           = sr["label"].ToString(),
                plot            = sr["plot"].ToString(),
                outline         = sr["outline"].ToString(),
                year            = int.Parse(sr["year"].ToString()),
                runtime         = int.Parse(sr["runtime"].ToString()),
                country         = sr["country"].ToString(),
                countrycode     = int.Parse(sr["countrycode"].ToString()),
                otherinfo       = sr["otherinfo"].ToString(),
                actressimageurl = sr["actressimageurl"].ToString(),
                smallimageurl   = sr["smallimageurl"].ToString(),
                bigimageurl     = sr["bigimageurl"].ToString(),
                extraimageurl   = sr["extraimageurl"].ToString(),
                sourceurl       = sr["sourceurl"].ToString(),
                source          = sr["source"].ToString()
            };

            return(detailMovie);
        }
示例#30
0
        private void SetToBigPic(object sender, RoutedEventArgs e)
        {
            MenuItem m1 = sender as MenuItem;
            MenuItem m2 = m1.Parent as MenuItem;

            ContextMenu contextMenu = m2.Parent as ContextMenu;

            Image      image      = contextMenu.PlacementTarget as Image;
            StackPanel stackPanel = image.Parent as StackPanel;
            TextBlock  textBox    = stackPanel.Children.OfType <TextBlock>().First();
            int        idx        = int.Parse(textBox.Text);

            string path = vieModel.DetailMovie.extraimagePath[idx];

            if (!File.Exists(path))
            {
                return;
            }

            try {
                File.Copy(path, BasePicPath + $"BigPic\\{vieModel.DetailMovie.id.ToUpper()}.jpg", true);
                //更新到 UI

                //BigImage.Source = new BitmapImage(new Uri(path));
                DetailMovie detailMovie = vieModel.DetailMovie;
                detailMovie.bigimage = null;

                vieModel.DetailMovie = null;

                detailMovie.bigimage = StaticClass.BitmapImageFromFile(path);
                vieModel.DetailMovie = detailMovie;

                RefreshUI("", path);
            }
            catch (Exception ex)
            {
                new Msgbox(this, ex.Message).ShowDialog();
            }
        }