//Ok burron handler
 private void SearchOkButton_Click(object sender, EventArgs e)
 {
     if(SearchTab.SelectedTab.Name == tabPage1.Name)
        {
         int MovieID = SearchMovies[MovieResultBox.GetItemText(MovieResultBox.SelectedItem)];
         TMDbLib.Objects.Movies.Movie movieData = api.GetMovie(MovieID);
         Movie movie = new Movie();
         movie.id = movieData.Id;
         movie.filePath = NameAndFolder.Value;
         movie.genre = new List<string>();
         foreach(Genre genre in movieData.Genres)
             movie.genre.Add(genre.Name);
         movie.summary = movieData.Overview;
         movie.title = movieData.Title;
         DateTime s = Convert.ToDateTime(movieData.ReleaseDate);
         movie.year = s.Year.ToString();
         WebClient wc = new WebClient();
         wc.DownloadFile("https://image.tmdb.org/t/p/w185" + movieData.PosterPath, NameAndFolder.Value + "\\movie.jpg");
         NFO.WriteMovieNFO(movie);
        }
        else if(SearchTab.SelectedTab.Name == tabPage2.Name)
        {
         int TvShowID = SearchTvShows[TVShowResultBox.GetItemText(TVShowResultBox.SelectedItem)];
        }
 }
Beispiel #2
0
        public static Movie ReadMovieNFO(string folder)
        {
            Movie m = new Movie();

            // read the movie file
            XmlDocument xmldoc = new XmlDocument();
            XmlNode xmlnodeMovie;

            FileStream fs = new FileStream(folder, FileMode.Open, FileAccess.Read);
            xmldoc.Load(fs);
            xmlnodeMovie = xmldoc.ChildNodes[0];

            XmlNode xmlnodeTitle = xmlnodeMovie.SelectSingleNode("title");
            m.title = xmlnodeTitle.InnerText;

            XmlNode xmlnodeYear = xmlnodeMovie.SelectSingleNode("year");
            m.year = xmlnodeYear.InnerText;

            XmlNode xmlnodeId = xmlnodeMovie.SelectSingleNode("id");
            m.id = int.Parse(xmlnodeId.InnerText);

            XmlNode xmlnodePath = xmlnodeMovie.SelectSingleNode("filenameandpath");
            m.filePath = xmlnodePath.InnerText;

            XmlNode xmlnodeSummary = xmlnodeMovie.SelectSingleNode("outline");
            m.summary = xmlnodeSummary.InnerText;

            // return the new movie object
            return m;
        }
Beispiel #3
0
        public static void WriteMovieNFO(Movie m)
        {
            // where does the file need to go?
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("<movie>");
            sb.AppendLine("<title>" + m.title + "</title>");
            sb.AppendLine("<year>" + m.year + "</year>");
            sb.AppendLine("<outline>" + m.summary + "</outline>");
            sb.AppendLine("<filenameandpath>" + m.filePath + "</filenameandpath>");
            foreach (string genre in m.genre)
                sb.AppendLine("<genre>" + genre + "</genre>");
            sb.AppendLine("<id>" + m.id + "</id>");
            sb.AppendLine("</movie>");

            // write the file
            System.IO.File.WriteAllText(m.filePath + "\\movie.nfo", sb.ToString());
        }
Beispiel #4
0
 public static void WriteMovieNFO(Movie m)
 {
     // where does the file need to go?
     StringBuilder sb = new StringBuilder();
     sb.AppendLine("<movie>");
     sb.AppendLine("<title>" + m.title + "</title>");
     sb.AppendLine("<year>" + m.year + "</year>");
     sb.AppendLine("<outline>" + m.summary + "</outline>");
     sb.AppendLine("<filenameandpath>" + m.filePath + "</filenameandpath>");
     foreach (string genre in m.genre)
         sb.AppendLine("<genre>" + genre + "</genre>");
     sb.AppendLine("<id>" + m.id + "</id>");
     sb.AppendLine("</movie>");
     string NFOFile = getNFOfileName(m.filePath);
     if(NFOFile != "")
     {
         //write the file
         File.WriteAllText(NFOFile, sb.ToString());
     }
 }