Beispiel #1
0
        private void InitMovie(string extraData)
        {
            db = new MovieDB();

            // get title from Page1.xaml
            db.title     = extraData;
            db.url       = JsonLib.findMovieUrl(db.title, movieInfos);
            db.posterUrl = JsonLib.findPosterUrl(db.title, movieInfos);

            // init name of label(=mvName)
            mvName.Content = db.title;

            // load movie
            Uri url = new Uri(db.url);

            webBrowser.Navigate(url.AbsoluteUri);
        }
Beispiel #2
0
        static public void GetRecommendMovies(mshtml.HTMLDocument doc, MovieDB db)
        {
            mshtml.IHTMLElementCollection item = doc.getElementsByTagName("ul");

            foreach (mshtml.IHTMLElement elem in item)
            {
                if (elem.getAttribute("className") == "thumb_link_mv")
                {
                    string text = elem.innerText;
                    text = text.Replace("\r\n", ",");
                    text = text.Replace(",,, ,", string.Empty);
                    text = text.Substring(4);

                    string[] movies = text.Split(',');
                    db.recommendMovies.AddRange(movies);

                    break;
                }
            }
        }
Beispiel #3
0
        static public void GetRatings(mshtml.HTMLDocument doc, MovieDB db)
        {
            mshtml.IHTMLElementCollection item = doc.getElementsByTagName("div");

            int lineIndex = 0;

            foreach (mshtml.IHTMLElement elem in item)
            {
                var score = elem.getAttribute("className");
                if (score == "star_score" || score == "star_score ")
                {
                    string text = elem.innerText;
                    text = text.Replace("\r\n", "");

                    if (lineIndex == 0)
                    {
                        text         = text.Replace("관람객 평점 ", "");
                        text         = text.Replace("점", ",");
                        db.audRating = text.Split(',')[0];
                    }
                    else if (lineIndex == 1)
                    {
                        db.expRating = text;
                    }
                    else if (lineIndex == 2)
                    {
                        db.netRating = text;
                    }

                    lineIndex++;
                    if (lineIndex >= 3)
                    {
                        break;
                    }
                }
            }
        }
Beispiel #4
0
        static public bool UpdateMovieDB(mshtml.HTMLDocument doc, MovieDB db)
        {
            if (db == null || doc == null)
            {
                return(false);
            }

            mshtml.IHTMLElementCollection item = doc.getElementsByTagName("dd");

            int lineIndex = 0;

            foreach (mshtml.IHTMLElement elem in item)
            {
                string text = elem.innerText;

                if (lineIndex == 0)
                {
                    // 감독
                    text = text.Replace(", ", ",");

                    string[] director = text.Split(',');
                    db.director.AddRange(director);
                }
                else if (lineIndex == 1)
                {
                    // 배우
                    text = text.Replace(", ", ",");

                    string[] actor = text.Split(',');
                    db.actor.AddRange(actor);
                }
                else if (lineIndex == 2)
                {
                    // 장르, 국가, 상영시간, 개봉일
                    text = text.Replace(", ", ",");
                    text = text.Replace("  ", "+");
                    text = text.Replace(" ", string.Empty);

                    string[] tmp = text.Split('+');

                    string[] genre = tmp[0].Split(',');
                    db.genre.AddRange(genre);

                    string[] nation = tmp[1].Split(',');
                    db.nation.AddRange(nation);

                    db.runningTime = tmp[2];
                    db.releaseDate = tmp[3];
                }
                else if (lineIndex == 5)
                {
                    // 관람 등급
                    text           = text.Replace("\r\n", "");
                    text           = text.Replace("도움말", "");
                    db.movieRating = text;
                    break;
                }

                lineIndex++;
            }

            // 유사한 영화들
            GetRecommendMovies(doc, db);

            // 관람객, 전문가, 네티즌 평점
            GetRatings(doc, db);

            return(db.Is());
        }