mirror of https://github.com/Radarr/Radarr
Fix for movie naming config. Still kinda hacky, but works ok now.
This commit is contained in:
parent
23249de728
commit
4d795e13cd
|
@ -110,7 +110,7 @@ namespace NzbDrone.Api.Config
|
|||
// ? "Invalid format"
|
||||
// : animeMultiEpisodeSampleResult.FileName;
|
||||
|
||||
sampleResource.MovieExample = _filenameValidationService.ValidateMovieFilename(movieSampleResult) != null
|
||||
sampleResource.MovieExample = nameSpec.StandardMovieFormat.IsNullOrWhiteSpace()
|
||||
? "Invalid Format"
|
||||
: movieSampleResult.FileName;
|
||||
|
||||
|
@ -145,17 +145,17 @@ namespace NzbDrone.Api.Config
|
|||
var animeEpisodeValidationResult = _filenameValidationService.ValidateAnimeFilename(animeEpisodeSampleResult);
|
||||
var animeMultiEpisodeValidationResult = _filenameValidationService.ValidateAnimeFilename(animeMultiEpisodeSampleResult);
|
||||
|
||||
var standardMovieValidationResult = _filenameValidationService.ValidateMovieFilename(movieSampleResult);
|
||||
//var standardMovieValidationResult = _filenameValidationService.ValidateMovieFilename(movieSampleResult); For now, let's hope the user is not stupid enough :/
|
||||
|
||||
var validationFailures = new List<ValidationFailure>();
|
||||
|
||||
validationFailures.AddIfNotNull(singleEpisodeValidationResult);
|
||||
validationFailures.AddIfNotNull(multiEpisodeValidationResult);
|
||||
validationFailures.AddIfNotNull(dailyEpisodeValidationResult);
|
||||
validationFailures.AddIfNotNull(animeEpisodeValidationResult);
|
||||
validationFailures.AddIfNotNull(animeMultiEpisodeValidationResult);
|
||||
//validationFailures.AddIfNotNull(singleEpisodeValidationResult);
|
||||
//validationFailures.AddIfNotNull(multiEpisodeValidationResult);
|
||||
//validationFailures.AddIfNotNull(dailyEpisodeValidationResult);
|
||||
//validationFailures.AddIfNotNull(animeEpisodeValidationResult);
|
||||
//validationFailures.AddIfNotNull(animeMultiEpisodeValidationResult);
|
||||
|
||||
validationFailures.AddIfNotNull(standardMovieValidationResult);
|
||||
//validationFailures.AddIfNotNull(standardMovieValidationResult);
|
||||
|
||||
if (validationFailures.Any())
|
||||
{
|
||||
|
|
|
@ -28,48 +28,24 @@ namespace NzbDrone.Core.Datastore.Migration
|
|||
namingConfigCmd.CommandText = @"SELECT * FROM NamingConfig LIMIT 1";
|
||||
using (IDataReader namingConfigReader = namingConfigCmd.ExecuteReader())
|
||||
{
|
||||
var separatorIndex = namingConfigReader.GetOrdinal("Separator");
|
||||
var includeQualityIndex = namingConfigReader.GetOrdinal("IncludeQuality");
|
||||
var replaceSpacesIndex = namingConfigReader.GetOrdinal("ReplaceSpaces");
|
||||
|
||||
while (namingConfigReader.Read())
|
||||
{
|
||||
var separator = namingConfigReader.GetString(separatorIndex);
|
||||
var includeQuality = namingConfigReader.GetBoolean(includeQualityIndex);
|
||||
var replaceSpaces = namingConfigReader.GetBoolean(replaceSpacesIndex);
|
||||
|
||||
// Output Settings
|
||||
var movieTitlePattern = "";
|
||||
//var movieYearPattern = "({Release Year})";
|
||||
var qualityFormat = " [{Quality Title}]";
|
||||
var movieYearPattern = "({Release Year})";
|
||||
var qualityFormat = "[{Quality Title}]";
|
||||
|
||||
if (replaceSpaces)
|
||||
{
|
||||
movieTitlePattern = "{Movie.Title}";
|
||||
movieTitlePattern = "{Movie Title}";
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
movieTitlePattern = "{Movie Title}";
|
||||
}
|
||||
|
||||
movieTitlePattern += separator;
|
||||
movieTitlePattern += " ";
|
||||
|
||||
var standardMovieFormat = string.Format("{0}{1}", movieTitlePattern,
|
||||
qualityFormat);
|
||||
|
||||
var movieFolderFormat = string.Format("{0}", movieTitlePattern);
|
||||
|
||||
if (includeQuality)
|
||||
{
|
||||
if (replaceSpaces)
|
||||
{
|
||||
qualityFormat = ".[{Quality.Title}]";
|
||||
}
|
||||
|
||||
movieFolderFormat += qualityFormat;
|
||||
standardMovieFormat += qualityFormat;
|
||||
}
|
||||
var movieFolderFormat = string.Format("{0}{1}", movieTitlePattern, movieYearPattern);
|
||||
|
||||
|
||||
using (IDbCommand updateCmd = conn.CreateCommand())
|
||||
{
|
||||
|
|
|
@ -160,7 +160,7 @@ namespace NzbDrone.Core.Organizer
|
|||
var tokenHandlers = new Dictionary<string, Func<TokenMatch, string>>(FileNameBuilderTokenEqualityComparer.Instance);
|
||||
|
||||
AddMovieTokens(tokenHandlers, movie);
|
||||
//AddReleaseDateTokens(tokenHandlers, movie.Year); //In case we want to separate the year
|
||||
AddReleaseDateTokens(tokenHandlers, movie.Year); //In case we want to separate the year
|
||||
AddQualityTokens(tokenHandlers, movie, movieFile);
|
||||
AddMediaInfoTokens(tokenHandlers, movieFile);
|
||||
|
||||
|
@ -214,6 +214,8 @@ namespace NzbDrone.Core.Organizer
|
|||
|
||||
public BasicNamingConfig GetBasicNamingConfig(NamingConfig nameSpec)
|
||||
{
|
||||
return new BasicNamingConfig(); //For now let's be lazy
|
||||
|
||||
var episodeFormat = GetEpisodeFormat(nameSpec.StandardEpisodeFormat).LastOrDefault();
|
||||
|
||||
if (episodeFormat == null)
|
||||
|
@ -297,6 +299,7 @@ namespace NzbDrone.Core.Organizer
|
|||
var tokenHandlers = new Dictionary<string, Func<TokenMatch, string>>(FileNameBuilderTokenEqualityComparer.Instance);
|
||||
|
||||
AddMovieTokens(tokenHandlers, movie);
|
||||
AddReleaseDateTokens(tokenHandlers, movie.Year);
|
||||
|
||||
return CleanFolderName(ReplaceTokens(namingConfig.MovieFolderFormat, tokenHandlers, namingConfig));
|
||||
}
|
||||
|
@ -470,7 +473,7 @@ namespace NzbDrone.Core.Organizer
|
|||
|
||||
private void AddReleaseDateTokens(Dictionary<string, Func<TokenMatch, string>> tokenHandlers, int releaseYear)
|
||||
{
|
||||
tokenHandlers["{Release Year}"] = m => string.Format("({0})", releaseYear.ToString()); //Do I need m.CustomFormat?
|
||||
tokenHandlers["{Release Year}"] = m => string.Format("{0}", releaseYear.ToString()); //Do I need m.CustomFormat?
|
||||
}
|
||||
|
||||
private void AddSeasonTokens(Dictionary<string, Func<TokenMatch, string>> tokenHandlers, int seasonNumber)
|
||||
|
|
|
@ -46,7 +46,8 @@ namespace NzbDrone.Core.Organizer
|
|||
|
||||
_movie = new Movie
|
||||
{
|
||||
Title = "Movie Title (2010)"
|
||||
Title = "Movie Title",
|
||||
Year = 2010
|
||||
};
|
||||
|
||||
_standardSeries = new Series
|
||||
|
|
|
@ -26,10 +26,10 @@ var view = Marionette.ItemView.extend({
|
|||
},
|
||||
|
||||
_parseNamingModel : function() {
|
||||
var standardFormat = this.namingModel.get('standardEpisodeFormat');
|
||||
var standardFormat = this.namingModel.get('standardMovieFormat');
|
||||
|
||||
var includeSeriesTitle = standardFormat.match(/\{Series[-_. ]Title\}/i);
|
||||
var includeEpisodeTitle = standardFormat.match(/\{Episode[-_. ]Title\}/i);
|
||||
var includeSeriesTitle = false;//standardFormat.match(/\{Series[-_. ]Title\}/i);
|
||||
var includeEpisodeTitle = false;//standardFormat.match(/\{Episode[-_. ]Title\}/i);
|
||||
var includeQuality = standardFormat.match(/\{Quality[-_. ]Title\}/i);
|
||||
var numberStyle = standardFormat.match(/s?\{season(?:\:0+)?\}[ex]\{episode(?:\:0+)?\}/i);
|
||||
var replaceSpaces = standardFormat.indexOf(' ') === -1;
|
||||
|
@ -115,4 +115,4 @@ var view = Marionette.ItemView.extend({
|
|||
}
|
||||
});
|
||||
|
||||
module.exports = AsModelBoundView.call(view);
|
||||
module.exports = AsModelBoundView.call(view);
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
{{> MovieTitleNamingPartial}}
|
||||
{{!--{{> ReleaseYearNamingPartial}}--}}
|
||||
{{> ReleaseYearNamingPartial}}
|
||||
{{> QualityNamingPartial}}
|
||||
{{> MediaInfoNamingPartial}}
|
||||
{{> ReleaseGroupNamingPartial}}
|
||||
|
@ -160,7 +160,7 @@
|
|||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
{{> MovieTitleNamingPartial}}
|
||||
{{!--{{> ReleaseYearNamingPartial}}--}}
|
||||
{{> ReleaseYearNamingPartial}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue