public Dvd getDvdDetails(string volumeTitle) { var api = new TheMovieDB.TmdbAPI(_movieApiKey); var movies = api.MovieSearch(volumeTitle); if (movies.Length > 0) { var movie = movies[0]; var info = api.GetMovieInfo(movie.Id); var tags = from c in info.Categories where c.Type == "genre" select c.Name; var returnDvd = new Dvd { Id = movie.Id, Title = movie.Name, Year = string.Format("{0:yyyy}", info.Released), Tags = tags.ToArray<string>(), Type = DvdType.Movie }; return returnDvd; } else { var tvdb = new TvdbHandler(null, _tvApiKey); var tvdbSearchResult = tvdb.SearchSeries(volumeTitle); var seriesIds = tvdbSearchResult.ToDictionary(result => result.Id, result => result.SeriesName); foreach (var seriesId in seriesIds) { var series = tvdb.GetSeries(seriesId.Key, TvdbLanguage.DefaultLanguage, true, false, false); foreach (var episode in series.GetEpisodesAbsoluteOrder()) { //Console.WriteLine("Series: {0}\n\rName: {1}\n\rId: {2}\n\rNumber: {3}\n\rGenre: {4}\n\r\n\r", // seriesId.Value, // episode.EpisodeName, // episode.Id, // episode.EpisodeNumber, // series.GenreString); //Console.WriteLine(episode.ToString()); } } return new Dvd() { Type = DvdType.Tv, Year = tvdbSearchResult[0].FirstAired.ToString() }; } }
private TvdbSeries LookupShow(string name) { Reporting.Log("Looking up show: " + name); TvdbHandler handler = new TvdbHandler(TvdbApiKey); List<TvdbSearchResult> results = handler.SearchSeries(name); TvdbSearchResult first = results.First(); return handler.GetBasicSeries(first.Id, TvdbLanguage.DefaultLanguage, true); }
private bool DownloadImage(string serverPath, string title, int season, int episode) { string apiKey = ConfigurationManager.AppSettings["tvdb.API.key"]; if (string.IsNullOrWhiteSpace(apiKey)) return false; var handler = new TvdbHandler(apiKey); var downloader = new TvdbDownloader(apiKey); var searchResult = handler.SearchSeries(title); if (searchResult != null && searchResult.Count > 0) { var result = searchResult.First(); int sId = result.Id; var banner = GetLoadedBanner(downloader, sId, season, episode, result.Banner); if (banner == null) return false; banner.BannerImage.Save(serverPath); return true; } return false; }
public IEnumerable<Serie> GetSeries(string searchText) { TvdbHandler tvdbHandler = new TvdbHandler(null, _apiKey); var result = tvdbHandler.SearchSeries(searchText); return result.Select(x => new Serie { SerieId = x.Id, Name = x.SeriesName}); }