// ------------------------------------------------------------- // Recently Updated Shows public async Task <PaginationList <RecentlyUpdatedShow> > GetRecentlyUpdatedShowsAsync(DateTime?startDate = null, TraktExtendedInfo extendedInfo = null, int?whichPage = null, int?limitPerPage = null) { var traktResults = await Client.Shows.GetRecentlyUpdatedShowsAsync(startDate, extendedInfo, whichPage, limitPerPage); var results = new PaginationList <RecentlyUpdatedShow> { CurrentPage = traktResults.Page, TotalPages = traktResults.PageCount, LimitPerPage = traktResults.Limit, TotalItemCount = traktResults.ItemCount, TotalUserCount = traktResults.UserCount }; results.Items = new ObservableCollection <RecentlyUpdatedShow>(); foreach (var traktRecentlyUpdatedShow in traktResults) { var recentlyUpdatedShow = ShowModelConverter.Convert <RecentlyUpdatedShow>(traktRecentlyUpdatedShow.Show); if (recentlyUpdatedShow != null) { var updatedAt = traktRecentlyUpdatedShow.UpdatedAt; recentlyUpdatedShow.ShowUpdatedAt = updatedAt.HasValue ? updatedAt.ToString() : string.Empty; results.Items.Add(recentlyUpdatedShow); } } return(results); }
// ------------------------------------------------------------- // Popular Shows public async Task <PaginationList <Show> > GetPopularShowsAsync(TraktExtendedInfo extendedInfo = null, TraktShowFilter showFilter = null, int?whichPage = null, int?limitPerPage = null) { var traktResults = await Client.Shows.GetPopularShowsAsync(extendedInfo, showFilter, whichPage, limitPerPage); var results = new PaginationList <Show> { CurrentPage = traktResults.Page, TotalPages = traktResults.PageCount, LimitPerPage = traktResults.Limit, TotalItemCount = traktResults.ItemCount, TotalUserCount = traktResults.UserCount }; results.Items = new ObservableCollection <Show>(); foreach (var traktPopularShow in traktResults) { var popularShow = ShowModelConverter.Convert <Show>(traktPopularShow); if (popularShow != null) { results.Items.Add(popularShow); } } return(results); }
// ------------------------------------------------------------- // Most Collected Shows public async Task <PaginationList <MostPWCShow> > GetMostCollectedShowsAsync(TraktExtendedInfo extendedInfo = null, TraktShowFilter showFilter = null, TraktTimePeriod period = null, int?whichPage = null, int?limitPerPage = null) { var traktResults = await Client.Shows.GetMostCollectedShowsAsync(period, extendedInfo, showFilter, whichPage, limitPerPage); var results = new PaginationList <MostPWCShow> { CurrentPage = traktResults.Page, TotalPages = traktResults.PageCount, LimitPerPage = traktResults.Limit, TotalItemCount = traktResults.ItemCount, TotalUserCount = traktResults.UserCount }; results.Items = new ObservableCollection <MostPWCShow>(); foreach (var traktMostCollectedShow in traktResults) { var mostCollectedShow = ShowModelConverter.Convert <MostPWCShow>(traktMostCollectedShow.Show); if (mostCollectedShow != null) { mostCollectedShow.WatcherCount = traktMostCollectedShow.WatcherCount.GetValueOrDefault(); mostCollectedShow.PlayCount = traktMostCollectedShow.PlayCount.GetValueOrDefault(); mostCollectedShow.CollectedCount = traktMostCollectedShow.CollectedCount.GetValueOrDefault(); mostCollectedShow.CollectorCount = traktMostCollectedShow.CollectorCount.GetValueOrDefault(); results.Items.Add(mostCollectedShow); } } return(results); }