/// <summary> /// Rates a list of shows on trakt /// </summary> /// <param name="data">The object containing the list of shows to be rated</param> /// <returns>The response from trakt</returns> public static TraktRatingsResponse RateShows(TraktRateShows data) { // check that we have everything we need if (data == null || data.Shows.Count == 0) return null; // serialize data to JSON and send to server string response = TraktWeb.Transmit(TraktURIs.RateShows, data.ToJSON()); // return success or failure return response.FromJSON<TraktRatingsResponse>(); }
private TraktRateShows GetRateShowsData(IEnumerable<Dictionary<string, string>> shows) { var traktShows = new List<TraktShow>(); traktShows.AddRange(from show in shows select new TraktShow { IMDbId = show[IMDbFieldMapping.cIMDbID], Title = show[IMDbFieldMapping.cTitle], Year = int.Parse(show[IMDbFieldMapping.cYear]), Rating = int.Parse(show[IMDbFieldMapping.cRating]) }); var movieRateData = new TraktRateShows { Username = AppSettings.TraktUsername, Password = AppSettings.TraktPassword, Shows = traktShows }; return movieRateData; }
private TraktRateShows GetRateShowsData(TVDbShowRatings showRatings) { List<TraktShow> shows = new List<TraktShow>(); shows.AddRange(from show in showRatings.Shows select new TraktShow { TVDbId = show.Id, Rating = show.UserRating }); TraktRateShows showRateData = new TraktRateShows { Username = AppSettings.TraktUsername, Password = AppSettings.TraktPassword, Shows = shows }; return showRateData; }