fix bdinfo path

This commit is contained in:
Luke Pulverenti 2016-12-24 02:41:25 -05:00
parent d90494f204
commit e265d8efec
3 changed files with 31 additions and 3 deletions

View File

@ -77,6 +77,11 @@ namespace BDInfo
public BDROM( public BDROM(
string path, IFileSystem fileSystem, ITextEncoding textEncoding) string path, IFileSystem fileSystem, ITextEncoding textEncoding)
{ {
if (string.IsNullOrWhiteSpace(path))
{
throw new ArgumentNullException("path");
}
_fileSystem = fileSystem; _fileSystem = fileSystem;
// //
// Locate BDMV directories. // Locate BDMV directories.
@ -326,15 +331,28 @@ namespace BDInfo
private FileSystemMetadata GetDirectoryBDMV( private FileSystemMetadata GetDirectoryBDMV(
string path) string path)
{ {
if (string.IsNullOrWhiteSpace(path))
{
throw new ArgumentNullException("path");
}
FileSystemMetadata dir = _fileSystem.GetDirectoryInfo(path); FileSystemMetadata dir = _fileSystem.GetDirectoryInfo(path);
while (dir != null) while (dir != null)
{ {
if (dir.Name == "BDMV") if (string.Equals(dir.Name, "BDMV", StringComparison.OrdinalIgnoreCase))
{ {
return dir; return dir;
} }
dir = _fileSystem.GetDirectoryInfo(Path.GetDirectoryName(dir.FullName)); var parentFolder = Path.GetDirectoryName(dir.FullName);
if (string.IsNullOrEmpty(parentFolder))
{
dir = null;
}
else
{
dir = _fileSystem.GetDirectoryInfo(parentFolder);
}
} }
return GetDirectory("BDMV", _fileSystem.GetDirectoryInfo(path), 0); return GetDirectory("BDMV", _fileSystem.GetDirectoryInfo(path), 0);
@ -350,7 +368,7 @@ namespace BDInfo
FileSystemMetadata[] children = _fileSystem.GetDirectories(dir.FullName).ToArray(); FileSystemMetadata[] children = _fileSystem.GetDirectories(dir.FullName).ToArray();
foreach (FileSystemMetadata child in children) foreach (FileSystemMetadata child in children)
{ {
if (child.Name == name) if (string.Equals(child.Name, name, StringComparison.OrdinalIgnoreCase))
{ {
return child; return child;
} }

View File

@ -30,6 +30,11 @@ namespace MediaBrowser.MediaEncoding.BdInfo
/// <returns>BlurayDiscInfo.</returns> /// <returns>BlurayDiscInfo.</returns>
public BlurayDiscInfo GetDiscInfo(string path) public BlurayDiscInfo GetDiscInfo(string path)
{ {
if (string.IsNullOrWhiteSpace(path))
{
throw new ArgumentNullException("path");
}
var bdrom = new BDROM(path, _fileSystem, _textEncoding); var bdrom = new BDROM(path, _fileSystem, _textEncoding);
bdrom.Scan(); bdrom.Scan();

View File

@ -328,6 +328,11 @@ namespace MediaBrowser.Providers.MediaInfo
/// <returns>VideoStream.</returns> /// <returns>VideoStream.</returns>
private BlurayDiscInfo GetBDInfo(string path) private BlurayDiscInfo GetBDInfo(string path)
{ {
if (string.IsNullOrWhiteSpace(path))
{
throw new ArgumentNullException("path");
}
try try
{ {
return _blurayExaminer.GetDiscInfo(path); return _blurayExaminer.GetDiscInfo(path);