diff --git a/CHANGELOG.md b/CHANGELOG.md index cc3adecc..c657cf6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Releases now retain executable permissions on Linux and macOS. +- Sonarr: Do not modify or delete release profiles when using `--preview` ## [4.0.1] - 2022-12-21 diff --git a/src/Recyclarr.TrashLib/Services/CustomFormat/CustomFormatUpdater.cs b/src/Recyclarr.TrashLib/Services/CustomFormat/CustomFormatUpdater.cs index b1636e04..10893ec5 100644 --- a/src/Recyclarr.TrashLib/Services/CustomFormat/CustomFormatUpdater.cs +++ b/src/Recyclarr.TrashLib/Services/CustomFormat/CustomFormatUpdater.cs @@ -47,19 +47,18 @@ internal class CustomFormatUpdater : ICustomFormatUpdater if (isPreview) { PreviewCustomFormats(); + return; } - else - { - await _persistenceProcessor.PersistCustomFormats(_guideProcessor.ProcessedCustomFormats, - _guideProcessor.DeletedCustomFormatsInCache, _guideProcessor.ProfileScores); - PrintApiStatistics(_persistenceProcessor.Transactions); - PrintQualityProfileUpdates(); + await _persistenceProcessor.PersistCustomFormats(_guideProcessor.ProcessedCustomFormats, + _guideProcessor.DeletedCustomFormatsInCache, _guideProcessor.ProfileScores); - // Cache all the custom formats (using ID from API response). - _cache.Update(_guideProcessor.ProcessedCustomFormats); - _cache.Save(); - } + PrintApiStatistics(_persistenceProcessor.Transactions); + PrintQualityProfileUpdates(); + + // Cache all the custom formats (using ID from API response). + _cache.Update(_guideProcessor.ProcessedCustomFormats); + _cache.Save(); } private void PrintQualityProfileUpdates() diff --git a/src/Recyclarr.TrashLib/Services/Sonarr/ReleaseProfile/ReleaseProfileUpdater.cs b/src/Recyclarr.TrashLib/Services/Sonarr/ReleaseProfile/ReleaseProfileUpdater.cs index 22695bae..c31aa1cf 100644 --- a/src/Recyclarr.TrashLib/Services/Sonarr/ReleaseProfile/ReleaseProfileUpdater.cs +++ b/src/Recyclarr.TrashLib/Services/Sonarr/ReleaseProfile/ReleaseProfileUpdater.cs @@ -55,14 +55,17 @@ public class ReleaseProfileUpdater : IReleaseProfileUpdater selectedProfile.TrashId); selectedProfile = _pipeline.Process(selectedProfile, configProfile); + filteredProfiles.Add((selectedProfile, configProfile.Tags)); + } - if (isPreview) + if (isPreview) + { + foreach (var profile in filteredProfiles.Select(x => x.Profile)) { - PrintTermsAndScores(selectedProfile); - continue; + PrintTermsAndScores(profile); } - filteredProfiles.Add((selectedProfile, configProfile.Tags)); + return; } await ProcessReleaseProfiles(filteredProfiles); @@ -111,7 +114,7 @@ public class ReleaseProfileUpdater : IReleaseProfileUpdater _console.Output.WriteLine(" Include Preferred when Renaming?"); _console.Output.WriteLine(" " + - (profile.IncludePreferredWhenRenaming ? "YES" : "NO")); + (profile.IncludePreferredWhenRenaming ? "YES" : "NO")); _console.Output.WriteLine(""); PrintTerms("Must Contain", profile.Required); @@ -164,7 +167,7 @@ public class ReleaseProfileUpdater : IReleaseProfileUpdater .Where(sonarrProfile => { return sonarrProfile.Name.StartsWithIgnoreCase("[Trash]") && - !profiles.Any(profile => sonarrProfile.Name.EndsWithIgnoreCase(profile.Name)); + !profiles.Any(profile => sonarrProfile.Name.EndsWithIgnoreCase(profile.Name)); }); foreach (var profile in sonarrProfilesToDelete)