fix: Put sonarr version for naming in own column

In order to avoid confusion, the `v3` and `v4` version indicators for
certain naming format keys has been moved to their own column in the
`list` command table.
spectre-console-remove-di-hacks
Robert Dailey 7 months ago
parent 02d19c609b
commit 6452cf8a40

@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- CLI: Some custom formats were not properly categorized when running `list custom-formats`.
- Media Naming: In order to avoid confusion, the `v3` and `v4` version indicators for certain naming
format keys has been moved to their own column in the `list` command table.
## [6.0.1] - 2023-10-02

@ -41,9 +41,9 @@ public class MediaNamingDataLister
_console.MarkupLine("Media Naming Formats [red](Preview)[/]");
_console.WriteLine();
_console.Write(DictionaryToTable("Movie Folder Format", guideData.Folder));
_console.Write(DictionaryToTableRadarr("Movie Folder Format", guideData.Folder));
_console.WriteLine();
_console.Write(DictionaryToTable("Standard Movie Format", guideData.File));
_console.Write(DictionaryToTableRadarr("Standard Movie Format", guideData.File));
}
private void ListSonarrNaming(SonarrMediaNamingData guideData)
@ -51,18 +51,18 @@ public class MediaNamingDataLister
_console.MarkupLine("Media Naming Formats [red](Preview)[/]");
_console.WriteLine();
_console.Write(DictionaryToTable("Season Folder Format", guideData.Season));
_console.Write(DictionaryToTableSonarr("Season Folder Format", guideData.Season));
_console.WriteLine();
_console.Write(DictionaryToTable("Series Folder Format", guideData.Series));
_console.Write(DictionaryToTableSonarr("Series Folder Format", guideData.Series));
_console.WriteLine();
_console.Write(DictionaryToTable("Standard Episode Format", guideData.Episodes.Standard));
_console.Write(DictionaryToTableSonarr("Standard Episode Format", guideData.Episodes.Standard));
_console.WriteLine();
_console.Write(DictionaryToTable("Daily Episode Format", guideData.Episodes.Daily));
_console.Write(DictionaryToTableSonarr("Daily Episode Format", guideData.Episodes.Daily));
_console.WriteLine();
_console.Write(DictionaryToTable("Anime Episode Format", guideData.Episodes.Anime));
_console.Write(DictionaryToTableSonarr("Anime Episode Format", guideData.Episodes.Anime));
}
private static IRenderable DictionaryToTable(string title, IReadOnlyDictionary<string, string> formats)
private static IRenderable DictionaryToTableRadarr(string title, IReadOnlyDictionary<string, string> formats)
{
var table = new Table()
.AddColumns("Key", "Format");
@ -82,6 +82,34 @@ public class MediaNamingDataLister
return new Rows(Markup.FromInterpolated($"[orange3]{title}[/]"), table);
}
private static IRenderable DictionaryToTableSonarr(string title, IReadOnlyDictionary<string, string> formats)
{
var table = new Table()
.AddColumns("Key", "Sonarr Version", "Format");
var alternatingColors = new[] {"white", "paleturquoise4"};
var colorIndex = 0;
foreach (var (key, value) in formats)
{
var split = key.Split(':');
var version = split switch
{
{Length: 1} => "All",
_ => $"v{split[1]}"
};
var color = alternatingColors[colorIndex];
table.AddRow(
$"[{color}]{Markup.Escape(split[0])}[/]",
$"[{color}]{Markup.Escape(version)}[/]",
$"[{color}]{Markup.Escape(value)}[/]");
colorIndex = 1 - colorIndex;
}
return new Rows(Markup.FromInterpolated($"[orange3]{title}[/]"), table);
}
[SuppressMessage("ReSharper", "ConvertIfStatementToReturnStatement")]
private static string TransformKey(string key)
{

Loading…
Cancel
Save