|
|
@ -73,6 +73,10 @@ namespace Ombi.Core.Services
|
|
|
|
var lang = await DefaultLanguageCode();
|
|
|
|
var lang = await DefaultLanguageCode();
|
|
|
|
foreach (var item in await recentMovieRequests.ToListAsync(cancellationToken))
|
|
|
|
foreach (var item in await recentMovieRequests.ToListAsync(cancellationToken))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (hideUsers.Hide && item.RequestedUserId != hideUsers.UserId)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
var images = await _cache.GetOrAddAsync($"{CacheKeys.TmdbImages}movie{item.TheMovieDbId}", () => _movieDbApi.GetMovieImages(item.TheMovieDbId.ToString(), cancellationToken), DateTimeOffset.Now.AddDays(1));
|
|
|
|
var images = await _cache.GetOrAddAsync($"{CacheKeys.TmdbImages}movie{item.TheMovieDbId}", () => _movieDbApi.GetMovieImages(item.TheMovieDbId.ToString(), cancellationToken), DateTimeOffset.Now.AddDays(1));
|
|
|
|
model.Add(new RecentlyRequestedModel
|
|
|
|
model.Add(new RecentlyRequestedModel
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -84,8 +88,8 @@ namespace Ombi.Core.Services
|
|
|
|
Title = item.Title,
|
|
|
|
Title = item.Title,
|
|
|
|
Type = RequestType.Movie,
|
|
|
|
Type = RequestType.Movie,
|
|
|
|
Approved = item.Approved,
|
|
|
|
Approved = item.Approved,
|
|
|
|
UserId = hideUsers.Hide ? string.Empty : item.RequestedUserId,
|
|
|
|
UserId = item.RequestedUserId,
|
|
|
|
Username = hideUsers.Hide ? string.Empty : item.RequestedUser.UserAlias,
|
|
|
|
Username = item.RequestedUser.UserAlias,
|
|
|
|
MediaId = item.TheMovieDbId.ToString(),
|
|
|
|
MediaId = item.TheMovieDbId.ToString(),
|
|
|
|
PosterPath = images?.posters?.Where(x => lang.Equals(x?.iso_639_1, StringComparison.InvariantCultureIgnoreCase))?.OrderByDescending(x => x.vote_count)?.Select(x => x.file_path)?.FirstOrDefault(),
|
|
|
|
PosterPath = images?.posters?.Where(x => lang.Equals(x?.iso_639_1, StringComparison.InvariantCultureIgnoreCase))?.OrderByDescending(x => x.vote_count)?.Select(x => x.file_path)?.FirstOrDefault(),
|
|
|
|
Background = images?.backdrops?.Where(x => lang.Equals(x?.iso_639_1, StringComparison.InvariantCultureIgnoreCase))?.OrderByDescending(x => x.vote_count)?.Select(x => x.file_path)?.FirstOrDefault(),
|
|
|
|
Background = images?.backdrops?.Where(x => lang.Equals(x?.iso_639_1, StringComparison.InvariantCultureIgnoreCase))?.OrderByDescending(x => x.vote_count)?.Select(x => x.file_path)?.FirstOrDefault(),
|
|
|
@ -94,6 +98,10 @@ namespace Ombi.Core.Services
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in await recentMusicRequests.ToListAsync(cancellationToken))
|
|
|
|
foreach (var item in await recentMusicRequests.ToListAsync(cancellationToken))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (hideUsers.Hide && item.RequestedUserId != hideUsers.UserId)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
model.Add(new RecentlyRequestedModel
|
|
|
|
model.Add(new RecentlyRequestedModel
|
|
|
|
{
|
|
|
|
{
|
|
|
|
RequestId = item.Id,
|
|
|
|
RequestId = item.Id,
|
|
|
@ -104,14 +112,18 @@ namespace Ombi.Core.Services
|
|
|
|
RequestDate = item.RequestedDate,
|
|
|
|
RequestDate = item.RequestedDate,
|
|
|
|
Title = item.Title,
|
|
|
|
Title = item.Title,
|
|
|
|
Type = RequestType.Album,
|
|
|
|
Type = RequestType.Album,
|
|
|
|
UserId = hideUsers.Hide ? string.Empty : item.RequestedUserId,
|
|
|
|
UserId = item.RequestedUserId,
|
|
|
|
Username = hideUsers.Hide ? string.Empty : item.RequestedUser.UserAlias,
|
|
|
|
Username = item.RequestedUser.UserAlias,
|
|
|
|
MediaId = item.ForeignAlbumId,
|
|
|
|
MediaId = item.ForeignAlbumId,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in await recentTvRequests.ToListAsync(cancellationToken))
|
|
|
|
foreach (var item in await recentTvRequests.ToListAsync(cancellationToken))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (hideUsers.Hide && item.RequestedUserId != hideUsers.UserId)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
var providerId = item.ParentRequest.ExternalProviderId.ToString();
|
|
|
|
var providerId = item.ParentRequest.ExternalProviderId.ToString();
|
|
|
|
var images = await _cache.GetOrAddAsync($"{CacheKeys.TmdbImages}tv{providerId}", () => _movieDbApi.GetTvImages(providerId.ToString(), cancellationToken), DateTimeOffset.Now.AddDays(1));
|
|
|
|
var images = await _cache.GetOrAddAsync($"{CacheKeys.TmdbImages}tv{providerId}", () => _movieDbApi.GetTvImages(providerId.ToString(), cancellationToken), DateTimeOffset.Now.AddDays(1));
|
|
|
|
|
|
|
|
|
|
|
@ -127,8 +139,8 @@ namespace Ombi.Core.Services
|
|
|
|
TvPartiallyAvailable = partialAvailability,
|
|
|
|
TvPartiallyAvailable = partialAvailability,
|
|
|
|
Title = item.ParentRequest.Title,
|
|
|
|
Title = item.ParentRequest.Title,
|
|
|
|
Type = RequestType.TvShow,
|
|
|
|
Type = RequestType.TvShow,
|
|
|
|
UserId = hideUsers.Hide ? string.Empty : item.RequestedUserId,
|
|
|
|
UserId = item.RequestedUserId,
|
|
|
|
Username = hideUsers.Hide ? string.Empty : item.RequestedUser.UserAlias,
|
|
|
|
Username = item.RequestedUser.UserAlias,
|
|
|
|
MediaId = providerId.ToString(),
|
|
|
|
MediaId = providerId.ToString(),
|
|
|
|
PosterPath = images?.posters?.Where(x => lang.Equals(x?.iso_639_1, StringComparison.InvariantCultureIgnoreCase))?.OrderByDescending(x => x.vote_count)?.Select(x => x.file_path)?.FirstOrDefault(),
|
|
|
|
PosterPath = images?.posters?.Where(x => lang.Equals(x?.iso_639_1, StringComparison.InvariantCultureIgnoreCase))?.OrderByDescending(x => x.vote_count)?.Select(x => x.file_path)?.FirstOrDefault(),
|
|
|
|
Background = images?.backdrops?.Where(x => lang.Equals(x?.iso_639_1, StringComparison.InvariantCultureIgnoreCase))?.OrderByDescending(x => x.vote_count)?.Select(x => x.file_path)?.FirstOrDefault(),
|
|
|
|
Background = images?.backdrops?.Where(x => lang.Equals(x?.iso_639_1, StringComparison.InvariantCultureIgnoreCase))?.OrderByDescending(x => x.vote_count)?.Select(x => x.file_path)?.FirstOrDefault(),
|
|
|
|