mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-18 00:09:37 +02:00
New: Allow naming with original Movie title (in original language)
This commit is contained in:
parent
95918c4053
commit
a070279993
@ -116,8 +116,10 @@ class NamingModal extends Component {
|
||||
|
||||
const movieTokens = [
|
||||
{ token: '{Movie Title}', example: 'Movie Title!' },
|
||||
{ token: '{Movie Title:DE}', example: 'Filetitle' },
|
||||
{ token: '{Movie CleanTitle}', example: 'Movie Title' },
|
||||
{ token: '{Movie TitleThe}', example: 'Movie Title, The' },
|
||||
{ token: '{Movie OriginalTitle}', example: 'Τίτλος ταινίας' },
|
||||
{ token: '{Movie TitleFirstCharacter}', example: 'M' },
|
||||
{ token: '{Movie Collection}', example: 'The Movie Collection' },
|
||||
{ token: '{Movie Certification}', example: 'R' },
|
||||
|
@ -47,6 +47,7 @@ public void Setup()
|
||||
_movie = Builder<Movie>
|
||||
.CreateNew()
|
||||
.With(s => s.Title = "South Park")
|
||||
.With(s => s.OriginalTitle = "South of the Park")
|
||||
.Build();
|
||||
|
||||
_namingConfig = NamingConfig.Default;
|
||||
@ -198,6 +199,16 @@ public void should_cleanup_Movie_Title()
|
||||
.Should().Be("South.Park.1997");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_replace_movie_original_title()
|
||||
{
|
||||
_namingConfig.StandardMovieFormat = "{Movie OriginalTitle}";
|
||||
_movie.OriginalTitle = "South of the Park";
|
||||
|
||||
Subject.BuildFileName(_movie, _movieFile)
|
||||
.Should().Be("South of the Park");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_replace_movie_certification()
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ public class FileNameBuilder : IBuildFileNames
|
||||
|
||||
public static readonly Regex AirDateRegex = new Regex(@"\{Air(\s|\W|_)Date\}", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
public static readonly Regex MovieTitleRegex = new Regex(@"(?<token>\{((?:(Movie|Original))(?<separator>[- ._])(Clean)?(Title|Filename)(The)?)(?::(?<customFormat>[a-z0-9|]+))?\})",
|
||||
public static readonly Regex MovieTitleRegex = new Regex(@"(?<token>\{((?:(Movie|Original))(?<separator>[- ._])(Clean|Original)?(Title|Filename)(The)?)(?::(?<customFormat>[a-z0-9|]+))?\})",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
private static readonly Regex FileNameCleanupRegex = new Regex(@"([- ._])(\1)+", RegexOptions.Compiled);
|
||||
@ -232,6 +232,7 @@ private void AddMovieTokens(Dictionary<string, Func<TokenMatch, string>> tokenHa
|
||||
tokenHandlers["{Movie CleanTitle}"] = m => CleanTitle(GetLanguageTitle(movie, m.CustomFormat));
|
||||
tokenHandlers["{Movie Title The}"] = m => TitleThe(movie.Title);
|
||||
tokenHandlers["{Movie TitleFirstCharacter}"] = m => TitleThe(movie.Title).Substring(0, 1).FirstCharToUpper();
|
||||
tokenHandlers["{Movie OriginalTitle}"] = m => movie.OriginalTitle ?? string.Empty;
|
||||
|
||||
tokenHandlers["{Movie Certification}"] = m => movie.Certification ?? string.Empty;
|
||||
tokenHandlers["{Movie Collection}"] = m => movie.Collection?.Name ?? string.Empty;
|
||||
|
Loading…
Reference in New Issue
Block a user