public void TestMergeTwoOmdbEntryLists() { //create a imdb OE OmdbEntry imdb_omdbentry = new OmdbEntry { i_ID = "asd", i_Rating = "asd", i_Votes = "123" }; List <OmdbEntry> imdb_list = new List <OmdbEntry> { imdb_omdbentry }; //create a RT OE OmdbEntry rt_omdbentry = new OmdbEntry { t_Consensus = "rotten", t_Fresh = 123, t_Image = "asddd", t_Meter = 123, t_Reviews = 12355, t_Rotten = 333, t_UserMeter = 233, t_UserReviews = 3 }; List <OmdbEntry> rt_list = new List <OmdbEntry> { rt_omdbentry }; //expected OE result OmdbEntry expected_omdbentry = new OmdbEntry { i_ID = "asd", i_Rating = "asd", i_Votes = "123", t_Consensus = "rotten", t_Fresh = 123, t_Image = "asddd", t_Meter = 123, t_Reviews = 12355, t_Rotten = 333, t_UserMeter = 233, t_UserReviews = 3 }; List <OmdbEntry> res = TSVParse.MergeTwoOmdbEntryLists(imdb_list, rt_list); OmdbEntry resulting_omdbentry = res[0]; Assert.AreEqual(expected_omdbentry, resulting_omdbentry); Assert.AreNotEqual(new OmdbEntry(), resulting_omdbentry); }
public static void FullDbBuild() { MovieDbContext db = new MovieDbContext(); string netflixPosFilepath = System.Web.HttpContext.Current.Server.MapPath("~/dbfiles/fixedAPI.NFPOX"); //retrieve API .POX var netflixCatalogOutputPath = OAuth1a.GetNextflixCatalogDataString("catalog/titles/streaming", "", outputPath: netflixPosFilepath); var genresNFPOX = System.Web.HttpContext.Current.Server.MapPath("~/dbfiles/genres.NFPOX"); var omdbZIP = System.Web.HttpContext.Current.Server.MapPath("~/dbfiles/omdb.zip"); var omdbDUMP = System.Web.HttpContext.Current.Server.MapPath("~/dbfiles/omdb.DUMP"); var omdbTXT = System.Web.HttpContext.Current.Server.MapPath("~/dbfiles/omdb.txt"); var tomatoesTXT = System.Web.HttpContext.Current.Server.MapPath("~/dbfiles/tomatoes.txt"); //join the lines that don't match <catalog to the ones above it Tools.JoinLines(netflixPosFilepath); //Parse the netflix NFPOX and make sure the genres.nfpox exists and is up to date Tools.UpdateGenreList(netflixPosFilepath); //build a genres txt file for all the genres in the NFPOX //ASSUMES GENRES.NFPOX IS THERE PopulateGenres.PopulateGenresTable(); //parse the lines into a Title then Movie object, along with boxart data and genre Tools.BuildMoviesBoxartGenresTables(netflixPosFilepath); //download the omdbapi Omdb.DownloadOmdbZipAndExtract(omdbZIP); ////parse it for omdbentrys, serialize it to file //Tools.SerializeOmdbTsv(omdbDUMP, omdbTXT, tomatoesTXT); ////deserialize the file, turn it into omdb //// can't remember if it does it here or not, but marry the omdbs and movie //Tools.RebuildOmdbsFromProtobufDump(omdbDUMP); //new way to turn the TSV into Omdb db TSVParse.OptimizedPopulateOmdbTableFromTsv(omdbTXT, tomatoesTXT); Tools.MarryMovieToOmdb(db); }
public void TestUpdateImdbEntryWithRtEntry() { var imdb_param = new OmdbEntry(); var rt_param = new OmdbEntry { t_Consensus = "asd", t_Fresh = 123, t_Image = "asd", t_Meter = 123, t_Rating = 1.2f, t_Reviews = 123, t_Rotten = 123, t_UserMeter = 1234, t_UserRating = 12.4f, t_UserReviews = 12345 }; TSVParse.UpdateImdbEntryWithRtEntry(imdb_param, rt_param); OmdbEntry expected = new OmdbEntry { t_Consensus = "asd", t_Fresh = 123, t_Image = "asd", t_Meter = 123, t_Rating = 1.2f, t_Reviews = 123, t_Rotten = 123, t_UserMeter = 1234, t_UserRating = 12.4f, t_UserReviews = 12345 }; Assert.AreEqual(imdb_param, expected); Assert.AreNotEqual(imdb_param, new OmdbEntry()); }