parent
745b92daf4
commit
4cb1100704
|
@ -1,12 +0,0 @@
|
||||||
namespace NzbDrone.Core.Organizer
|
|
||||||
{
|
|
||||||
public class BasicNamingConfig
|
|
||||||
{
|
|
||||||
public bool IncludeSeriesTitle { get; set; }
|
|
||||||
public bool IncludeEpisodeTitle { get; set; }
|
|
||||||
public bool IncludeQuality { get; set; }
|
|
||||||
public bool ReplaceSpaces { get; set; }
|
|
||||||
public string Separator { get; set; }
|
|
||||||
public string NumberStyle { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -25,7 +25,6 @@ namespace NzbDrone.Core.Organizer
|
||||||
string BuildFileName(List<Episode> episodes, Series series, EpisodeFile episodeFile, string extension = "", NamingConfig namingConfig = null, List<CustomFormat> customFormats = null);
|
string BuildFileName(List<Episode> episodes, Series series, EpisodeFile episodeFile, string extension = "", NamingConfig namingConfig = null, List<CustomFormat> customFormats = null);
|
||||||
string BuildFilePath(List<Episode> episodes, Series series, EpisodeFile episodeFile, string extension, NamingConfig namingConfig = null, List<CustomFormat> customFormats = null);
|
string BuildFilePath(List<Episode> episodes, Series series, EpisodeFile episodeFile, string extension, NamingConfig namingConfig = null, List<CustomFormat> customFormats = null);
|
||||||
string BuildSeasonPath(Series series, int seasonNumber);
|
string BuildSeasonPath(Series series, int seasonNumber);
|
||||||
BasicNamingConfig GetBasicNamingConfig(NamingConfig nameSpec);
|
|
||||||
string GetSeriesFolder(Series series, NamingConfig namingConfig = null);
|
string GetSeriesFolder(Series series, NamingConfig namingConfig = null);
|
||||||
string GetSeasonFolder(Series series, int seasonNumber, NamingConfig namingConfig = null);
|
string GetSeasonFolder(Series series, int seasonNumber, NamingConfig namingConfig = null);
|
||||||
bool RequiresEpisodeTitle(Series series, List<Episode> episodes);
|
bool RequiresEpisodeTitle(Series series, List<Episode> episodes);
|
||||||
|
@ -253,52 +252,6 @@ namespace NzbDrone.Core.Organizer
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BasicNamingConfig GetBasicNamingConfig(NamingConfig nameSpec)
|
|
||||||
{
|
|
||||||
var episodeFormat = GetEpisodeFormat(nameSpec.StandardEpisodeFormat).LastOrDefault();
|
|
||||||
|
|
||||||
if (episodeFormat == null)
|
|
||||||
{
|
|
||||||
return new BasicNamingConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
var basicNamingConfig = new BasicNamingConfig
|
|
||||||
{
|
|
||||||
Separator = episodeFormat.Separator,
|
|
||||||
NumberStyle = episodeFormat.SeasonEpisodePattern
|
|
||||||
};
|
|
||||||
|
|
||||||
var titleTokens = TitleRegex.Matches(nameSpec.StandardEpisodeFormat);
|
|
||||||
|
|
||||||
foreach (Match match in titleTokens)
|
|
||||||
{
|
|
||||||
var separator = match.Groups["separator"].Value;
|
|
||||||
var token = match.Groups["token"].Value;
|
|
||||||
|
|
||||||
if (!separator.Equals(" "))
|
|
||||||
{
|
|
||||||
basicNamingConfig.ReplaceSpaces = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (token.StartsWith("{Series", StringComparison.InvariantCultureIgnoreCase))
|
|
||||||
{
|
|
||||||
basicNamingConfig.IncludeSeriesTitle = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (token.StartsWith("{Episode", StringComparison.InvariantCultureIgnoreCase))
|
|
||||||
{
|
|
||||||
basicNamingConfig.IncludeEpisodeTitle = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (token.StartsWith("{Quality", StringComparison.InvariantCultureIgnoreCase))
|
|
||||||
{
|
|
||||||
basicNamingConfig.IncludeQuality = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return basicNamingConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetSeriesFolder(Series series, NamingConfig namingConfig = null)
|
public string GetSeriesFolder(Series series, NamingConfig namingConfig = null)
|
||||||
{
|
{
|
||||||
if (namingConfig == null)
|
if (namingConfig == null)
|
||||||
|
|
|
@ -49,12 +49,6 @@ namespace Sonarr.Api.V3.Config
|
||||||
var nameSpec = _namingConfigService.GetConfig();
|
var nameSpec = _namingConfigService.GetConfig();
|
||||||
var resource = nameSpec.ToResource();
|
var resource = nameSpec.ToResource();
|
||||||
|
|
||||||
if (resource.StandardEpisodeFormat.IsNotNullOrWhiteSpace())
|
|
||||||
{
|
|
||||||
var basicConfig = _filenameBuilder.GetBasicNamingConfig(nameSpec);
|
|
||||||
basicConfig.AddToResource(resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,5 @@ namespace Sonarr.Api.V3.Config
|
||||||
public string SeriesFolderFormat { get; set; }
|
public string SeriesFolderFormat { get; set; }
|
||||||
public string SeasonFolderFormat { get; set; }
|
public string SeasonFolderFormat { get; set; }
|
||||||
public string SpecialsFolderFormat { get; set; }
|
public string SpecialsFolderFormat { get; set; }
|
||||||
public bool IncludeSeriesTitle { get; set; }
|
|
||||||
public bool IncludeEpisodeTitle { get; set; }
|
|
||||||
public bool IncludeQuality { get; set; }
|
|
||||||
public bool ReplaceSpaces { get; set; }
|
|
||||||
public string Separator { get; set; }
|
|
||||||
public string NumberStyle { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,26 +32,9 @@ namespace Sonarr.Api.V3.Config
|
||||||
SeriesFolderFormat = model.SeriesFolderFormat,
|
SeriesFolderFormat = model.SeriesFolderFormat,
|
||||||
SeasonFolderFormat = model.SeasonFolderFormat,
|
SeasonFolderFormat = model.SeasonFolderFormat,
|
||||||
SpecialsFolderFormat = model.SpecialsFolderFormat
|
SpecialsFolderFormat = model.SpecialsFolderFormat
|
||||||
|
|
||||||
// IncludeSeriesTitle
|
|
||||||
// IncludeEpisodeTitle
|
|
||||||
// IncludeQuality
|
|
||||||
// ReplaceSpaces
|
|
||||||
// Separator
|
|
||||||
// NumberStyle
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddToResource(this BasicNamingConfig basicNamingConfig, NamingConfigResource resource)
|
|
||||||
{
|
|
||||||
resource.IncludeSeriesTitle = basicNamingConfig.IncludeSeriesTitle;
|
|
||||||
resource.IncludeEpisodeTitle = basicNamingConfig.IncludeEpisodeTitle;
|
|
||||||
resource.IncludeQuality = basicNamingConfig.IncludeQuality;
|
|
||||||
resource.ReplaceSpaces = basicNamingConfig.ReplaceSpaces;
|
|
||||||
resource.Separator = basicNamingConfig.Separator;
|
|
||||||
resource.NumberStyle = basicNamingConfig.NumberStyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static NamingConfig ToModel(this NamingConfigResource resource)
|
public static NamingConfig ToModel(this NamingConfigResource resource)
|
||||||
{
|
{
|
||||||
return new NamingConfig
|
return new NamingConfig
|
||||||
|
|
|
@ -4737,48 +4737,6 @@
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "includeSeriesTitle",
|
|
||||||
"in": "query",
|
|
||||||
"schema": {
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "includeEpisodeTitle",
|
|
||||||
"in": "query",
|
|
||||||
"schema": {
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "includeQuality",
|
|
||||||
"in": "query",
|
|
||||||
"schema": {
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "replaceSpaces",
|
|
||||||
"in": "query",
|
|
||||||
"schema": {
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "separator",
|
|
||||||
"in": "query",
|
|
||||||
"schema": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "numberStyle",
|
|
||||||
"in": "query",
|
|
||||||
"schema": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "id",
|
"name": "id",
|
||||||
"in": "query",
|
"in": "query",
|
||||||
|
@ -9825,26 +9783,6 @@
|
||||||
"specialsFolderFormat": {
|
"specialsFolderFormat": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"nullable": true
|
"nullable": true
|
||||||
},
|
|
||||||
"includeSeriesTitle": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"includeEpisodeTitle": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"includeQuality": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"replaceSpaces": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"separator": {
|
|
||||||
"type": "string",
|
|
||||||
"nullable": true
|
|
||||||
},
|
|
||||||
"numberStyle": {
|
|
||||||
"type": "string",
|
|
||||||
"nullable": true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
|
|
Loading…
Reference in New Issue