Example #1
0
        public static Movie FetchMovie(String file, String imdbId, bool allowUnpopular)
        {
            var imdb = new IMDBClient();
            var m    = imdb.GetDetails(imdbId);

            if (!allowUnpopular && m.num_votes < 30)
            {
                throw new NoMatchFoundException();
            }

            String cover = null;

            if (m.image != null && !m.image.url.IsNullOrEmpty())
            {
                cover = Util.CleanFileName(m.image.url);
                var coverPath = Path.Combine(DM.CoverDir, cover);
                if (!File.Exists(coverPath))
                {
                    if (!Directory.Exists(DM.CoverDir))
                    {
                        Directory.CreateDirectory(DM.CoverDir);
                    }
                    new WebClient().DownloadFile(m.image.url, coverPath);
                }
            }

            return(new Movie(file, m, cover));
        }
Example #2
0
        public void TestFind()
        {
            var api     = new IMDBClient("fr_FR");
            var results = api.Find("matrix 2003 ");

            Assert.Greater(results.Count, 0);
            var first = results.First();

            Assert.That(first.title.ToLower().Contains("matrix"));
            Assert.AreEqual(2003, first.GetYear());

            var detail = api.GetDetails(first.tconst);

            Assert.AreEqual(first.year, detail.year);
            Assert.AreEqual(first.title, detail.title);
            Assert.AreEqual(first.tconst, detail.tconst);
        }