Just update the TitleThe method per PR feedback

This commit is contained in:
Erik Frantz 2025-12-01 10:17:38 -06:00
parent 8fedf79c79
commit 24388c3c81

View file

@ -211,23 +211,18 @@ public static string CleanTitle(string title)
return title.RemoveDiacritics();
}
public static string CollectionTitleThe(string collectionTitle)
public static string TitleThe(string title)
{
if (string.IsNullOrEmpty(collectionTitle))
if (string.IsNullOrWhiteSpace(title))
{
return string.Empty;
}
else
{
return TitleThe(collectionTitle);
return TitlePrefixRegex.Replace(title, "$2, $1$3");
}
}
public static string TitleThe(string title)
{
return TitlePrefixRegex.Replace(title, "$2, $1$3");
}
public static string CleanTitleThe(string title)
{
if (TitlePrefixRegex.IsMatch(title))
@ -280,7 +275,7 @@ private void AddMovieTokens(Dictionary<string, Func<TokenMatch, string>> tokenHa
tokenHandlers["{Movie Certification}"] = m => movie.MovieMetadata.Value.Certification ?? string.Empty;
tokenHandlers["{Movie Collection}"] = m => Truncate(movie.MovieMetadata.Value.CollectionTitle, m.CustomFormat) ?? string.Empty;
tokenHandlers["{Movie CollectionThe}"] = m => Truncate(CollectionTitleThe(movie.MovieMetadata.Value.CollectionTitle), m.CustomFormat) ?? string.Empty;
tokenHandlers["{Movie CollectionThe}"] = m => Truncate(TitleThe(movie.MovieMetadata.Value.CollectionTitle), m.CustomFormat) ?? string.Empty;
}
private string GetLanguageTitle(Movie movie, string isoCodes)