public async void Tmdb_SearchName_AListWithContent() { var tmdb = new TmdbOnlineDataCollector(); var result = await tmdb.SearchName("Marvel"); Assert.IsNotEmpty(result); }
public async void Tmdb_GetShowInfo_ASearchResult() { var tmdb = new TmdbOnlineDataCollector(); var first = await tmdb.SearchName("Marvel"); var result = await tmdb.GetShowInfo(first.First().TmdbId); Assert.IsNotNull(result.NumberOfSeasons); }
private void UpdateShowTitlesAndImages() { var removeList = new List<Show>(); var lockObj = new object(); var doneNumber = 0; var totalProcentPrShow = (100 / TvSeries.Count); ProgressProcent = 0; EnableProgress = false; var tasks = TvSeries.Select(show => Task.Factory.StartNew(() => { if (show.Title.Length >= 2) { var collector = new TmdbOnlineDataCollector(); var list = collector.SearchName(show.Title).Result; if (list != null && list.Any()) { var obj = list.First(); if (!TvSeries.Exists(listShow => CheckName(listShow.Title, obj.Title) && listShow != show)) { show.Title = obj.Title; show.TmdbId = obj.TmdbId; show.ImageUri = new Uri(obj.Url); AsyncLogger.Log(Tag, String.Format("Updated {0}, Image: {1}, TMDB Id: {2}", obj.Title, obj.Url, obj.TmdbId)); } else { AsyncLogger.Log(Tag, String.Format("Removed {0} : Duplicate on the list", show.Title)); removeList.Add(show); } } else { AsyncLogger.Log(Tag, String.Format("Removed {0} : Not found by the online API", show.Title)); removeList.Add(show); } } else { AsyncLogger.Log(Tag, String.Format("Removed {0} : Title is 1 char long", show.Title)); removeList.Add(show); } lock (lockObj) { doneNumber++; ProgressText = "Loading " + show.Title + " for online data"; ProgressProcent = doneNumber*totalProcentPrShow; } })).ToList(); Task.WaitAll(tasks.ToArray()); foreach (var show in removeList) { TvSeries.Remove(show); } }