Example #1
0
 private void UpdateMovieInformations(ListViewMovie movie)
 {
     try
     {
         PosterImage.Image = WorkerClass.WebImage(movie.PosterLink);
         TopPicture.Size = new Size((int)(float.Parse(movie.Mark)/10*252),20);
         BottomPicture.Visible = TopPicture.Visible = true;
         NameBox.Text = movie.Pozition.ToString() + ". " + movie.MovieName + " (" + movie.Get_Year() + ")";
         DescriptionBox.Text = movie.Storyline;
         MarkBox.Text = movie.Mark + "/10";
     }
     catch
     {
     }
 }
        private void Update_Movie_Details(ListViewMovie Movie)
        {
            link = Movie.Get_IMDB_Adress();
            Movie_Name = Movie.Movie_Name;

            toolTip1.SetToolTip(button1,"Add \"" + Movie.Movie_Name + "\" to your movie list.");

            Thread thread = new Thread(new ThreadStart(Update_PictureBox));
            thread.Start();

            Title.Text = Movie.Movie_Name;

            Description.Text = Movie.Storyline;

            TopPicture.Size = new Size((int)(25.2 * double.Parse(Movie.Mark)), 20);
            MarkBox.Text = "Mark : " + Movie.Mark;

            axShockwaveFlash1.Movie = "http://www.youtube.com/v/"+ WorkerClass.Movie_Trailer_Link(Movie.Movie_Name)[0].Key;
        }
Example #3
0
        private void Take_IMDB_List(string link)
        {
            if (link.IndexOf("http://") < 0)
                link = "http://" + link;

            string sourceCode = WorkerClass.GetSourceCode(link);
            string imageCode = null;

            int startIndex = sourceCode.IndexOf("data-size=\"")+11;
            int endIndex = sourceCode.IndexOf("\"", startIndex);
            int startImgIndex,startVerIndex,startVerIndex2;
            int Poz = 0;

            int datasize = int.Parse(sourceCode.Substring(startIndex, endIndex - startIndex));
            int NrOfPages = datasize/100 + ((datasize%100 > 0) ? 1 : 0);

            for (int i = 0; i < NrOfPages; i++)
            {
                sourceCode = WorkerClass.GetSourceCode(link + "?start=" + (i * 100 + 1).ToString());

                startIndex = sourceCode.IndexOf("list_item");

                for (; startIndex > 0; )
                {
                    ListViewMovie movie = new ListViewMovie();

                    movie.Pozition = ++Poz;

                    //Load Image Link
                    startIndex = sourceCode.IndexOf("<img", startIndex);
                    endIndex = sourceCode.IndexOf(">", startIndex);

                    imageCode = sourceCode.Substring(startIndex, endIndex - startIndex);

                    startImgIndex = imageCode.IndexOf("http://ia.media-imdb.com");
                    if (startImgIndex < 0) startImgIndex = imageCode.IndexOf("src=\"")+5;
                    endIndex = imageCode.IndexOf("\"", startImgIndex);

                    movie.PosterLink = imageCode.Substring(startImgIndex, endIndex - startImgIndex);

                    //Load Movie Link to IMDB
                    startIndex = sourceCode.IndexOf("href=\"/title/", startIndex) + 6;
                    endIndex = sourceCode.IndexOf("\"", startIndex);

                    movie.Set_IMDB_Adress("http://www.imdb.com" + sourceCode.Substring(startIndex, endIndex - startIndex));

                    //Load Name of the movie
                    startIndex = sourceCode.IndexOf(">", startIndex) + 1;
                    endIndex = sourceCode.IndexOf("<", startIndex);

                    movie.MovieName = WorkerClass.StringWithoutHtmlFormat(sourceCode.Substring(startIndex, endIndex - startIndex));

                    //Load Year of the movie
                    startIndex = sourceCode.IndexOf("class=\"year_type\">", startIndex);
                    startIndex = sourceCode.IndexOf("(", startIndex) + 1;
                    endIndex = sourceCode.IndexOf(")", startIndex);

                    movie.Set_Year(sourceCode.Substring(startIndex, endIndex - startIndex));

                    //Load Mark from IMDB
                    startIndex = sourceCode.IndexOf("class=\"value\">", startIndex) + 14;
                    endIndex = sourceCode.IndexOf("<", startIndex);

                    movie.Mark = sourceCode.Substring(startIndex, endIndex - startIndex);

                    //Load IMDB Description
                    startVerIndex = sourceCode.IndexOf("item_description", startIndex);
                    startVerIndex2 = sourceCode.IndexOf("secondary", startIndex);
                    if (startVerIndex < startVerIndex2)
                    {
                        startIndex = sourceCode.IndexOf("item_description\">", startIndex) + 18;
                        endIndex = sourceCode.IndexOf("<", startIndex);

                        movie.Storyline = WorkerClass.StringWithoutHtmlFormat(sourceCode.Substring(startIndex, endIndex - startIndex));
                    }
                    else
                        movie.Storyline = "";

                    startIndex = sourceCode.IndexOf("list_item", startIndex);

                    Movies.Add(movie);
                }
            }
        }
        private void Take_Reccommandations_Movies()
        {
            try
            {
                string sourceCode = WorkerClass.GetSourceCode("http://www.imdb.com/movies-in-theaters/");

                int startIndex = sourceCode.IndexOf("Box");
                int endIndex = 0;

                for (int i = 1; i <= 10; i++)
                {
                    ListViewMovie movie = new ListViewMovie(true);

                    startIndex = sourceCode.IndexOf("class=\"poster shadowed", startIndex);

                    //Take Movie Name
                    startIndex = sourceCode.IndexOf("title=\"", startIndex) + "title=\"".Length;
                    endIndex = sourceCode.IndexOf("\"", startIndex);
                    movie.Movie_Name = sourceCode.Substring(startIndex, endIndex - startIndex);

                    //Take Poster Link
                    startIndex = sourceCode.IndexOf("src", startIndex) + 5;
                    endIndex = sourceCode.IndexOf("\"", startIndex);
                    movie.PosterLink = sourceCode.Substring(startIndex, endIndex - startIndex);

                    //Take Link
                    startIndex = sourceCode.IndexOf("href", startIndex) + 6;
                    endIndex = sourceCode.IndexOf("\"", startIndex);
                    movie.Set_IMDB_Adress("http://www.imdb.com" + sourceCode.Substring(startIndex, endIndex - startIndex));

                    //Take the movie Mark
                    startIndex = sourceCode.IndexOf("class=\"value\">", startIndex) + 14;
                    endIndex = sourceCode.IndexOf("<", startIndex);
                    movie.Mark = sourceCode.Substring(startIndex, endIndex - startIndex);

                    //Take Description
                    startIndex = sourceCode.IndexOf("itemprop=\"description\">", startIndex) + 23;
                    endIndex = sourceCode.IndexOf("<", startIndex);
                    movie.Storyline = sourceCode.Substring(startIndex, endIndex - startIndex);

                    //Take Movie Informations (Dynamically)
                    //movie.Update_Movie();

                    Movies.Add(movie);
                }
            }
            catch
            {
                MessageBox.Show("An error occured while trying to take Reccommandations!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }
        }