update project targets

This commit is contained in:
Luke Pulverenti
2016-10-30 03:11:37 -04:00
parent f676ea6315
commit 3094cd7ff3
29 changed files with 12206 additions and 307 deletions

View File

@@ -4,6 +4,8 @@ using MediaBrowser.Model.MediaInfo;
using System;
using System.Collections.Generic;
using System.Linq;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.TextEncoding;
namespace MediaBrowser.MediaEncoding.BdInfo
{
@@ -12,6 +14,15 @@ namespace MediaBrowser.MediaEncoding.BdInfo
/// </summary>
public class BdInfoExaminer : IBlurayExaminer
{
private readonly IFileSystem _fileSystem;
private readonly IEncoding _textEncoding;
public BdInfoExaminer(IFileSystem fileSystem, IEncoding textEncoding)
{
_fileSystem = fileSystem;
_textEncoding = textEncoding;
}
/// <summary>
/// Gets the disc info.
/// </summary>
@@ -19,7 +30,7 @@ namespace MediaBrowser.MediaEncoding.BdInfo
/// <returns>BlurayDiscInfo.</returns>
public BlurayDiscInfo GetDiscInfo(string path)
{
var bdrom = new BDROM(path);
var bdrom = new BDROM(path, _fileSystem, _textEncoding);
bdrom.Scan();

View File

@@ -50,7 +50,7 @@ namespace MediaBrowser.MediaEncoding.Configuration
// Validate
if (!_fileSystem.DirectoryExists(newPath))
{
throw new DirectoryNotFoundException(string.Format("{0} does not exist.", newPath));
throw new FileNotFoundException(string.Format("{0} does not exist.", newPath));
}
}
}

View File

@@ -217,7 +217,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
}
try
{
job.TaskCompletionSource.TrySetException(new ApplicationException("Encoding failed"));
job.TaskCompletionSource.TrySetException(new Exception("Encoding failed"));
}
catch
{

View File

@@ -219,7 +219,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
throw new ArgumentNullException("path");
}
if (!File.Exists(path) && !Directory.Exists(path))
if (!FileSystem.FileExists(path) && !FileSystem.DirectoryExists(path))
{
throw new ResourceNotFoundException();
}
@@ -288,12 +288,12 @@ namespace MediaBrowser.MediaEncoding.Encoder
if (!string.IsNullOrWhiteSpace(appPath))
{
if (Directory.Exists(appPath))
if (FileSystem.DirectoryExists(appPath))
{
return GetPathsFromDirectory(appPath);
}
if (File.Exists(appPath))
if (FileSystem.FileExists(appPath))
{
return new Tuple<string, string>(appPath, GetProbePathFromEncoderPath(appPath));
}
@@ -329,16 +329,16 @@ namespace MediaBrowser.MediaEncoding.Encoder
{
// Since we can't predict the file extension, first try directly within the folder
// If that doesn't pan out, then do a recursive search
var files = Directory.GetFiles(path);
var files = FileSystem.GetFilePaths(path);
var excludeExtensions = new[] { ".c" };
var ffmpegPath = files.FirstOrDefault(i => string.Equals(Path.GetFileNameWithoutExtension(i), "ffmpeg", StringComparison.OrdinalIgnoreCase) && !excludeExtensions.Contains(Path.GetExtension(i) ?? string.Empty));
var ffprobePath = files.FirstOrDefault(i => string.Equals(Path.GetFileNameWithoutExtension(i), "ffprobe", StringComparison.OrdinalIgnoreCase) && !excludeExtensions.Contains(Path.GetExtension(i) ?? string.Empty));
if (string.IsNullOrWhiteSpace(ffmpegPath) || !File.Exists(ffmpegPath))
if (string.IsNullOrWhiteSpace(ffmpegPath) || !FileSystem.FileExists(ffmpegPath))
{
files = Directory.GetFiles(path, "*", SearchOption.AllDirectories);
files = FileSystem.GetFilePaths(path, true);
ffmpegPath = files.FirstOrDefault(i => string.Equals(Path.GetFileNameWithoutExtension(i), "ffmpeg", StringComparison.OrdinalIgnoreCase) && !excludeExtensions.Contains(Path.GetExtension(i) ?? string.Empty));
@@ -353,7 +353,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
private string GetProbePathFromEncoderPath(string appPath)
{
return Directory.GetFiles(Path.GetDirectoryName(appPath))
return FileSystem.GetFilePaths(Path.GetDirectoryName(appPath))
.FirstOrDefault(i => string.Equals(Path.GetFileNameWithoutExtension(i), "ffprobe", StringComparison.OrdinalIgnoreCase));
}
@@ -496,7 +496,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
/// <param name="videoType">Type of the video.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{MediaInfoResult}.</returns>
/// <exception cref="System.ApplicationException">ffprobe failed - streams and format are both null.</exception>
private async Task<MediaInfo> GetMediaInfoInternal(string inputPath,
string primaryPath,
MediaProtocol protocol,
@@ -559,7 +558,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
if (result.streams == null && result.format == null)
{
throw new ApplicationException("ffprobe failed - streams and format are both null.");
throw new Exception("ffprobe failed - streams and format are both null.");
}
if (result.streams != null)
@@ -865,7 +864,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
}
var tempExtractPath = Path.Combine(ConfigurationManager.ApplicationPaths.TempDirectory, Guid.NewGuid() + ".jpg");
Directory.CreateDirectory(Path.GetDirectoryName(tempExtractPath));
FileSystem.CreateDirectory(Path.GetDirectoryName(tempExtractPath));
// apply some filters to thumbnail extracted below (below) crop any black lines that we made and get the correct ar then scale to width 600.
// This filter chain may have adverse effects on recorded tv thumbnails if ar changes during presentation ex. commercials @ diff ar
@@ -962,7 +961,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
}
var exitCode = ranToCompletion ? processWrapper.ExitCode ?? 0 : -1;
var file = new FileInfo(tempExtractPath);
var file = FileSystem.GetFileInfo(tempExtractPath);
if (exitCode == -1 || !file.Exists || file.Length == 0)
{
@@ -970,7 +969,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
_logger.Error(msg);
throw new ApplicationException(msg);
throw new Exception(msg);
}
return tempExtractPath;
@@ -1066,7 +1065,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
cancellationToken.ThrowIfCancellationRequested();
var jpegCount = Directory.GetFiles(targetDirectory)
var jpegCount = FileSystem.GetFilePaths(targetDirectory)
.Count(i => string.Equals(Path.GetExtension(i), ".jpg", StringComparison.OrdinalIgnoreCase));
isResponsive = (jpegCount > lastCount);
@@ -1091,7 +1090,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
_logger.Error(msg);
throw new ApplicationException(msg);
throw new Exception(msg);
}
}
}

View File

@@ -105,9 +105,6 @@
<Name>OpenSubtitlesHandler</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Probing\whitelist.txt" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>

View File

@@ -973,27 +973,10 @@ namespace MediaBrowser.MediaEncoding.Probing
{
if (_splitWhiteList == null)
{
var file = GetType().Namespace + ".whitelist.txt";
using (var stream = GetType().Assembly.GetManifestResourceStream(file))
{
using (var reader = new StreamReader(stream))
{
var list = new List<string>();
while (!reader.EndOfStream)
_splitWhiteList = new List<string>
{
var val = reader.ReadLine();
if (!string.IsNullOrWhiteSpace(val))
{
list.Add(val);
}
}
_splitWhiteList = list;
}
}
"AC/DV"
};
}
return _splitWhiteList;

View File

@@ -1 +0,0 @@
AC/DC