1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-20 18:02:44 +01:00

Less logging when no import lists are enabled

(cherry picked from commit 7be4840f028f24e3920bd395a4e15eb5e643e46f)

Closes #9040
This commit is contained in:
Mark McDowall 2023-08-18 23:47:19 -07:00 committed by Bogdan
parent 1d488df242
commit 3244282a83

View File

@ -41,36 +41,37 @@ public ImportListSyncService(IImportListFactory importListFactory,
_configService = configService;
}
private void SyncList(ImportListDefinition definition)
{
_logger.ProgressInfo(string.Format("Starting Import List Refresh for List {0}", definition.Name));
var result = _listFetcherAndParser.FetchSingleList(definition);
ProcessReports(result);
}
private void SyncAll()
{
var result = _listFetcherAndParser.Fetch();
if (_importListFactory.Enabled().Where(a => ((ImportListDefinition)a.Definition).EnableAuto).Empty())
{
_logger.Info("No auto enabled lists, skipping sync and cleaning");
_logger.Debug("No import lists with automatic add enabled, skipping sync and cleaning");
return;
}
if (result.SyncedLists == 0)
var listItemsResult = _listFetcherAndParser.Fetch();
if (listItemsResult.SyncedLists == 0)
{
return;
}
if (!result.AnyFailure)
if (!listItemsResult.AnyFailure)
{
CleanLibrary();
}
ProcessReports(result);
ProcessListItems(listItemsResult);
}
private void SyncList(ImportListDefinition definition)
{
_logger.ProgressInfo("Starting Import List Refresh for List {0}", definition.Name);
var listItemsResult = _listFetcherAndParser.FetchSingleList(definition);
ProcessListItems(listItemsResult);
}
private void ProcessMovieReport(ImportListDefinition importList, ImportListMovie report, List<ImportExclusion> listExclusions, List<int> dbMovies, List<Movie> moviesToAdd)
@ -122,7 +123,7 @@ private void ProcessMovieReport(ImportListDefinition importList, ImportListMovie
}
}
private void ProcessReports(ImportListFetchResult listFetchResult)
private void ProcessListItems(ImportListFetchResult listFetchResult)
{
listFetchResult.Movies = listFetchResult.Movies.DistinctBy(x =>
{
@ -162,11 +163,10 @@ private void ProcessReports(ImportListFetchResult listFetchResult)
if (moviesToAdd.Any())
{
_logger.Info($"Adding {moviesToAdd.Count} movies from your auto enabled lists to library");
}
_logger.ProgressInfo("Adding {0} movies from your auto enabled lists to library", moviesToAdd.Count);
_addMovieService.AddMovies(moviesToAdd, true);
}
}
public void Execute(ImportListSyncCommand message)
{