// Searches TMDB, both movies and tv. Returns a concatenanted list of media items public List<Media> Search(string query) { string FullPathMovie = library + "search/movie" + "?" + apiKey + "&query=" + query + default_filters; string FullPathTV = library + "search/tv" + "?" + apiKey + "&query=" + query + default_filters; dynamic RawResultsMovie = parseJson(FullPathMovie); dynamic RawResultsTV = parseJson(FullPathTV); List<Media> SearchResults = new List<Media>(); foreach (var m in RawResultsMovie["results"]) { try { if (m["popularity"] > 1) { Movie movie = new Movie(m); SearchResults.Add((Media)movie); } } catch (KeyNotFoundException e) {} catch (Microsoft.CSharp.RuntimeBinder.RuntimeBinderException e) {} } foreach (var m in RawResultsTV["results"]) { try { if (m["popularity"] > 1) { Show show = new Show(m); SearchResults.Add((Media)show); } } catch (KeyNotFoundException e) { } catch (Microsoft.CSharp.RuntimeBinder.RuntimeBinderException e) {} } List<Media> SortedSearchResults = SearchResults.OrderByDescending(o=>o.release_date).ToList(); return SortedSearchResults; }
public Show GetShow(string MediaID) { // Get Raw Show Data string FullPath = library + "tv/" + MediaID + "?" + apiKey + default_filters; dynamic RawResults = parseJson(FullPath); // Construct show Show show = new Show(RawResults); return show; }
public Show GetShow(string MediaID, int Season) { // Get Raw Show Data string FullPath = library + "tv/" + MediaID + "?" + apiKey + default_filters; dynamic RawResults = parseJson(FullPath); // Get Raw Season Data for poster string SeasonFullPath = library + "tv/" + MediaID + "/season/" + Season + "?" + apiKey + default_filters; dynamic SeasonRawResults = parseJson(SeasonFullPath); // Construct show Show show = new Show(RawResults, SeasonRawResults); return show; }