Downgrade YamlDotNet and improve logging for definitions update

pull/2063/head
Bogdan 8 months ago
parent e981cacbda
commit 3d52096eb4

@ -6,7 +6,7 @@
<PackageReference Include="Dapper" Version="2.0.123" />
<PackageReference Include="NBuilder" Version="6.1.0" />
<PackageReference Include="System.Data.SQLite.Core.Servarr" Version="1.0.115.5-18" />
<PackageReference Include="YamlDotNet" Version="15.1.2" />
<PackageReference Include="YamlDotNet" Version="13.1.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NzbDrone.Test.Common\Prowlarr.Test.Common.csproj" />

@ -137,11 +137,11 @@ namespace NzbDrone.Core.IndexerVersions
if (directoryInfo.Exists)
{
var files = directoryInfo.GetFiles($"*.yml", options);
var files = directoryInfo.GetFiles("*.yml", options);
foreach (var file in files)
{
_logger.Debug("Loading definition " + file.FullName);
_logger.Debug("Loading definition {0}", file.FullName);
try
{
@ -158,9 +158,9 @@ namespace NzbDrone.Core.IndexerVersions
indexerList.Add(definition);
}
catch (Exception e)
catch (Exception ex)
{
_logger.Error($"Error while parsing Cardigann definition {file.FullName}\n{e}");
_logger.Error(ex, "Error while parsing Cardigann definition {0}", file.FullName);
}
}
}
@ -188,7 +188,8 @@ namespace NzbDrone.Core.IndexerVersions
if (files.Any())
{
var file = files.First();
_logger.Trace("Loading Cardigann definition " + file.FullName);
_logger.Trace("Loading Cardigann definition {0}", file.FullName);
try
{
var definitionString = File.ReadAllText(file.FullName);
@ -196,9 +197,9 @@ namespace NzbDrone.Core.IndexerVersions
return CleanIndexerDefinition(definition);
}
catch (Exception e)
catch (Exception ex)
{
_logger.Error($"Error while parsing Cardigann definition {file.FullName}\n{e}");
_logger.Error(ex, "Error while parsing Cardigann definition {0}", file.FullName);
}
}
}
@ -206,7 +207,7 @@ namespace NzbDrone.Core.IndexerVersions
var dbDefs = _versionService.All();
//Check to ensure it's in versioned defs before we go to web
if (dbDefs.Count > 0 && !dbDefs.Any(x => x.File == fileKey))
if (dbDefs.Count > 0 && dbDefs.All(x => x.File != fileKey))
{
throw new ArgumentNullException(nameof(fileKey));
}
@ -217,9 +218,10 @@ namespace NzbDrone.Core.IndexerVersions
private CardigannDefinition GetHttpDefinition(string id)
{
var req = new HttpRequest($"https://indexers.prowlarr.com/{DEFINITION_BRANCH}/{DEFINITION_VERSION}/{id}");
var response = _httpClient.Get(req);
var request = new HttpRequest($"https://indexers.prowlarr.com/{DEFINITION_BRANCH}/{DEFINITION_VERSION}/{id}");
var response = _httpClient.Get(request);
var definition = _deserializer.Deserialize<CardigannDefinition>(response.Content);
return CleanIndexerDefinition(definition);
}
@ -289,7 +291,7 @@ namespace NzbDrone.Core.IndexerVersions
EnsureDefinitionsFolder();
var definitionsFolder = Path.Combine(startupFolder, "Definitions");
var saveFile = Path.Combine(definitionsFolder, $"indexers.zip");
var saveFile = Path.Combine(definitionsFolder, "indexers.zip");
_httpClient.DownloadFile($"https://indexers.prowlarr.com/{DEFINITION_BRANCH}/{DEFINITION_VERSION}/package.zip", saveFile);

@ -55,10 +55,10 @@ namespace NzbDrone.Core.Indexers
{
MapCardigannDefinition(definition);
}
catch
catch (Exception ex)
{
// Skip indexer if we fail in Cardigann mapping
_logger.Debug("Indexer '{0}' has no definition", definition.Name);
_logger.Debug(ex, "Indexer '{0}' has no definition", definition.Name);
}
}

@ -21,7 +21,7 @@
<PackageReference Include="System.Data.SQLite.Core.Servarr" Version="1.0.115.5-18" />
<PackageReference Include="System.Text.Json" Version="6.0.9" />
<PackageReference Include="MonoTorrent" Version="2.0.7" />
<PackageReference Include="YamlDotNet" Version="15.1.2" />
<PackageReference Include="YamlDotNet" Version="13.1.1" />
<PackageReference Include="AngleSharp" Version="1.1.2" />
</ItemGroup>
<ItemGroup>

Loading…
Cancel
Save