Exemplo n.º 1
0
        //显示演员
        public void ShowSameActor(object sender, MouseButtonEventArgs e)
        {
            Border     border    = sender as Border;
            StackPanel sp        = border.Child as StackPanel;
            TextBlock  textBlock = sp.Children.OfType <TextBlock>().First();
            string     name      = textBlock.Text.Split('(')[0];

            if (string.IsNullOrEmpty(name))
            {
                return;
            }
            foreach (Window window in App.Current.Windows)
            {
                if (window.GetType().Name == "Main")
                {
                    windowMain = (Main)window; break;
                }
            }
            if (windowMain != null)
            {
                Actress actress = null;
                foreach (Actress item in vieModel.DetailMovie.actorlist)
                {
                    if (name == item.name)
                    {
                        actress = item; break;
                    }
                }
                if (actress != null)
                {
                    windowMain.ShowActorMovieFromDetailWindow(actress);
                    this.Close();
                }
            }
        }
Exemplo n.º 2
0
        public static async Task <bool> DownActress(string ID, string Name)
        {
            bool   result = false;
            string Url = RootUrl.Bus + $"star/{ID}";
            string Content; int StatusCode; string ResultMessage;

            (Content, StatusCode) = await Http(Url);

            if (StatusCode == 200 && Content != "")
            {
                //id搜索
                BusParse busParse = new BusParse(ID, Content, VedioType.骑兵);
                Actress  actress  = busParse.ParseActress();
                if (actress.birthday == "" && actress.age == 0 && actress.birthplace == "")
                {
                    Console.WriteLine($"该网址无演员信息:{Url}"); ResultMessage = "该网址无演员信息=>Bus"; Logger.LogN($"URL={Url},Message-{ResultMessage}");
                }
                else
                {
                    actress.sourceurl = Url;
                    actress.source    = "javbus";
                    actress.id        = ID;
                    actress.name      = Name;
                    //保存信息
                    DataBase.InsertActress(actress);

                    result = true;
                }
            }
            else
            {
                Console.WriteLine($"无法访问 404:{Url}"); ResultMessage = "无法访问=>Bus"; Logger.LogN($"URL={Url},Message-{ResultMessage}");
            }
            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 插入从网上下载的演员信息
        /// </summary>
        /// <param name="info"></param>

        //public void InsertActressFromNet(Dictionary<string, string> info)
        //{
        //    if (info == null) { return; }
        //    if (info["name"] == null | info["id"] == null) { return; }
        //    string sqltext = $"insert into actress(id,name ,  birthday , age ,height, cup, chest  , waist , hipline ,birthplace  , hobby,sourceurl ,source,imageurl) values(@id,@name ,  @birthday , @age ,@height, @cup, @chest  , @waist , @hipline ,@birthplace  , @hobby,@sourceurl ,@source,@imageurl) on conflict(id) do update set name=@name ,  birthday=@birthday , age=@age  ,height=@height, cup=@cup, chest=@chest  , waist=@waist , hipline=@hipline ,birthplace=@birthplace  , hobby=@hobby,sourceurl=@sourceurl ,source=@source,imageurl=@imageurl";
        //    cmd.CommandText = sqltext;
        //    cmd.Parameters.Add("id", DbType.String).Value = info["id"];
        //    cmd.Parameters.Add("name", DbType.String).Value = info["name"];
        //    cmd.Parameters.Add("birthday", DbType.String).Value = info.ContainsKey("birthday") ? info["birthday"] : "";
        //    cmd.Parameters.Add("age", DbType.Int32).Value = int.Parse(info.ContainsKey("age") ? info["age"] : "0");
        //    cmd.Parameters.Add("height", DbType.Int32).Value = int.Parse(info.ContainsKey("height") ? info["height"] : "0");
        //    cmd.Parameters.Add("cup", DbType.String).Value = info.ContainsKey("cup") ? info["cup"] : "";
        //    cmd.Parameters.Add("chest", DbType.Int32).Value = int.Parse(info.ContainsKey("chest") ? info["chest"] : "0");
        //    cmd.Parameters.Add("waist", DbType.Int32).Value = int.Parse(info.ContainsKey("waist") ? info["waist"] : "0");
        //    cmd.Parameters.Add("hipline", DbType.Int32).Value = int.Parse(info.ContainsKey("hipline") ? info["hipline"] : "0");
        //    cmd.Parameters.Add("birthplace", DbType.String).Value = info.ContainsKey("birthplace") ? info["birthplace"] : "";
        //    cmd.Parameters.Add("hobby", DbType.String).Value = info.ContainsKey("hobby") ? info["hobby"] : "";
        //    cmd.Parameters.Add("sourceurl", DbType.String).Value = info.ContainsKey("sourceurl") ? info["sourceurl"] : "";
        //    cmd.Parameters.Add("source", DbType.String).Value = info.ContainsKey("source") ? info["source"] : "";
        //    cmd.Parameters.Add("imageurl", DbType.String).Value = info.ContainsKey("imageurl") ? info["imageurl"] : "";
        //    cmd.ExecuteNonQuery();
        //}


        public void InsertActress(Actress actress)
        {
            if (actress == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(actress.name))
            {
                return;
            }
            string sqltext = $"insert into actress(id,name ,  birthday , age ,height, cup, chest  , waist , hipline ,birthplace  , hobby,sourceurl ,source,imageurl) values(@id,@name ,  @birthday , @age ,@height, @cup, @chest  , @waist , @hipline ,@birthplace  , @hobby,@sourceurl ,@source,@imageurl) on conflict(id) do update set name=@name ,  birthday=@birthday , age=@age  ,height=@height, cup=@cup, chest=@chest  , waist=@waist , hipline=@hipline ,birthplace=@birthplace  , hobby=@hobby,sourceurl=@sourceurl ,source=@source,imageurl=@imageurl";

            cmd.CommandText = sqltext;
            cmd.Parameters.Add("id", DbType.String).Value         = actress.id;
            cmd.Parameters.Add("name", DbType.String).Value       = actress.name;
            cmd.Parameters.Add("birthday", DbType.String).Value   = actress.birthday;
            cmd.Parameters.Add("age", DbType.Int32).Value         = actress.age;
            cmd.Parameters.Add("height", DbType.Int32).Value      = actress.height;
            cmd.Parameters.Add("cup", DbType.String).Value        = actress.cup;
            cmd.Parameters.Add("chest", DbType.Int32).Value       = actress.chest;
            cmd.Parameters.Add("waist", DbType.Int32).Value       = actress.waist;
            cmd.Parameters.Add("hipline", DbType.Int32).Value     = actress.hipline;
            cmd.Parameters.Add("birthplace", DbType.String).Value = actress.birthplace;
            cmd.Parameters.Add("hobby", DbType.String).Value      = actress.hobby;
            cmd.Parameters.Add("sourceurl", DbType.String).Value  = actress.sourceurl;
            cmd.Parameters.Add("source", DbType.String).Value     = actress.source;
            cmd.Parameters.Add("imageurl", DbType.String).Value   = actress.imageurl;
            cmd.ExecuteNonQuery();
        }
Exemplo n.º 4
0
        private async void DownLoad(object o)
        {
            Semaphore.WaitOne();
            Actress actress = o as Actress;

            if (Cancel | actress.id == "")
            {
                Semaphore.Release();
                return;
            }
            try
            {
                this.State = DownLoadState.DownLoading;

                //下载头像
                if (!string.IsNullOrEmpty(actress.imageurl))
                {
                    string url        = actress.imageurl;
                    byte[] imageBytes = null;
                    imageBytes = await Task.Run(() => { return(Net.DownLoadFile(url).filebytes); });

                    if (imageBytes != null)
                    {
                        ImageProcess.SaveImage(actress.name, imageBytes, ImageType.ActorImage, url);
                        actress.smallimage = ImageProcess.GetBitmapImage(actress.name, "Actresses");
                    }
                }
                //下载信息
                bool success = false;
                success = await Task.Run(() =>
                {
                    Task.Delay(300).Wait();
                    return(Net.DownActress(actress.id, actress.name, callback: (message) => { MessageCallBack?.Invoke(this, new MessageCallBackEventArgs(message)); }));
                });

                if (success)
                {
                    actress = DataBase.SelectInfoFromActress(actress);
                }
                ProgressBarUpdate.value += 1;
                InfoUpdate?.Invoke(this, new ActressUpdateEventArgs()
                {
                    Actress = actress, progressBarUpdate = ProgressBarUpdate, state = State
                });
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                Semaphore.Release();
            }
        }
Exemplo n.º 5
0
        public void BeginDownLoad()
        {
            if (ActorList.Count == 0)
            {
                this.State = DownLoadState.Completed; return;
            }


            //先根据 BusActress.sqlite 获得 id
            List <Actress> actresslist = new List <Actress>();

            foreach (Actress item in ActorList)
            {
                if (item != null && (item.smallimage == null || string.IsNullOrEmpty(item.birthday)))
                {
                    Actress  actress = item;
                    MySqlite db      = new MySqlite("BusActress");
                    if (item.id == "")
                    {
                        actress.id = db.GetInfoBySql($"select id from censored where name='{item.name}'");
                        if (item.imageurl == null)
                        {
                            actress.imageurl = db.GetInfoBySql($"select smallpicurl from censored where id='{actress.id}'");
                        }
                    }
                    else
                    {
                        if (item.imageurl == null)
                        {
                            actress.imageurl = db.GetInfoBySql($"select smallpicurl from censored where id='{actress.id}'");
                        }
                    }
                    db.CloseDB();
                    actresslist.Add(actress);
                }
            }

            ProgressBarUpdate.maximum = actresslist.Count;
            //TODO
            for (int i = 0; i < actresslist.Count; i++)
            {
                Console.WriteLine("开始进程 " + i);
                Thread threadObject = new Thread(DownLoad);
                threadObject.Start(actresslist[i]);
            }
        }
Exemplo n.º 6
0
        public static async Task <bool> DownLoadActress(string ID, string Name, Action <string> callback)
        {
            bool       result     = false;
            string     Url        = JvedioServers.Bus.Url + $"star/{ID}";
            HttpResult httpResult = null;

            httpResult = await Http(Url);

            string error = "";

            if (httpResult != null && httpResult.StatusCode == HttpStatusCode.OK && httpResult.SourceCode != "")
            {
                //id搜索
                BusParse busParse = new BusParse(ID, httpResult.SourceCode, VedioType.骑兵);
                Actress  actress  = busParse.ParseActress();
                if (actress == null && string.IsNullOrEmpty(actress.birthday) && actress.age == 0 && string.IsNullOrEmpty(actress.birthplace))
                {
                    error = $"{Jvedio.Language.Resources.NoActorInfo}:{Url}";
                }
                else
                {
                    actress.sourceurl = Url;
                    actress.source    = "javbus";
                    actress.id        = ID;
                    actress.name      = Name;
                    //保存信息
                    DataBase.InsertActress(actress);
                    result = true;
                }
            }
            else if (httpResult != null)
            {
                error = httpResult.StatusCode.ToStatusMessage();
            }
            else
            {
                error = Jvedio.Language.Resources.HttpFail;
            }
            Console.WriteLine(error);
            callback.Invoke(error);
            Logger.LogN($"URL={Url},Message-{error}");
            return(result);
        }
Exemplo n.º 7
0
        public void BeginDownLoad()
        {
            if (ActorList.Count == 0)
            {
                this.State = DownLoadState.Completed; return;
            }


            //先根据 BusActress.sqlite 获得 id
            List <Actress> actresslist = new List <Actress>();

            foreach (Actress item in ActorList)
            {
                if (item != null && (item.smallimage == null || string.IsNullOrEmpty(item.birthday)))
                {
                    Actress  actress = item;
                    MySqlite db      = new MySqlite("BusActress");
                    if (string.IsNullOrEmpty(item.id))
                    {
                        actress.id = db.GetInfoBySql($"select id from censored where name='{item.name}'");
                    }
                    db.CloseDB();
                    if (string.IsNullOrEmpty(item.imageurl))
                    {
                        //TODO 没法解决演员头像骑兵和步兵的问题
                        //默认骑兵吧,反正拍过步兵的肯定也拍过骑兵
                        //拼接网址
                        actress.imageurl = $"{JvedioServers.Bus.Url}pics/actress/{item.id}_a.jpg";
                    }

                    actresslist.Add(actress);
                }
            }

            ProgressBarUpdate.maximum = actresslist.Count;
            for (int i = 0; i < actresslist.Count; i++)
            {
                Console.WriteLine("开始进程 " + i);
                Thread threadObject = new Thread(DownLoad);
                threadObject.Start(actresslist[i]);
            }
        }
Exemplo n.º 8
0
        public static async Task <bool> DownActress(string ID, string Name, Action <string> callback)
        {
            bool   result = false;
            string Url = RootUrl.Bus + $"star/{ID}";
            string Content; int StatusCode; string ResultMessage;

            (Content, StatusCode) = await Http(Url);

            if (StatusCode == 200 && Content != "")
            {
                //id搜索
                BusParse busParse = new BusParse(ID, Content, VedioType.骑兵);
                Actress  actress  = busParse.ParseActress();
                if (actress == null && string.IsNullOrEmpty(actress.birthday) && actress.age == 0 && string.IsNullOrEmpty(actress.birthplace))
                {
                    ResultMessage = $"{Jvedio.Language.Resources.NoActorInfo}:{Url}";
                    callback.Invoke(ResultMessage);
                    Logger.LogN($"URL={Url},Message-{ResultMessage}");
                }
                else
                {
                    actress.sourceurl = Url;
                    actress.source    = "javbus";
                    actress.id        = ID;
                    actress.name      = Name;
                    //保存信息
                    DataBase.InsertActress(actress);

                    result = true;
                }
            }
            else
            {
                Console.WriteLine($"{"404".ToStatusMessage()}:{Url}");
                ResultMessage = "Bus" + "404".ToStatusMessage();
                callback.Invoke(ResultMessage);
                Logger.LogN($"URL={Url},Message-{ResultMessage}");
            }
            return(result);
        }
Exemplo n.º 9
0
        public Actress ParseActress()
        {
            Actress result = new Actress();

            if (HtmlText == "")
            {
                return(result);
            }
            string       info;
            HtmlDocument doc = new HtmlDocument();

            doc.LoadHtml(HtmlText);

            //基本信息
            HtmlNodeCollection infoNodes = doc.DocumentNode.SelectNodes("//div[@class='photo-info']/p");

            if (infoNodes != null)
            {
                foreach (HtmlNode infoNode in infoNodes)
                {
                    try
                    {
                        info = infoNode.InnerText;
                        if (info.IndexOf("生日") >= 0)
                        {
                            result.birthday = info.Replace("生日: ", "");
                        }
                        else if (info.IndexOf("年齡") >= 0)
                        {
                            int age = 0;
                            int.TryParse(info.Replace("年齡: ", ""), out age);
                            result.age = age;
                        }
                        else if (info.IndexOf("身高") >= 0)
                        {
                            result.height = Regex.Match(info, @"[0-9]+").Value;
                        }
                        else if (info.IndexOf("罩杯") >= 0)
                        {
                            result.cup = info.Replace("罩杯: ", "");
                        }
                        else if (info.IndexOf("胸圍") >= 0)
                        {
                            result.chest = int.Parse(Regex.Match(info, @"[0-9]+").Value);
                        }
                        else if (info.IndexOf("腰圍") >= 0)
                        {
                            result.waist = int.Parse(Regex.Match(info, @"[0-9]+").Value);
                        }
                        else if (info.IndexOf("臀圍") >= 0)
                        {
                            result.hipline = int.Parse(Regex.Match(info, @"[0-9]+").Value);
                        }
                        else if (info.IndexOf("愛好") >= 0)
                        {
                            result.hobby = info.Replace("愛好: ", "");
                        }
                    }
                    catch { continue; }
                }
            }
            return(result);
        }