You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
48 lines
1.2 KiB
using System.Collections.Generic;
|
|
using Newtonsoft.Json;
|
|
using NzbDrone.Common.Extensions;
|
|
using NzbDrone.Core.ImportLists.ImportListMovies;
|
|
|
|
namespace NzbDrone.Core.ImportLists.TMDb.List
|
|
{
|
|
public class TMDbListParser : TMDbParser
|
|
{
|
|
public override IList<ImportListMovie> ParseResponse(ImportListResponse importResponse)
|
|
{
|
|
var movies = new List<ImportListMovie>();
|
|
|
|
if (!PreProcess(importResponse))
|
|
{
|
|
return movies;
|
|
}
|
|
|
|
var jsonResponse = JsonConvert.DeserializeObject<ListResponseResource>(importResponse.Content);
|
|
|
|
// no movies were return
|
|
if (jsonResponse == null)
|
|
{
|
|
return movies;
|
|
}
|
|
|
|
foreach (var movie in jsonResponse.Results)
|
|
{
|
|
// Media Type is not Movie
|
|
if (movie.MediaType != "movie")
|
|
{
|
|
continue;
|
|
}
|
|
|
|
// Movies with no Year Fix
|
|
if (string.IsNullOrWhiteSpace(movie.ReleaseDate))
|
|
{
|
|
continue;
|
|
}
|
|
|
|
movies.AddIfNotNull(MapListMovie(movie));
|
|
}
|
|
|
|
return movies;
|
|
}
|
|
}
|
|
}
|