Example #1
0
        private void dataGridView4_CellEnter(object sender, DataGridViewCellEventArgs e)
        {
            currentrow = MovieList.Rows[e.RowIndex];
            //clear everything before repopulating.
            //We do this heere instead of on cellleave because the cell is 'left' when it's deselected
            //this way this happens only when we want to load something else.

            if (Poster.Image != null) {Poster.Image.Dispose();}
            if (BackdropPic.Image != null) { BackdropPic.Image.Dispose(); }
            Genres.Rows.Clear();
            Directors.Rows.Clear();
            Studios.Rows.Clear();
            Actors.Rows.Clear();

            string di = MovieList[4, e.RowIndex].Value.ToString();
            FileInfo fi = new FileInfo(di + "\\mymovies.xml");
            mmdata = new mymovies();

            if (fi.Exists)
            {
                mmdata.load(di + "\\mymovies.xml");
            }
            else
            {
                mmdata = new mymovies(di + "\\mymovies.xml");
                mmdata.Added = DateTime.Now.ToString("yyy-MM-dd h:mm:ss tt");
                mmdata.LocalTitle = MovieList[0, e.RowIndex].Value.ToString();
                mmdata.OriginalTitle = MovieList[0, e.RowIndex].Value.ToString();
                mmdata.SortTitle = MovieList[5, e.RowIndex].Value.ToString();

            }
            LocalTitle.Text = mmdata.LocalTitle;
            OriginalTitle.Text = mmdata.OriginalTitle;
            SortTitle.Text = mmdata.SortTitle;
            ProductionYear.Text = mmdata.ProductionYear;
            Runtime.Text = mmdata.RunningTime;
            MPAARating.Text = mmdata.MPAARating;
            IMDBRating.Text = mmdata.IMDBrating;
            AspectRatio.Text = mmdata.AspectRatio;
            MovieType.Text = mmdata.Type;
            DateAdded.Value = DateTime.Parse(mmdata.Added);
            IMDB.Text = mmdata.IMDB;
            toolTip1.SetToolTip(imdbgo, "http://www.imdb.com/title/" + mmdata.IMDB + "/");
            TMDBID.Text = mmdata.TMDbId;
            toolTip1.SetToolTip(tmdbgo, "http://www.themoviedb.org/movie/" + mmdata.TMDbId);
            Description.Text = mmdata.Description;
            foreach (string g in mmdata.Genres.Genre)
            {
                Genres.Rows.Add(g);

            }
            foreach (string s in mmdata.Studios.Studio)
            {

                int row = Studios.Rows.Add(s);
            }
            foreach (mymovies.Person p in mmdata.Persons)
            {
                if (p.Type.ToLower() == "director") { Directors.Rows.Add(p.Name); }
                if (p.Type.ToLower() == "actor")
                {
                    System.Drawing.Image img;

                    string imgbyname = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\ImagesByName\\" + p.Name + "\\folder.jpg";
                    fi = new FileInfo(imgbyname);
                    if (fi.Exists)
                    {
                        img = new Bitmap(imgbyname);

                    }
                    else
                    {
                        img = new Bitmap(1, 1);
                    }

                    Actors.Rows.Add(img, p.Name, "..as ", p.Role, " ");
                }
            }

            fi = new FileInfo(di + "\\folder.jpg");
            if (fi.Exists)
            {
                Poster.Image = Image.FromFile(di + "\\folder.jpg");
            }
            else
            {
                Poster.Image = imageList1.Images[1];
            }
            fi = new FileInfo(di + "\\backdrop.jpg");
            if (fi.Exists)
            {
                BackdropPic.Image = Image.FromFile(di + "\\backdrop.jpg");
            }
            else
            {
                fi = new FileInfo(di + "\\backdrop.png");
                if (fi.Exists)
                {
                    BackdropPic.Image = Image.FromFile(di + "\\backdrop.png");
                }
                else
                {
                    BackdropPic.Image = imageList1.Images[1];
                }
            }

               /* */
        }
Example #2
0
        /// <summary>
        /// This looks for any movie file within subdirectories of a directory, indlucing nested subdirectories, and adds it to the MovieList.
        /// </summary>
        /// <param name="path">The path containing movie folders</param>
        private void findMoviesInDirectory(string path)
        {
            /*TODO:
             * add some directory tripping code for subdirectories
             * and make it not add a folder that only exists to hold subdirectories
             *
             */

            string[] directories = Directory.GetDirectories(path);

            // MovieList.DataSource = MovieData.Tables[0];
            foreach (string dir in directories)
            {
                FileInfo fi = new FileInfo(dir + "\\mymovies.dna");
                //listView1.Items.Add(di);
                string movieTitle  = "";
                string sortTitle   = "";
                string genreList   = "";
                string movieYear   = "";
                int    xmlComplete = 0;

                if (fi.Exists)
                {
                }
                else
                {
                    string filenames = String.Join(" ", Directory.GetFiles(dir));
                    if (filenames.Contains(".avi") || filenames.Contains(".mkv") || filenames.Contains(".m4v"))

                    {
                        fi = new FileInfo(dir + "\\folder.jpg");
                        bool posterexists = fi.Exists;
                        fi = new FileInfo(dir + "\\backdrop.jpg");
                        bool backdropexists = fi.Exists;
                        //ok We're going to just flatten the entire thing, no subfolders.
                        //no code for subfolders yet...
                        fi = new FileInfo(dir + "\\mymovies.xml");
                        if (fi.Exists)
                        {
                            mmdata = new mymovies();
                            mmdata.load(dir + "\\mymovies.xml");

                            movieTitle = mmdata.LocalTitle;
                            sortTitle  = mmdata.SortTitle;
                            movieYear  = mmdata.ProductionYear;

                            xmlComplete = mmdata.XMLComplete ? 1 : 0;
                            genreList   = String.Join(";", mmdata.Genres.Genre.ToArray());
                        }
                        else
                        {
                            movieTitle = dir.Substring(dir.LastIndexOf("\\") + 1);
                            Console.WriteLine(movieTitle);
                            movieYear  = Regex.Match(movieTitle, "\\(.*\\)").Groups[0].Value;
                            movieTitle = Regex.Replace(movieTitle, "\\(.*\\)", "").Trim();
                            movieTitle = Regex.Replace(movieTitle, "[.*]", "");
                            sortTitle  = movieTitle;
                            MovieList.Rows[MovieList.Rows.Count - 1].Cells[0].Style.ForeColor = Color.Red;

                            xmlComplete = -1;
                        }

                        MovieData.Tables[0].Rows.Add(movieTitle, posterexists, backdropexists, dir, sortTitle, movieYear, "", "", genreList, xmlComplete);
                        //MovieList.Rows.Add(movieTitle, posterexists, backdropexists, di, sortTitle, "", "", "", genreList);


                        //this tooltip needs to be more extensive
                        //MovieList.Rows[MovieList.Rows.Count - 1].Cells[0].ToolTipText = dir;
                        //if (xmlComplete) { MovieList.Rows[MovieList.Rows.Count - 1].Cells[0].Style.ForeColor = Color.Green; }
                    }
                }

                //mymovies mmdata = new mymovies(di + "\\mymovies.xml");
            }
            //   MovieData.Tables[0].DefaultView.Sort = "sort ASC";
            // MovieList.EndEdit();
        }
Example #3
0
        /// <summary>
        /// This looks for any movie file within subdirectories of a directory, indlucing nested subdirectories, and adds it to the MovieList.
        /// </summary>
        /// <param name="path">The path containing movie folders</param>
        private void findMoviesInDirectory(string path)
        {
            /*TODO:
             * add some directory tripping code for subdirectories
             * and make it not add a folder that only exists to hold subdirectories
             *
             */

            string[] directories = Directory.GetDirectories(path);

            // MovieList.DataSource = MovieData.Tables[0];
            foreach (string dir in directories)
            {
                FileInfo fi = new FileInfo(dir + "\\mymovies.dna");
                //listView1.Items.Add(di);
                string movieTitle = "";
                string sortTitle = "";
                string genreList = "";
                string movieYear = "";
                int xmlComplete = 0;

                if (fi.Exists)
                {
                }
                else
                {
                    string filenames = String.Join(" ", Directory.GetFiles(dir));
                    if (filenames.Contains(".avi") || filenames.Contains(".mkv") || filenames.Contains(".m4v"))

                    {
                        fi = new FileInfo(dir + "\\folder.jpg");
                        bool posterexists = fi.Exists;
                        fi = new FileInfo(dir + "\\backdrop.jpg");
                        bool backdropexists = fi.Exists;
                        //ok We're going to just flatten the entire thing, no subfolders.
                        //no code for subfolders yet...
                        fi = new FileInfo(dir + "\\mymovies.xml");
                        if (fi.Exists)
                        {
                            mmdata = new mymovies();
                            mmdata.load(dir + "\\mymovies.xml");

                            movieTitle = mmdata.LocalTitle;
                            sortTitle = mmdata.SortTitle;
                            movieYear = mmdata.ProductionYear;

                            xmlComplete = mmdata.XMLComplete ? 1 : 0;
                            genreList = String.Join(";", mmdata.Genres.Genre.ToArray());

                        }
                        else
                        {
                            movieTitle = dir.Substring(dir.LastIndexOf("\\") + 1);
                            Console.WriteLine(movieTitle);
                            movieYear = Regex.Match(movieTitle, "\\(.*\\)").Groups[0].Value;
                            movieTitle = Regex.Replace(movieTitle, "\\(.*\\)", "").Trim();
                            movieTitle = Regex.Replace(movieTitle, "[.*]", "");
                            sortTitle = movieTitle;
                            MovieList.Rows[MovieList.Rows.Count - 1].Cells[0].Style.ForeColor = Color.Red;

                            xmlComplete = -1;
                        }

                        MovieData.Tables[0].Rows.Add(movieTitle, posterexists, backdropexists, dir, sortTitle, movieYear, "", "", genreList, xmlComplete);
                        //MovieList.Rows.Add(movieTitle, posterexists, backdropexists, di, sortTitle, "", "", "", genreList);

                        //this tooltip needs to be more extensive
                        //MovieList.Rows[MovieList.Rows.Count - 1].Cells[0].ToolTipText = dir;
                        //if (xmlComplete) { MovieList.Rows[MovieList.Rows.Count - 1].Cells[0].Style.ForeColor = Color.Green; }

                    }

                }

                //mymovies mmdata = new mymovies(di + "\\mymovies.xml");

            }
             //   MovieData.Tables[0].DefaultView.Sort = "sort ASC";
               // MovieList.EndEdit();
        }
Example #4
0
        private void dataGridView4_CellEnter(object sender, DataGridViewCellEventArgs e)
        {
            currentrow = MovieList.Rows[e.RowIndex];
            //clear everything before repopulating.
            //We do this heere instead of on cellleave because the cell is 'left' when it's deselected
            //this way this happens only when we want to load something else.

            if (Poster.Image != null)
            {
                Poster.Image.Dispose();
            }
            if (BackdropPic.Image != null)
            {
                BackdropPic.Image.Dispose();
            }
            Genres.Rows.Clear();
            Directors.Rows.Clear();
            Studios.Rows.Clear();
            Actors.Rows.Clear();

            string   di = MovieList[4, e.RowIndex].Value.ToString();
            FileInfo fi = new FileInfo(di + "\\mymovies.xml");

            mmdata = new mymovies();

            if (fi.Exists)
            {
                mmdata.load(di + "\\mymovies.xml");
            }
            else
            {
                mmdata               = new mymovies(di + "\\mymovies.xml");
                mmdata.Added         = DateTime.Now.ToString("yyy-MM-dd h:mm:ss tt");
                mmdata.LocalTitle    = MovieList[0, e.RowIndex].Value.ToString();
                mmdata.OriginalTitle = MovieList[0, e.RowIndex].Value.ToString();
                mmdata.SortTitle     = MovieList[5, e.RowIndex].Value.ToString();
            }
            LocalTitle.Text     = mmdata.LocalTitle;
            OriginalTitle.Text  = mmdata.OriginalTitle;
            SortTitle.Text      = mmdata.SortTitle;
            ProductionYear.Text = mmdata.ProductionYear;
            Runtime.Text        = mmdata.RunningTime;
            MPAARating.Text     = mmdata.MPAARating;
            IMDBRating.Text     = mmdata.IMDBrating;
            AspectRatio.Text    = mmdata.AspectRatio;
            MovieType.Text      = mmdata.Type;
            DateAdded.Value     = DateTime.Parse(mmdata.Added);
            IMDB.Text           = mmdata.IMDB;
            toolTip1.SetToolTip(imdbgo, "http://www.imdb.com/title/" + mmdata.IMDB + "/");
            TMDBID.Text = mmdata.TMDbId;
            toolTip1.SetToolTip(tmdbgo, "http://www.themoviedb.org/movie/" + mmdata.TMDbId);
            Description.Text = mmdata.Description;
            foreach (string g in mmdata.Genres.Genre)
            {
                Genres.Rows.Add(g);
            }
            foreach (string s in mmdata.Studios.Studio)
            {
                int row = Studios.Rows.Add(s);
            }
            foreach (mymovies.Person p in mmdata.Persons)
            {
                if (p.Type.ToLower() == "director")
                {
                    Directors.Rows.Add(p.Name);
                }
                if (p.Type.ToLower() == "actor")
                {
                    System.Drawing.Image img;

                    string imgbyname = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\ImagesByName\\" + p.Name + "\\folder.jpg";
                    fi = new FileInfo(imgbyname);
                    if (fi.Exists)
                    {
                        img = new Bitmap(imgbyname);
                    }
                    else
                    {
                        img = new Bitmap(1, 1);
                    }

                    Actors.Rows.Add(img, p.Name, "..as ", p.Role, " ");
                }
            }

            fi = new FileInfo(di + "\\folder.jpg");
            if (fi.Exists)
            {
                Poster.Image = Image.FromFile(di + "\\folder.jpg");
            }
            else
            {
                Poster.Image = imageList1.Images[1];
            }
            fi = new FileInfo(di + "\\backdrop.jpg");
            if (fi.Exists)
            {
                BackdropPic.Image = Image.FromFile(di + "\\backdrop.jpg");
            }
            else
            {
                fi = new FileInfo(di + "\\backdrop.png");
                if (fi.Exists)
                {
                    BackdropPic.Image = Image.FromFile(di + "\\backdrop.png");
                }
                else
                {
                    BackdropPic.Image = imageList1.Images[1];
                }
            }



            /* */
        }