Fix Pull Request comments

This commit is contained in:
Daniel Martín González 2023-10-01 18:26:09 +02:00
parent 46a9d4635b
commit 8315a15af1
3 changed files with 21 additions and 20 deletions

View File

@ -26,24 +26,24 @@ namespace NzbDrone.Core.ImportLists.Trakt.Popular
return listItems;
}
var jsonResponse = new List<TraktSeriesResource>();
var traktSeries = new List<TraktSeriesResource>();
if (_settings.TraktListType == (int)TraktPopularListType.Popular)
{
jsonResponse = STJson.Deserialize<List<TraktSeriesResource>>(_importResponse.Content);
traktSeries = STJson.Deserialize<List<TraktSeriesResource>>(_importResponse.Content);
}
else
{
jsonResponse = STJson.Deserialize<List<TraktResponse>>(_importResponse.Content).SelectList(c => c.Show);
traktSeries = STJson.Deserialize<List<TraktResponse>>(_importResponse.Content).SelectList(c => c.Show);
}
// no movies were return
if (jsonResponse == null)
// no series were returned
if (traktSeries == null)
{
return listItems;
}
foreach (var series in jsonResponse)
foreach (var series in traktSeries)
{
listItems.AddIfNotNull(new ImportListItemInfo()
{

View File

@ -22,20 +22,20 @@ namespace NzbDrone.Core.ImportLists.Trakt
return series;
}
var jsonResponse = STJson.Deserialize<List<TraktResponse>>(_importResponse.Content);
var traktResponses = STJson.Deserialize<List<TraktResponse>>(_importResponse.Content);
// no series were return
if (jsonResponse == null)
// no series were returned
if (traktResponses == null)
{
return series;
}
foreach (var show in jsonResponse)
foreach (var traktResponse in traktResponses)
{
series.AddIfNotNull(new ImportListItemInfo()
{
Title = show.Show.Title,
TvdbId = show.Show.Ids.Tvdb.GetValueOrDefault()
Title = traktResponse.Show.Title,
TvdbId = traktResponse.Show.Ids.Tvdb.GetValueOrDefault()
});
}

View File

@ -27,36 +27,37 @@ namespace NzbDrone.Core.ImportLists.Trakt.User
return listItems;
}
var jsonResponse = new List<TraktSeriesResource>();
var traktSeries = new List<TraktSeriesResource>();
if (_settings.TraktListType == (int)TraktUserListType.UserWatchedList)
{
var jsonWatchedResponse = STJson.Deserialize<List<TraktWatchedResponse>>(_importResponse.Content);
switch (_settings.TraktWatchedListType)
{
case (int)TraktUserWatchedListType.InProgress:
jsonResponse = jsonWatchedResponse.Where(c => c.Seasons.Where(s => s.Number > 0).Sum(s => s.Episodes.Count) < c.Show.AiredEpisodes).SelectList(c => c.Show);
traktSeries = jsonWatchedResponse.Where(c => c.Seasons.Where(s => s.Number > 0).Sum(s => s.Episodes.Count) < c.Show.AiredEpisodes).SelectList(c => c.Show);
break;
case (int)TraktUserWatchedListType.CompletelyWatched:
jsonResponse = jsonWatchedResponse.Where(c => c.Seasons.Where(s => s.Number > 0).Sum(s => s.Episodes.Count) == c.Show.AiredEpisodes).SelectList(c => c.Show);
traktSeries = jsonWatchedResponse.Where(c => c.Seasons.Where(s => s.Number > 0).Sum(s => s.Episodes.Count) == c.Show.AiredEpisodes).SelectList(c => c.Show);
break;
default:
jsonResponse = jsonWatchedResponse.SelectList(c => c.Show);
traktSeries = jsonWatchedResponse.SelectList(c => c.Show);
break;
}
}
else
{
jsonResponse = STJson.Deserialize<List<TraktResponse>>(_importResponse.Content).SelectList(c => c.Show);
traktSeries = STJson.Deserialize<List<TraktResponse>>(_importResponse.Content).SelectList(c => c.Show);
}
// no series were return
if (jsonResponse == null)
// no series were returned
if (traktSeries == null)
{
return listItems;
}
foreach (var series in jsonResponse)
foreach (var series in traktSeries)
{
listItems.AddIfNotNull(new ImportListItemInfo()
{