@ -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 ( DictionaryToTable Radarr ( "Movie Folder Format" , guideData . Folder ) ) ;
_console . WriteLine ( ) ;
_console . Write ( DictionaryToTable ( "Standard Movie Format" , guideData . File ) ) ;
_console . Write ( DictionaryToTable Radarr ( "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 ( DictionaryToTable Sonarr ( "Season Folder Format" , guideData . Season ) ) ;
_console . WriteLine ( ) ;
_console . Write ( DictionaryToTable ( "Series Folder Format" , guideData . Series ) ) ;
_console . Write ( DictionaryToTable Sonarr ( "Series Folder Format" , guideData . Series ) ) ;
_console . WriteLine ( ) ;
_console . Write ( DictionaryToTable ( "Standard Episode Format" , guideData . Episodes . Standard ) ) ;
_console . Write ( DictionaryToTable Sonarr ( "Standard Episode Format" , guideData . Episodes . Standard ) ) ;
_console . WriteLine ( ) ;
_console . Write ( DictionaryToTable ( "Daily Episode Format" , guideData . Episodes . Daily ) ) ;
_console . Write ( DictionaryToTable Sonarr ( "Daily Episode Format" , guideData . Episodes . Daily ) ) ;
_console . WriteLine ( ) ;
_console . Write ( DictionaryToTable ( "Anime Episode Format" , guideData . Episodes . Anime ) ) ;
_console . Write ( DictionaryToTable Sonarr ( "Anime Episode Format" , guideData . Episodes . Anime ) ) ;
}
private static IRenderable DictionaryToTable ( string title , IReadOnlyDictionary < string , string > formats )
private static IRenderable DictionaryToTable Radarr ( 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 )
{