diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-02-13 23:00:13 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-02-13 23:00:13 -0500 |
| commit | a4b40ad9d90a40cd5e35bb7b9c43ad436e992cd4 (patch) | |
| tree | 84a697bf606b293c3e74d7757b28d3bb40d1d269 /MediaBrowser.Server.Implementations/Dto/DtoService.cs | |
| parent | 58a46171ababb816636a65aa7f76c00de50f598f (diff) | |
handle year in name when searching
Diffstat (limited to 'MediaBrowser.Server.Implementations/Dto/DtoService.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Dto/DtoService.cs | 46 |
1 files changed, 13 insertions, 33 deletions
diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index 2584fa4f0..ae08a7c3d 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -900,8 +900,16 @@ namespace MediaBrowser.Server.Implementations.Dto if (fields.Contains(ItemFields.Path)) { - dto.Path = item.Path; - dto.MappedPaths = GetMappedPaths(item); + var locationType = item.LocationType; + + if (locationType == LocationType.FileSystem || locationType == LocationType.Offline) + { + dto.Path = GetMappedPath(item.Path); + } + else + { + dto.Path = item.Path; + } } dto.PremiereDate = item.PremiereDate; @@ -1135,39 +1143,11 @@ namespace MediaBrowser.Server.Implementations.Dto } } - private List<string> GetMappedPaths(BaseItem item) - { - var list = new List<string>(); - - var locationType = item.LocationType; - - if (locationType == LocationType.FileSystem || locationType == LocationType.Offline) - { - var path = item.Path; - var mappedPaths = _config.Configuration.PathSubstitutions - .Select(p => GetMappedPath(path, p)) - .Where(p => !string.Equals(p, path, StringComparison.OrdinalIgnoreCase)) - .Distinct(StringComparer.OrdinalIgnoreCase); - - list.AddRange(mappedPaths); - } - - return list; - } - - private string GetMappedPath(string path, PathSubstitution map) + private string GetMappedPath(string path) { - var toValue = map.To ?? string.Empty; - - path = path.Replace(map.From, toValue, StringComparison.OrdinalIgnoreCase); - - if (toValue.IndexOf('/') != -1) - { - path = path.Replace('\\', '/'); - } - else + foreach (var map in _config.Configuration.PathSubstitutions) { - path = path.Replace('/', '\\'); + path = _fileSystem.SubstitutePath(path, map.From, map.To); } return path; |
