Fixed: Subtitle extensions should be case-insensitive.

pull/2016/head
Taloth Saldono 8 years ago
parent f46a576df5
commit 905ab18336

@ -104,7 +104,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
return metadata; return metadata;
} }
if (filename.Equals("tvshow.nfo", StringComparison.InvariantCultureIgnoreCase)) if (filename.Equals("tvshow.nfo", StringComparison.OrdinalIgnoreCase))
{ {
metadata.Type = MetadataType.SeriesMetadata; metadata.Type = MetadataType.SeriesMetadata;
return metadata; return metadata;
@ -114,7 +114,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
if (parseResult != null && if (parseResult != null &&
!parseResult.FullSeason && !parseResult.FullSeason &&
Path.GetExtension(filename) == ".nfo") Path.GetExtension(filename).Equals(".nfo", StringComparison.OrdinalIgnoreCase))
{ {
metadata.Type = MetadataType.EpisodeMetadata; metadata.Type = MetadataType.EpisodeMetadata;
return metadata; return metadata;

@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using NLog; using NLog;
@ -65,7 +66,7 @@ namespace NzbDrone.Core.Extras.Others
public override ExtraFile Import(Series series, EpisodeFile episodeFile, string path, string extension, bool readOnly) public override ExtraFile Import(Series series, EpisodeFile episodeFile, string path, string extension, bool readOnly)
{ {
// If the extension is .nfo we need to change it to .nfo-orig // If the extension is .nfo we need to change it to .nfo-orig
if (Path.GetExtension(path).Equals(".nfo")) if (Path.GetExtension(path).Equals(".nfo", StringComparison.OrdinalIgnoreCase))
{ {
extension += "-orig"; extension += "-orig";
} }

@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
namespace NzbDrone.Core.Extras.Subtitles namespace NzbDrone.Core.Extras.Subtitles
{ {
@ -8,7 +9,7 @@ namespace NzbDrone.Core.Extras.Subtitles
static SubtitleFileExtensions() static SubtitleFileExtensions()
{ {
_fileExtensions = new HashSet<string> _fileExtensions = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{ {
".aqt", ".aqt",
".ass", ".ass",

@ -135,7 +135,7 @@ namespace NzbDrone.Core.MediaFiles
var searchOption = allDirectories ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly; var searchOption = allDirectories ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
var filesOnDisk = _diskProvider.GetFiles(path, searchOption).ToList(); var filesOnDisk = _diskProvider.GetFiles(path, searchOption).ToList();
var mediaFileList = filesOnDisk.Where(file => MediaFileExtensions.Extensions.Contains(Path.GetExtension(file).ToLower())) var mediaFileList = filesOnDisk.Where(file => MediaFileExtensions.Extensions.Contains(Path.GetExtension(file)))
.ToList(); .ToList();
_logger.Trace("{0} files were found in {1}", filesOnDisk.Count, path); _logger.Trace("{0} files were found in {1}", filesOnDisk.Count, path);
@ -150,7 +150,7 @@ namespace NzbDrone.Core.MediaFiles
var searchOption = allDirectories ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly; var searchOption = allDirectories ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
var filesOnDisk = _diskProvider.GetFiles(path, searchOption).ToList(); var filesOnDisk = _diskProvider.GetFiles(path, searchOption).ToList();
var mediaFileList = filesOnDisk.Where(file => !MediaFileExtensions.Extensions.Contains(Path.GetExtension(file).ToLower())) var mediaFileList = filesOnDisk.Where(file => !MediaFileExtensions.Extensions.Contains(Path.GetExtension(file)))
.ToList(); .ToList();
_logger.Trace("{0} files were found in {1}", filesOnDisk.Count, path); _logger.Trace("{0} files were found in {1}", filesOnDisk.Count, path);
@ -184,7 +184,7 @@ namespace NzbDrone.Core.MediaFiles
_logger.Warn(ex, "Unable to apply permissions to: " + path); _logger.Warn(ex, "Unable to apply permissions to: " + path);
_logger.Debug(ex, ex.Message); _logger.Debug(ex, ex.Message);
} }
} }
public void Handle(SeriesUpdatedEvent message) public void Handle(SeriesUpdatedEvent message)
{ {
@ -210,4 +210,4 @@ namespace NzbDrone.Core.MediaFiles
} }
} }
} }
} }

@ -1,14 +1,15 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using NLog; using NLog;
using NzbDrone.Common.Disk; using NzbDrone.Common.Disk;
using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Download;
using NzbDrone.Core.MediaFiles.EpisodeImport; using NzbDrone.Core.MediaFiles.EpisodeImport;
using NzbDrone.Core.Parser; using NzbDrone.Core.Parser;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Download;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Tv;
namespace NzbDrone.Core.MediaFiles namespace NzbDrone.Core.MediaFiles
{ {
@ -101,7 +102,7 @@ namespace NzbDrone.Core.MediaFiles
public bool ShouldDeleteFolder(DirectoryInfo directoryInfo, Series series) public bool ShouldDeleteFolder(DirectoryInfo directoryInfo, Series series)
{ {
var videoFiles = _diskScanService.GetVideoFiles(directoryInfo.FullName); var videoFiles = _diskScanService.GetVideoFiles(directoryInfo.FullName);
var rarFiles = _diskProvider.GetFiles(directoryInfo.FullName, SearchOption.AllDirectories).Where(f => Path.GetExtension(f) == ".rar"); var rarFiles = _diskProvider.GetFiles(directoryInfo.FullName, SearchOption.AllDirectories).Where(f => Path.GetExtension(f).Equals(".rar", StringComparison.OrdinalIgnoreCase));
foreach (var videoFile in videoFiles) foreach (var videoFile in videoFiles)
{ {

@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using NzbDrone.Core.Qualities; using NzbDrone.Core.Qualities;
@ -10,7 +11,7 @@ namespace NzbDrone.Core.MediaFiles
static MediaFileExtensions() static MediaFileExtensions()
{ {
_fileExtensions = new Dictionary<string, Quality> _fileExtensions = new Dictionary<string, Quality>(StringComparer.OrdinalIgnoreCase)
{ {
//Unknown //Unknown
{ ".webm", Quality.Unknown }, { ".webm", Quality.Unknown },
@ -70,7 +71,7 @@ namespace NzbDrone.Core.MediaFiles
}; };
} }
public static HashSet<string> Extensions => new HashSet<string>(_fileExtensions.Keys); public static HashSet<string> Extensions => new HashSet<string>(_fileExtensions.Keys, StringComparer.OrdinalIgnoreCase);
public static Quality GetQualityForExtension(string extension) public static Quality GetQualityForExtension(string extension)
{ {

Loading…
Cancel
Save