The Free Software Media System - Server Backend & API
fix merge conflicts
Luke Pulverentie8010955dc10
diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.csindex 4710378017..efc8087387 100644--- a/Emby.Drawing/ImageProcessor.cs+++ b/Emby.Drawing/ImageProcessor.cs@@ -1,4 +1,5 @@-using MediaBrowser.Common.Extensions;+using Emby.Drawing.Common;+using MediaBrowser.Common.Extensions;using MediaBrowser.Common.IO;using MediaBrowser.Controller;using MediaBrowser.Controller.Drawing;@@ -16,7 +17,6 @@ using System.IO;using System.Linq;using System.Threading;using System.Threading.Tasks;-using Emby.Drawing.Common;namespace Emby.Drawing{@@ -215,12 +215,12 @@ namespace Emby.Drawing{CheckDisposed();- if (!_fileSystem.FileExists(cacheFilePath))+ if (!File.Exists(cacheFilePath)){var newWidth = Convert.ToInt32(newSize.Width);var newHeight = Convert.ToInt32(newSize.Height);- _fileSystem.CreateDirectory(Path.GetDirectoryName(cacheFilePath));+ Directory.CreateDirectory(Path.GetDirectoryName(cacheFilePath));await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false);@@ -270,7 +270,7 @@ namespace Emby.Drawingawait semaphore.WaitAsync().ConfigureAwait(false);// Check again in case of contention- if (_fileSystem.FileExists(croppedImagePath))+ if (File.Exists(croppedImagePath)){semaphore.Release();return GetResult(croppedImagePath);@@ -280,7 +280,7 @@ namespace Emby.Drawingtry{- _fileSystem.CreateDirectory(Path.GetDirectoryName(croppedImagePath));+ Directory.CreateDirectory(Path.GetDirectoryName(croppedImagePath));await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false);imageProcessingLockTaken = true;@@ -366,7 +366,7 @@ namespace Emby.Drawing/// <returns>ImageSize.</returns>public ImageSize GetImageSize(string path){- return GetImageSize(path, _fileSystem.GetLastWriteTimeUtc(path), false);+ return GetImageSize(path, File.GetLastWriteTimeUtc(path), false);}public ImageSize GetImageSize(ItemImageInfo info)@@ -399,8 +399,6 @@ namespace Emby.Drawing{size = GetImageSizeInternal(path, allowSlowMethod);- StartSaveImageSizeTimer();-_cachedImagedSizes.AddOrUpdate(cacheHash, size, (keyName, oldValue) => size);}@@ -415,26 +413,28 @@ namespace Emby.Drawing/// <returns>ImageSize.</returns>private ImageSize GetImageSizeInternal(string path, bool allowSlowMethod){+ ImageSize size;+try{- using (var file = TagLib.File.Create(path))- {- var image = file as TagLib.Image.File;-- var properties = image.Properties;-- return new ImageSize- {- Height = properties.PhotoHeight,- Width = properties.PhotoWidth- };- }+ size = ImageHeader.GetDimensions(path, _logger, _fileSystem);}catch{+ if (!allowSlowMethod)+ {+ throw;+ }+ //_logger.Info("Failed to read image header for {0}. Doing it the slow way.", path);++ CheckDisposed();++ size = _imageEncoder.GetImageSize(path);}- return ImageHeader.GetDimensions(path, _logger, _fileSystem);+ StartSaveImageSizeTimer();++ return size;}private readonly Timer _saveImageSizeTimer;@@ -452,7 +452,7 @@ namespace Emby.Drawingtry{var path = ImageSizeFile;- _fileSystem.CreateDirectory(Path.GetDirectoryName(path));+ Directory.CreateDirectory(Path.GetDirectoryName(path));_jsonSerializer.SerializeToFile(_cachedImagedSizes, path);}catch (Exception ex)@@ -624,7 +624,7 @@ namespace Emby.Drawingawait semaphore.WaitAsync().ConfigureAwait(false);// Check again in case of contention- if (_fileSystem.FileExists(enhancedImagePath))+ if (File.Exists(enhancedImagePath)){semaphore.Release();return enhancedImagePath;@@ -634,7 +634,7 @@ namespace Emby.Drawingtry{- _fileSystem.CreateDirectory(Path.GetDirectoryName(enhancedImagePath));+ Directory.CreateDirectory(Path.GetDirectoryName(enhancedImagePath));await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false);@@ -819,4 +819,4 @@ namespace Emby.Drawing}}}-}+}\ No newline at end of filediff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.csindex 036397b4f5..ca5cf51114 100644--- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs+++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs@@ -23,7 +23,8 @@ namespace MediaBrowser.Api.Playback.Hls/// </summary>public abstract class BaseHlsService : BaseStreamingService{- protected BaseHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer)+ protected BaseHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer)+ : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer){}@@ -90,12 +91,12 @@ namespace MediaBrowser.Api.Playback.HlsTranscodingJob job = null;var playlist = state.OutputFilePath;- if (!FileSystem.FileExists(playlist))+ if (!File.Exists(playlist)){await ApiEntryPoint.Instance.TranscodingStartLock.WaitAsync(cancellationTokenSource.Token).ConfigureAwait(false);try{- if (!FileSystem.FileExists(playlist))+ if (!File.Exists(playlist)){// If the playlist doesn't already exist, startup ffmpegtry@@ -150,7 +151,7 @@ namespace MediaBrowser.Api.Playback.Hls{ApiEntryPoint.Instance.OnTranscodeEndRequest(job);}-+return ResultFactory.GetResult(playlistText, MimeTypes.GetMimeType("playlist.m3u8"), new Dictionary<string, string>());}@@ -317,4 +318,4 @@ namespace MediaBrowser.Api.Playback.Hlsreturn false;}}-}+}\ No newline at end of filediff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.csindex 9359c65f26..120ec6c0e0 100644--- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs+++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs@@ -165,7 +165,7 @@ namespace MediaBrowser.Api.Playback.HlsTranscodingJob job = null;- if (FileSystem.FileExists(segmentPath))+ if (File.Exists(segmentPath)){job = ApiEntryPoint.Instance.OnTranscodeBeginRequest(playlistPath, TranscodingJobType);return await GetSegmentResult(state, playlistPath, segmentPath, requestedIndex, job, cancellationToken).ConfigureAwait(false);@@ -174,7 +174,7 @@ namespace MediaBrowser.Api.Playback.Hlsawait ApiEntryPoint.Instance.TranscodingStartLock.WaitAsync(cancellationTokenSource.Token).ConfigureAwait(false);try{- if (FileSystem.FileExists(segmentPath))+ if (File.Exists(segmentPath)){job = ApiEntryPoint.Instance.OnTranscodeBeginRequest(playlistPath, TranscodingJobType);return await GetSegmentResult(state, playlistPath, segmentPath, requestedIndex, job, cancellationToken).ConfigureAwait(false);@@ -386,7 +386,8 @@ namespace MediaBrowser.Api.Playback.Hlstry{- return fileSystem.GetFiles(folder)+ return new DirectoryInfo(folder)+ .EnumerateFiles("*", SearchOption.TopDirectoryOnly).Where(i => string.Equals(i.Extension, segmentExtension, StringComparison.OrdinalIgnoreCase) && Path.GetFileNameWithoutExtension(i.Name).StartsWith(filePrefix, StringComparison.OrdinalIgnoreCase)).OrderByDescending(fileSystem.GetLastWriteTimeUtc).FirstOrDefault();@@ -431,7 +432,7 @@ namespace MediaBrowser.Api.Playback.HlsCancellationToken cancellationToken){// If all transcoding has completed, just return immediately- if (transcodingJob != null && transcodingJob.HasExited && FileSystem.FileExists(segmentPath))+ if (transcodingJob != null && transcodingJob.HasExited && File.Exists(segmentPath)){return GetSegmentResult(state, segmentPath, segmentIndex, transcodingJob);}@@ -451,7 +452,7 @@ namespace MediaBrowser.Api.Playback.Hls// If it appears in the playlist, it's doneif (text.IndexOf(segmentFilename, StringComparison.OrdinalIgnoreCase) != -1){- if (FileSystem.FileExists(segmentPath))+ if (File.Exists(segmentPath)){return GetSegmentResult(state, segmentPath, segmentIndex, transcodingJob);}@@ -988,4 +989,4 @@ namespace MediaBrowser.Api.Playback.Hlsreturn base.CanStreamCopyVideo(request, videoStream);}}-}+}\ No newline at end of filediff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.csindex 98d1eb4ce2..8cd0a8def8 100644--- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs+++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs@@ -140,4 +140,4 @@ namespace MediaBrowser.Controller.Entities.Audioreturn id;}}-}+}\ No newline at end of filediff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.csindex 3785924431..551ca2305c 100644--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs@@ -44,6 +44,12 @@ namespace MediaBrowser.Model.Configuration/// <value><c>true</c> if [use HTTPS]; otherwise, <c>false</c>.</value>public bool EnableHttps { get; set; }+ /// <summary>+ /// Gets or sets a value indicating whether [enable user specific user views].+ /// </summary>+ /// <value><c>true</c> if [enable user specific user views]; otherwise, <c>false</c>.</value>+ public bool EnableUserSpecificUserViews { get; set; }+/// <summary>/// Gets or sets the value pointing to the file system where the ssl certiifcate is located../// </summary>@@ -98,12 +104,6 @@ namespace MediaBrowser.Model.Configuration/// <value><c>true</c> if [disable startup scan]; otherwise, <c>false</c>.</value>public bool DisableStartupScan { get; set; }- /// <summary>- /// Gets or sets a value indicating whether [enable user views].- /// </summary>- /// <value><c>true</c> if [enable user views]; otherwise, <c>false</c>.</value>- public bool EnableUserViews { get; set; }-/// <summary>/// Gets or sets a value indicating whether [enable library metadata sub folder]./// </summary>@@ -223,7 +223,7 @@ namespace MediaBrowser.Model.Configurationpublic bool EnableWindowsShortcuts { get; set; }public bool EnableVideoFrameByFrameAnalysis { get; set; }-+/// <summary>/// Initializes a new instance of the <see cref="ServerConfiguration" /> class./// </summary>@@ -274,7 +274,11 @@ namespace MediaBrowser.Model.ConfigurationInsecureApps9 = new[]{+ "Chromecast",+ "iOS","Unknown app",+ "iPad",+ "iPhone","Windows Phone"};@@ -577,4 +581,4 @@ namespace MediaBrowser.Model.Configuration};}}-}+}\ No newline at end of filediff --git a/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs b/MediaBrowser.Server.Implementations/Devices/DeviceManager.csindex a6a8b3a7a1..0feacc9751 100644--- a/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs+++ b/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs@@ -157,7 +157,7 @@ namespace MediaBrowser.Server.Implementations.Devices_libraryMonitor.ReportFileSystemChangeBeginning(path);- _fileSystem.CreateDirectory(Path.GetDirectoryName(path));+ Directory.CreateDirectory(Path.GetDirectoryName(path));try{@@ -290,4 +290,4 @@ namespace MediaBrowser.Server.Implementations.Devicesreturn config.GetConfiguration<DevicesOptions>("devices");}}-}+}\ No newline at end of filediff --git a/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs b/MediaBrowser.Server.Implementations/Library/MediaSourceManager.csindex a348c728e4..3da7e20212 100644--- a/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs+++ b/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs@@ -15,7 +15,6 @@ using System.IO;using System.Linq;using System.Threading;using System.Threading.Tasks;-using MediaBrowser.Common.IO;namespace MediaBrowser.Server.Implementations.Library{@@ -25,19 +24,17 @@ namespace MediaBrowser.Server.Implementations.Libraryprivate readonly IUserManager _userManager;private readonly ILibraryManager _libraryManager;private readonly IJsonSerializer _jsonSerializer;- private readonly IFileSystem _fileSystem;private IMediaSourceProvider[] _providers;private readonly ILogger _logger;- public MediaSourceManager(IItemRepository itemRepo, IUserManager userManager, ILibraryManager libraryManager, ILogger logger, IJsonSerializer jsonSerializer, IFileSystem fileSystem)+ public MediaSourceManager(IItemRepository itemRepo, IUserManager userManager, ILibraryManager libraryManager, ILogger logger, IJsonSerializer jsonSerializer){_itemRepo = itemRepo;_userManager = userManager;_libraryManager = libraryManager;_logger = logger;_jsonSerializer = jsonSerializer;- _fileSystem = fileSystem;}public void AddParts(IEnumerable<IMediaSourceProvider> providers)@@ -173,7 +170,7 @@ namespace MediaBrowser.Server.Implementations.Libraryif (source.Protocol == MediaProtocol.File){// TODO: Path substitution- if (!_fileSystem.FileExists(source.Path))+ if (!File.Exists(source.Path)){source.SupportsDirectStream = false;}@@ -585,4 +582,4 @@ namespace MediaBrowser.Server.Implementations.Librarypublic MediaSourceInfo MediaSource;}}-}+}\ No newline at end of file