@@ -38,42 +38,42 @@ public string BuildArtistFolderName(string? pattern)
3838 private Dictionary < string , Func < string > > GetTokenHandlers ( Track ? track , Album ? album ) => new ( StringComparer . OrdinalIgnoreCase )
3939 {
4040 // Album Tokens (only added if album is provided)
41- { "{Album Title}" , ( ) => album ? . Title ?? string . Empty } ,
41+ { "{Album Title}" , ( ) => CleanTitle ( album ? . Title ) } ,
4242 { "{Album CleanTitle}" , ( ) => CleanTitle ( album ? . Title ) } ,
43- { "{Album TitleThe}" , ( ) => TitleThe ( album ? . Title ) } ,
44- { "{Album CleanTitleThe}" , ( ) => CleanTitleThe ( album ? . Title ) } ,
45- { "{Album Type}" , ( ) => album ? . AlbumType ?? string . Empty } ,
46- { "{Album Genre}" , ( ) => album ? . Genres ? . FirstOrDefault ( ) ?? string . Empty } ,
43+ { "{Album TitleThe}" , ( ) => CleanTitle ( TitleThe ( album ? . Title ) ) } ,
44+ { "{Album CleanTitleThe}" , ( ) => CleanTitle ( album ? . Title ) } ,
45+ { "{Album Type}" , ( ) => CleanTitle ( album ? . AlbumType ) } ,
46+ { "{Album Genre}" , ( ) => CleanTitle ( album ? . Genres ? . FirstOrDefault ( ) ) } ,
4747 { "{Album MbId}" , ( ) => album ? . ForeignAlbumId ?? string . Empty } ,
48- { "{Album Disambiguation}" , ( ) => album ? . Disambiguation ?? string . Empty } ,
48+ { "{Album Disambiguation}" , ( ) => CleanTitle ( album ? . Disambiguation ) } ,
4949 { "{Release Year}" , ( ) => album ? . ReleaseDate ? . Year . ToString ( ) ?? string . Empty } ,
5050
5151 // Artist Tokens
52- { "{Artist Name}" , ( ) => _artist ? . Name ?? string . Empty } ,
52+ { "{Artist Name}" , ( ) => CleanTitle ( _artist ? . Name ) } ,
5353 { "{Artist CleanName}" , ( ) => CleanTitle ( _artist ? . Name ) } ,
54- { "{Artist NameThe}" , ( ) => TitleThe ( _artist ? . Name ) } ,
54+ { "{Artist NameThe}" , ( ) => CleanTitle ( TitleThe ( _artist ? . Name ) ) } ,
5555 { "{Artist CleanNameThe}" , ( ) => CleanTitleThe ( _artist ? . Name ) } ,
56- { "{Artist Genre}" , ( ) => _artist ? . Metadata ? . Value ? . Genres ? . FirstOrDefault ( ) ?? string . Empty } ,
56+ { "{Artist Genre}" , ( ) => CleanTitle ( _artist ? . Metadata ? . Value ? . Genres ? . FirstOrDefault ( ) ) } ,
5757 { "{Artist MbId}" , ( ) => _artist ? . ForeignArtistId ?? string . Empty } ,
58- { "{Artist Disambiguation}" , ( ) => _artist ? . Metadata ? . Value ? . Disambiguation ?? string . Empty } ,
58+ { "{Artist Disambiguation}" , ( ) => CleanTitle ( _artist ? . Metadata ? . Value ? . Disambiguation ) } ,
5959 { "{Artist NameFirstCharacter}" , ( ) => TitleFirstCharacter ( _artist ? . Name ) } ,
6060
6161 // Track Tokens (only added if track is provided)
62- { "{Track Title}" , ( ) => track ? . Title ?? string . Empty } ,
62+ { "{Track Title}" , ( ) => CleanTitle ( track ? . Title ) } ,
6363 { "{Track CleanTitle}" , ( ) => CleanTitle ( track ? . Title ) } ,
64- { "{Track ArtistName}" , ( ) => _artist ? . Name ?? string . Empty } ,
65- { "{Track ArtistNameThe}" , ( ) => TitleThe ( _artist ? . Name ) } ,
64+ { "{Track ArtistName}" , ( ) => CleanTitle ( _artist ? . Name ) } ,
65+ { "{Track ArtistNameThe}" , ( ) => CleanTitle ( TitleThe ( _artist ? . Name ) ) } ,
6666 { "{Track ArtistMbId}" , ( ) => _artist ? . ForeignArtistId ?? string . Empty } ,
6767 { "{track:0}" , ( ) => FormatTrackNumber ( track ? . TrackNumber , "0" ) } ,
6868 { "{track:00}" , ( ) => FormatTrackNumber ( track ? . TrackNumber , "00" ) } ,
6969
7070 // Medium Tokens (only added if track is provided)
71- { "{Medium Name}" , ( ) => track ? . AlbumRelease ? . Value ? . Media ? . FirstOrDefault ( m => m . Number == track . MediumNumber ) ? . Name ?? string . Empty } ,
71+ { "{Medium Name}" , ( ) => CleanTitle ( track ? . AlbumRelease ? . Value ? . Media ? . FirstOrDefault ( m => m . Number == track . MediumNumber ) ? . Name ) } ,
7272 { "{medium:0}" , ( ) => track ? . MediumNumber . ToString ( "0" ) ?? string . Empty } ,
7373 { "{medium:00}" , ( ) => track ? . MediumNumber . ToString ( "00" ) ?? string . Empty } ,
7474
7575 // Release Info Tokens
76- { "{Original Title}" , ( ) => _releaseInfo ? . Title ?? string . Empty }
76+ { "{Original Title}" , ( ) => CleanTitle ( _releaseInfo ? . Title ) }
7777 } ;
7878
7979 private static string ReplaceTokens ( string pattern , Dictionary < string , Func < string > > tokenHandlers ) => ReplaceTokensRegex ( ) . Replace ( pattern , match =>
@@ -118,7 +118,7 @@ private string CleanFileName(string fileName)
118118 private static string CleanTitle ( string ? title )
119119 {
120120 if ( string . IsNullOrEmpty ( title ) ) return string . Empty ;
121- return title . Replace ( "&" , "and" ) . Replace ( "/" , " " ) . Replace ( "\\ " , " " ) . Trim ( ) ;
121+ return title . Replace ( "&" , "and" ) . Replace ( "/" , " - " ) . Replace ( "\\ " , " - " ) . Trim ( ) ;
122122 }
123123
124124 private static string TitleThe ( string ? title )
0 commit comments