mirror of
https://github.com/Radarr/Radarr
synced 2025-10-06 02:32:53 +02:00
Fixed: Improve IMDb list logging
This commit is contained in:
@@ -76,7 +76,7 @@ namespace NzbDrone.Core.ImportLists.RadarrList2.IMDbList
|
||||
|
||||
public override IParseImportListResponse GetParser()
|
||||
{
|
||||
return new IMDbListParser(Settings);
|
||||
return new IMDbListParser(Settings, _logger);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.ImportLists.ImportListMovies;
|
||||
using NzbDrone.Core.MetadataSource.SkyHook.Resource;
|
||||
@@ -11,10 +12,12 @@ namespace NzbDrone.Core.ImportLists.RadarrList2.IMDbList
|
||||
public class IMDbListParser : RadarrList2Parser
|
||||
{
|
||||
private readonly IMDbListSettings _settings;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public IMDbListParser(IMDbListSettings settings)
|
||||
public IMDbListParser(IMDbListSettings settings, Logger logger)
|
||||
{
|
||||
_settings = settings;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public override IList<ImportListMovie> ParseResponse(ImportListResponse importListResponse)
|
||||
@@ -25,6 +28,7 @@ namespace NzbDrone.Core.ImportLists.RadarrList2.IMDbList
|
||||
|
||||
if (!PreProcess(importResponse))
|
||||
{
|
||||
_logger.Debug("IMDb List {0}: Found {1} movies", _settings.ListId, movies.Count);
|
||||
return movies;
|
||||
}
|
||||
|
||||
@@ -34,20 +38,19 @@ namespace NzbDrone.Core.ImportLists.RadarrList2.IMDbList
|
||||
var rows = importResponse.Content.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
movies = rows.Skip(1).SelectList(m => m.Split(',')).Where(m => m.Length > 5).SelectList(i => new ImportListMovie { ImdbId = i[1], Title = i[5] });
|
||||
|
||||
return movies;
|
||||
}
|
||||
else
|
||||
{
|
||||
var jsonResponse = JsonConvert.DeserializeObject<List<MovieResource>>(importResponse.Content);
|
||||
|
||||
if (jsonResponse == null)
|
||||
if (jsonResponse != null)
|
||||
{
|
||||
return movies;
|
||||
movies = jsonResponse.SelectList(m => new ImportListMovie { TmdbId = m.TmdbId });
|
||||
}
|
||||
|
||||
return jsonResponse.SelectList(m => new ImportListMovie { TmdbId = m.TmdbId });
|
||||
}
|
||||
|
||||
_logger.Debug("IMDb List {0}: Found {1} movies", _settings.ListId, movies.Count);
|
||||
return movies;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -9,16 +9,22 @@ namespace NzbDrone.Core.ImportLists.RadarrList2.IMDbList
|
||||
|
||||
protected override HttpRequest GetHttpRequest()
|
||||
{
|
||||
Logger.Info("IMDb List {0}: Importing movies", Settings.ListId);
|
||||
|
||||
// Use IMDb list Export for user lists to bypass RadarrAPI caching
|
||||
if (Settings.ListId.StartsWith("ls", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
throw new Exception("IMDb lists of the form 'ls12345678' are no longer supported. Feel free to remove this list after you review your Clean Library Level.");
|
||||
}
|
||||
|
||||
return RequestBuilder.Create()
|
||||
var request = RequestBuilder.Create()
|
||||
.SetSegment("route", $"list/imdb/{Settings.ListId}")
|
||||
.Accept(HttpAccept.Json)
|
||||
.Build();
|
||||
|
||||
Logger.Trace("IMDb List {0}: Request URL: {1}", Settings.ListId, request.Url);
|
||||
|
||||
return request;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user