예제 #1
0
 //Updated August 6th
 public static void InsertImdbEntry(ImdbElement imdbElement)
 {
     try
     {
         MongoUtils.GetMongoCollection
         (
             @"mongodb://" + ConfigurationManager.AppSettings["mongoHost"] + @"/",
             ConfigurationManager.AppSettings["port"],
             ConfigurationManager.AppSettings["db"],
             ConfigurationManager.AppSettings["movie_collection"]
         ).Insert(new Movie()
         {
             ImdbCode  = imdbElement.Id,
             ImdbTitle = imdbElement.Title,
             Year      = Regex.Replace(imdbElement.TitleDescription, "[^0-9.+-]", "").ToInt(),
             Urls      = new List <string>()
             {
                 "http://www.imdb.com/" + imdbElement.Id
             },
             Downloaded = false
         });
     }
     catch (Exception e)
     { Log.AppendToLog("Error : FATAL write from IMDB to Mongo. " + e, ConfigurationManager.AppSettings["log_file"]); }
 }
예제 #2
0
파일: MovieUtils.cs 프로젝트: jmn319/mmb
 //Updated August 6th
 public static void InsertImdbEntry(ImdbElement imdbElement)
 {
     try
     {
         MongoUtils.GetMongoCollection
             (
                 @"mongodb://" + ConfigurationManager.AppSettings["mongoHost"] + @"/",
                 ConfigurationManager.AppSettings["port"],
                 ConfigurationManager.AppSettings["db"],
                 ConfigurationManager.AppSettings["movie_collection"]
             ).Insert(new Movie()
             {
                 ImdbCode = imdbElement.Id,
                 ImdbTitle = imdbElement.Title,
                 Year = Regex.Replace(imdbElement.TitleDescription, "[^0-9.+-]", "").ToInt(),
                 Urls = new List<string>() {"http://www.imdb.com/" + imdbElement.Id},
                 Downloaded = false
             });
     }
     catch (Exception e)
     { Log.AppendToLog("Error : FATAL write from IMDB to Mongo. " + e, ConfigurationManager.AppSettings["log_file"]); }
 }