mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
Media Management settings are alive
This commit is contained in:
parent
943a05bc09
commit
3f6a6d53d5
29 changed files with 346 additions and 218 deletions
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Tv;
|
||||
|
@ -50,25 +51,24 @@ namespace NzbDrone.Core.Organizer
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public class FileNameBuilder : IBuildFileNames
|
||||
{
|
||||
private readonly IConfigService _configService;
|
||||
private readonly INamingConfigService _namingConfigService;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public FileNameBuilder(INamingConfigService namingConfigService, Logger logger)
|
||||
public FileNameBuilder(INamingConfigService namingConfigService, IConfigService configService, Logger logger)
|
||||
{
|
||||
_namingConfigService = namingConfigService;
|
||||
_configService = configService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string BuildFilename(IList<Episode> episodes, Series series, EpisodeFile episodeFile)
|
||||
{
|
||||
var nameSpec = _namingConfigService.GetConfig();
|
||||
|
||||
if (nameSpec.UseSceneName)
|
||||
if (!nameSpec.RenameEpisodes)
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(episodeFile.SceneName))
|
||||
{
|
||||
|
@ -162,13 +162,13 @@ namespace NzbDrone.Core.Organizer
|
|||
|
||||
public string BuildFilePath(Series series, int seasonNumber, string fileName, string extension)
|
||||
{
|
||||
|
||||
var nameSpec = _namingConfigService.GetConfig();
|
||||
|
||||
string path = series.Path;
|
||||
if (series.SeasonFolder)
|
||||
{
|
||||
var seasonFolder = nameSpec.SeasonFolderFormat
|
||||
var seasonFolder = _configService.SeasonFolderFormat
|
||||
.Replace("%sn", series.Title)
|
||||
.Replace("%s.n", series.Title.Replace(' ', '.'))
|
||||
.Replace("%s_n", series.Title.Replace(' ', '_'))
|
||||
.Replace("%0s", seasonNumber.ToString("00"))
|
||||
.Replace("%s", seasonNumber.ToString());
|
||||
|
||||
|
@ -178,7 +178,6 @@ namespace NzbDrone.Core.Organizer
|
|||
return Path.Combine(path, fileName + extension);
|
||||
}
|
||||
|
||||
|
||||
public static string CleanFilename(string name)
|
||||
{
|
||||
string result = name;
|
||||
|
@ -191,7 +190,6 @@ namespace NzbDrone.Core.Organizer
|
|||
return result.Trim();
|
||||
}
|
||||
|
||||
|
||||
private static readonly List<EpisodeSortingType> NumberStyles = new List<EpisodeSortingType>
|
||||
{
|
||||
new EpisodeSortingType
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue