-
Failure description? var show = await _client.Shows.GetShowAsync(traktID, traktExtended);
var seasonA = await _client.Seasons.GetSeasonAsync(traktID, (uint)historyData.extraData.season_number);
//var seasons = await _client.Seasons.Get(traktID, (uint)historyData.extraData.season_number);
var watchedItem = TraktPost.NewSyncHistoryPost().WithShow(show.Value).WithSeasons(seasonA).Build();
await _client.Sync.AddWatchedHistoryItemsAsync(watchedItem);seasonA returning me lTraktEpisode, but it should return ITraktSeason Version1.3.0 (Latest) Relevant Stacktracewell wrong return type Code of Conduct
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
|
As defined in the Trakt API Documentation, a season is a list of episodes. Therefore TraktListResponse<ITraktEpisode> seasonEpisodesResponse = await _client.Seasons.GetSeasonAsync(traktID, (uint)historyData.extraData.season_number);is correct as it is. var historyPost = TraktPost.NewSyncHistoryPost().WithShow(show.Value).WithSeasons(...).Build();is meant for actual TraktListResponse<ITraktSeason> seasonsResponse = await _client.Seasons.GetAllSeasonsAsync(traktID);as defined in the Trakt API Documentation. What you are looking for is this: var historyPost = TraktPost.NewSyncHistoryPost().WithShow(show.Value).WithEpisodes(seasonEpisodesResponse).Build();Then, it should work. |
Beta Was this translation helpful? Give feedback.
-
|
Problem is i do want to add to history only 1 season. Your example add me all seasons and all episodes. This is nothing i need.. :( Can you please post sample, how to add to history for only single season pls ? |
Beta Was this translation helpful? Give feedback.
-
|
Never mind go it.. Thx for help.. |
Beta Was this translation helpful? Give feedback.
-
|
You have to get all seasons, without extended info to save data, and pick your specific var historyPost = TraktPost.NewSyncHistoryPost().WithSeason(season).Build();Adding only a season number without any additional info wouldn't work, because then Trakt doesn't know to which show it belongs. var historyPost = TraktPost.NewSyncHistoryPost()
.WithShowAndSeason(show,
new PostHistorySeason
{
1 // season number
})
.Build();
How did you solve your problem? |
Beta Was this translation helpful? Give feedback.
-
|
This way :) var show = await _client.Shows.GetShowAsync(traktID, traktExtended);
TraktListResponse<ITraktEpisode> seasonEpisodesResponse = await _client.Seasons.GetSeasonAsync(traktID, (uint)historyData.extraData.season_number);
TraktListResponse<ITraktSeason> seasonsResponse = await _client.Seasons.GetAllSeasonsAsync(traktID);
var selSeason = seasonsResponse.Where(s => s.Number == (uint)historyData.extraData.season_number).FirstOrDefault();
if (selSeason != null)
{
var historyPost = TraktPost.NewSyncHistoryPost().WithSeason(selSeason).Build();
await _client.Sync.AddWatchedHistoryItemsAsync(historyPost);
} |
Beta Was this translation helpful? Give feedback.
This way :)