From 36f8eb1149e821de46b1ee15dcd1990c6a378ca9 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 17 Feb 2017 16:11:13 -0500 Subject: [PATCH] add db startup error handling --- Emby.Server.Core/ApplicationHost.cs | 2 +- .../Library/LibraryManager.cs | 24 -- .../Library/UserViewManager.cs | 9 +- .../LiveTv/EmbyTV/EmbyTV.cs | 2 +- .../LiveTv/EmbyTV/EncodedRecorder.cs | 2 +- .../LiveTv/LiveStreamHelper.cs | 13 +- .../LiveTv/LiveTvMediaSourceProvider.cs | 4 +- .../SqliteNotificationsRepository.cs | 22 +- MediaBrowser.Api/MediaBrowser.Api.csproj | 1 + .../Playback/BaseStreamingService.cs | 20 +- .../Playback/Hls/DynamicHlsService.cs | 3 - MediaBrowser.Api/Playback/MediaInfoService.cs | 11 +- .../Playback/Progressive/AudioService.cs | 2 - MediaBrowser.Api/Playback/StreamRequest.cs | 3 + .../Playback/UniversalAudioService.cs | 248 ++++++++++++++++++ .../Library/ILibraryManager.cs | 2 - 16 files changed, 307 insertions(+), 61 deletions(-) create mode 100644 MediaBrowser.Api/Playback/UniversalAudioService.cs diff --git a/Emby.Server.Core/ApplicationHost.cs b/Emby.Server.Core/ApplicationHost.cs index a3c228a58c..2163c4e478 100644 --- a/Emby.Server.Core/ApplicationHost.cs +++ b/Emby.Server.Core/ApplicationHost.cs @@ -863,7 +863,7 @@ namespace Emby.Server.Core /// private void ConfigureNotificationsRepository() { - var repo = new SqliteNotificationsRepository(LogManager.GetLogger("SqliteNotificationsRepository"), ServerConfigurationManager.ApplicationPaths); + var repo = new SqliteNotificationsRepository(LogManager.GetLogger("SqliteNotificationsRepository"), ServerConfigurationManager.ApplicationPaths, FileSystemManager); repo.Initialize(); diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 616c6c1a2c..879735ccbe 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -818,30 +818,6 @@ namespace Emby.Server.Implementations.Library return _userRootFolder; } - public Guid? FindIdByPath(string path, bool? isFolder) - { - // If this returns multiple items it could be tricky figuring out which one is correct. - // In most cases, the newest one will be and the others obsolete but not yet cleaned up - - var query = new InternalItemsQuery - { - Path = path, - IsFolder = isFolder, - SortBy = new[] { ItemSortBy.DateCreated }, - SortOrder = SortOrder.Descending, - Limit = 1 - }; - - var id = GetItemIds(query); - - if (id.Count == 0) - { - return null; - } - - return id[0]; - } - public BaseItem FindByPath(string path, bool? isFolder) { // If this returns multiple items it could be tricky figuring out which one is correct. diff --git a/Emby.Server.Implementations/Library/UserViewManager.cs b/Emby.Server.Implementations/Library/UserViewManager.cs index f11cbd4987..9e1291847e 100644 --- a/Emby.Server.Implementations/Library/UserViewManager.cs +++ b/Emby.Server.Implementations/Library/UserViewManager.cs @@ -248,6 +248,13 @@ namespace Emby.Server.Implementations.Library } } + var isPlayed = request.IsPlayed; + + if (parents.OfType().Any(i => string.Equals(i.CollectionType, CollectionType.Music, StringComparison.OrdinalIgnoreCase))) + { + isPlayed = null; + } + if (parents.Count == 0) { parents = user.RootFolder.GetChildren(user, true) @@ -282,7 +289,7 @@ namespace Emby.Server.Implementations.Library IsVirtualItem = false, Limit = limit * 5, SourceTypes = parents.Count == 0 ? new[] { SourceType.Library } : new SourceType[] { }, - IsPlayed = request.IsPlayed + IsPlayed = isPlayed }, parents); } diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index bbb0602034..7aae0d68a5 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -1172,7 +1172,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV }; var isAudio = false; - await new LiveStreamHelper(_mediaEncoder, _logger).AddMediaInfoWithProbe(stream, isAudio, false, cancellationToken).ConfigureAwait(false); + await new LiveStreamHelper(_mediaEncoder, _logger).AddMediaInfoWithProbe(stream, isAudio, cancellationToken).ConfigureAwait(false); return new List { diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs index 68126f9263..5adb0b3c67 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs @@ -260,7 +260,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV { _logger.Info("Calling recording process.WaitForExit for {0}", _targetPath); - if (_process.WaitForExit(5000)) + if (_process.WaitForExit(10000)) { return; } diff --git a/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs b/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs index 2ee6869f68..e2f9736995 100644 --- a/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs +++ b/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs @@ -22,7 +22,7 @@ namespace Emby.Server.Implementations.LiveTv _logger = logger; } - public async Task AddMediaInfoWithProbe(MediaSourceInfo mediaSource, bool isAudio, bool assumeInterlaced, CancellationToken cancellationToken) + public async Task AddMediaInfoWithProbe(MediaSourceInfo mediaSource, bool isAudio, CancellationToken cancellationToken) { var originalRuntime = mediaSource.RunTimeTicks; @@ -96,17 +96,6 @@ namespace Emby.Server.Implementations.LiveTv videoStream.IsAVC = null; } - if (assumeInterlaced) - { - foreach (var mediaStream in mediaSource.MediaStreams) - { - if (mediaStream.Type == MediaStreamType.Video) - { - mediaStream.IsInterlaced = true; - } - } - } - // Try to estimate this mediaSource.InferTotalBitrate(true); } diff --git a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs index e25e284849..747e0fdd31 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs @@ -126,14 +126,12 @@ namespace Emby.Server.Implementations.LiveTv var keys = openToken.Split(new[] { StreamIdDelimeter }, 3); var mediaSourceId = keys.Length >= 3 ? keys[2] : null; IDirectStreamProvider directStreamProvider = null; - var assumeInterlaced = false; if (string.Equals(keys[0], typeof(LiveTvChannel).Name, StringComparison.OrdinalIgnoreCase)) { var info = await _liveTvManager.GetChannelStream(keys[1], mediaSourceId, cancellationToken).ConfigureAwait(false); stream = info.Item1; directStreamProvider = info.Item2; - assumeInterlaced = info.Item3; } else { @@ -148,7 +146,7 @@ namespace Emby.Server.Implementations.LiveTv } else { - await new LiveStreamHelper(_mediaEncoder, _logger).AddMediaInfoWithProbe(stream, isAudio, assumeInterlaced, cancellationToken).ConfigureAwait(false); + await new LiveStreamHelper(_mediaEncoder, _logger).AddMediaInfoWithProbe(stream, isAudio, cancellationToken).ConfigureAwait(false); } } catch (Exception ex) diff --git a/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs b/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs index f18278cb25..76c7a7d77c 100644 --- a/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs +++ b/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using Emby.Server.Implementations.Data; using MediaBrowser.Controller; using MediaBrowser.Controller.Notifications; +using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Notifications; using SQLitePCL.pretty; @@ -16,8 +17,11 @@ namespace Emby.Server.Implementations.Notifications { public class SqliteNotificationsRepository : BaseSqliteRepository, INotificationsRepository { - public SqliteNotificationsRepository(ILogger logger, IServerApplicationPaths appPaths) : base(logger) + protected IFileSystem FileSystem { get; private set; } + + public SqliteNotificationsRepository(ILogger logger, IServerApplicationPaths appPaths, IFileSystem fileSystem) : base(logger) { + FileSystem = fileSystem; DbFilePath = Path.Combine(appPaths.DataPath, "notifications.db"); } @@ -26,6 +30,22 @@ namespace Emby.Server.Implementations.Notifications ////public event EventHandler NotificationUpdated; public void Initialize() + { + try + { + InitializeInternal(); + } + catch (Exception ex) + { + Logger.ErrorException("Error loading notifications database file. Will reset and retry.", ex); + + FileSystem.DeleteFile(DbFilePath); + + InitializeInternal(); + } + } + + private void InitializeInternal() { using (var connection = CreateConnection()) { diff --git a/MediaBrowser.Api/MediaBrowser.Api.csproj b/MediaBrowser.Api/MediaBrowser.Api.csproj index 7be04d8926..db5914f81d 100644 --- a/MediaBrowser.Api/MediaBrowser.Api.csproj +++ b/MediaBrowser.Api/MediaBrowser.Api.csproj @@ -59,6 +59,7 @@ + diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index d1c3de427d..e561b3f467 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -126,14 +126,10 @@ namespace MediaBrowser.Api.Playback /// /// Gets the output file path. /// - /// The state. - /// System.String. - private string GetOutputFilePath(StreamState state) + private string GetOutputFilePath(StreamState state, string outputFileExtension) { var folder = ServerConfigurationManager.ApplicationPaths.TranscodingTempPath; - var outputFileExtension = GetOutputFileExtension(state); - var data = GetCommandLineArguments("dummy\\dummy", state, false); data += "-" + (state.Request.DeviceId ?? string.Empty); @@ -802,7 +798,7 @@ namespace MediaBrowser.Api.Playback { state.User = UserManager.GetUserById(auth.UserId); } - + //if ((Request.UserAgent ?? string.Empty).IndexOf("iphone", StringComparison.OrdinalIgnoreCase) != -1 || // (Request.UserAgent ?? string.Empty).IndexOf("ipad", StringComparison.OrdinalIgnoreCase) != -1 || // (Request.UserAgent ?? string.Empty).IndexOf("ipod", StringComparison.OrdinalIgnoreCase) != -1) @@ -876,11 +872,16 @@ namespace MediaBrowser.Api.Playback var container = Path.GetExtension(state.RequestedUrl); + if (string.IsNullOrEmpty(container)) + { + container = request.Container; + } + if (string.IsNullOrEmpty(container)) { container = request.Static ? state.InputContainer : - (Path.GetExtension(GetOutputFilePath(state)) ?? string.Empty).TrimStart('.'); + GetOutputFileExtension(state); } state.OutputContainer = (container ?? string.Empty).TrimStart('.'); @@ -923,7 +924,10 @@ namespace MediaBrowser.Api.Playback ApplyDeviceProfileSettings(state); } - state.OutputFilePath = GetOutputFilePath(state); + var ext = string.IsNullOrWhiteSpace(state.OutputContainer) + ? GetOutputFileExtension(state) + : ("." + state.OutputContainer); + state.OutputFilePath = GetOutputFilePath(state, ext); return state; } diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs index cfd7471c4f..1074a8bc18 100644 --- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs @@ -18,9 +18,6 @@ using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.IO; -using MediaBrowser.Model.IO; using MediaBrowser.Model.Services; using MimeTypes = MediaBrowser.Model.Net.MimeTypes; diff --git a/MediaBrowser.Api/Playback/MediaInfoService.cs b/MediaBrowser.Api/Playback/MediaInfoService.cs index fcb8c34f3e..80885271c2 100644 --- a/MediaBrowser.Api/Playback/MediaInfoService.cs +++ b/MediaBrowser.Api/Playback/MediaInfoService.cs @@ -146,7 +146,7 @@ namespace MediaBrowser.Api.Playback Task.WaitAll(task); } - public async Task Post(GetPostedPlaybackInfo request) + public async Task GetPlaybackInfo(GetPostedPlaybackInfo request) { var authInfo = _authContext.GetAuthorizationInfo(Request); @@ -172,7 +172,14 @@ namespace MediaBrowser.Api.Playback SetDeviceSpecificData(request.Id, info, profile, authInfo, request.MaxStreamingBitrate ?? profile.MaxStreamingBitrate, request.StartTimeTicks ?? 0, mediaSourceId, request.AudioStreamIndex, request.SubtitleStreamIndex, request.MaxAudioChannels, request.UserId); } - return ToOptimizedResult(info); + return info; + } + + public async Task Post(GetPostedPlaybackInfo request) + { + var result = await GetPlaybackInfo(request).ConfigureAwait(false); + + return ToOptimizedResult(result); } private T Clone(T obj) diff --git a/MediaBrowser.Api/Playback/Progressive/AudioService.cs b/MediaBrowser.Api/Playback/Progressive/AudioService.cs index a0ab906646..04825c7a57 100644 --- a/MediaBrowser.Api/Playback/Progressive/AudioService.cs +++ b/MediaBrowser.Api/Playback/Progressive/AudioService.cs @@ -26,8 +26,6 @@ namespace MediaBrowser.Api.Playback.Progressive [Route("/Audio/{Id}/stream", "HEAD", Summary = "Gets an audio stream")] public class GetAudioStream : StreamRequest { - [ApiMember(Name = "Container", Description = "Container", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] - public string Container { get; set; } } /// diff --git a/MediaBrowser.Api/Playback/StreamRequest.cs b/MediaBrowser.Api/Playback/StreamRequest.cs index 6bdb30890e..f223c99efa 100644 --- a/MediaBrowser.Api/Playback/StreamRequest.cs +++ b/MediaBrowser.Api/Playback/StreamRequest.cs @@ -22,6 +22,9 @@ namespace MediaBrowser.Api.Playback [ApiMember(Name = "DeviceId", Description = "The device id of the client requesting. Used to stop encoding processes when needed.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public string DeviceId { get; set; } + [ApiMember(Name = "Container", Description = "Container", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] + public string Container { get; set; } + /// /// Gets or sets the audio codec. /// diff --git a/MediaBrowser.Api/Playback/UniversalAudioService.cs b/MediaBrowser.Api/Playback/UniversalAudioService.cs new file mode 100644 index 0000000000..a52ae1df4c --- /dev/null +++ b/MediaBrowser.Api/Playback/UniversalAudioService.cs @@ -0,0 +1,248 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using MediaBrowser.Api.Playback.Hls; +using MediaBrowser.Api.Playback.Progressive; +using MediaBrowser.Common.Net; +using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Devices; +using MediaBrowser.Controller.Dlna; +using MediaBrowser.Controller.Drawing; +using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.MediaEncoding; +using MediaBrowser.Controller.Net; +using MediaBrowser.Model.Dlna; +using MediaBrowser.Model.IO; +using MediaBrowser.Model.MediaInfo; +using MediaBrowser.Model.Serialization; +using MediaBrowser.Model.Services; + +namespace MediaBrowser.Api.Playback +{ + public class BaseUniversalRequest + { + /// + /// Gets or sets the id. + /// + /// The id. + [ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] + public string Id { get; set; } + + [ApiMember(Name = "MediaSourceId", Description = "The media version id, if playing an alternate version", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] + public string MediaSourceId { get; set; } + + [ApiMember(Name = "DeviceId", Description = "The device id of the client requesting. Used to stop encoding processes when needed.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] + public string DeviceId { get; set; } + + public string Token { get; set; } + + public string UserId { get; set; } + public string AudioCodec { get; set; } + public string Container { get; set; } + + public int? MaxAudioChannels { get; set; } + + public long? MaxStreamingBitrate { get; set; } + + [ApiMember(Name = "StartTimeTicks", Description = "Optional. Specify a starting offset, in ticks. 1 tick = 10000 ms", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] + public long? StartTimeTicks { get; set; } + } + + [Route("/Audio/{Id}/universal.{Container}", "GET", Summary = "Gets an audio stream")] + [Route("/Audio/{Id}/universal", "GET", Summary = "Gets an audio stream")] + [Route("/Audio/{Id}/universal.{Container}", "HEAD", Summary = "Gets an audio stream")] + [Route("/Audio/{Id}/universal", "HEAD", Summary = "Gets an audio stream")] + public class GetUniversalAudioStream : BaseUniversalRequest + { + } + + //[Authenticated] + public class UniversalAudioService : BaseApiService + { + public UniversalAudioService(IServerConfigurationManager serverConfigurationManager, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, IDeviceManager deviceManager, ISubtitleEncoder subtitleEncoder, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, IAuthorizationContext authorizationContext, IImageProcessor imageProcessor, INetworkManager networkManager) + { + ServerConfigurationManager = serverConfigurationManager; + UserManager = userManager; + LibraryManager = libraryManager; + IsoManager = isoManager; + MediaEncoder = mediaEncoder; + FileSystem = fileSystem; + DlnaManager = dlnaManager; + DeviceManager = deviceManager; + SubtitleEncoder = subtitleEncoder; + MediaSourceManager = mediaSourceManager; + ZipClient = zipClient; + JsonSerializer = jsonSerializer; + AuthorizationContext = authorizationContext; + ImageProcessor = imageProcessor; + NetworkManager = networkManager; + } + + protected IServerConfigurationManager ServerConfigurationManager { get; private set; } + protected IUserManager UserManager { get; private set; } + protected ILibraryManager LibraryManager { get; private set; } + protected IIsoManager IsoManager { get; private set; } + protected IMediaEncoder MediaEncoder { get; private set; } + protected IFileSystem FileSystem { get; private set; } + protected IDlnaManager DlnaManager { get; private set; } + protected IDeviceManager DeviceManager { get; private set; } + protected ISubtitleEncoder SubtitleEncoder { get; private set; } + protected IMediaSourceManager MediaSourceManager { get; private set; } + protected IZipClient ZipClient { get; private set; } + protected IJsonSerializer JsonSerializer { get; private set; } + protected IAuthorizationContext AuthorizationContext { get; private set; } + protected IImageProcessor ImageProcessor { get; private set; } + protected INetworkManager NetworkManager { get; private set; } + + public Task Get(GetUniversalAudioStream request) + { + return GetUniversalStream(request, false); + } + + public Task Head(GetUniversalAudioStream request) + { + return GetUniversalStream(request, true); + } + + private DeviceProfile GetDeviceProfile(GetUniversalAudioStream request) + { + var deviceProfile = new DeviceProfile(); + + var directPlayProfiles = new List(); + + directPlayProfiles.Add(new DirectPlayProfile + { + Type = DlnaProfileType.Audio, + Container = request.Container + }); + + deviceProfile.DirectPlayProfiles = directPlayProfiles.ToArray(); + + deviceProfile.TranscodingProfiles = new[] + { + new TranscodingProfile + { + Type = DlnaProfileType.Audio, + Context = EncodingContext.Streaming, + Container = "ts", + AudioCodec = "aac", + Protocol = "hls" + } + }; + + return deviceProfile; + } + + private async Task GetUniversalStream(GetUniversalAudioStream request, bool isHeadRequest) + { + var deviceProfile = GetDeviceProfile(request); + + AuthorizationContext.GetAuthorizationInfo(Request).DeviceId = request.DeviceId; + + var mediaInfoService = new MediaInfoService(MediaSourceManager, DeviceManager, LibraryManager, ServerConfigurationManager, NetworkManager, MediaEncoder, UserManager, JsonSerializer, AuthorizationContext) + { + Request = Request + }; + + var playbackInfoResult = await mediaInfoService.GetPlaybackInfo(new GetPostedPlaybackInfo + { + Id = request.Id, + MaxAudioChannels = request.MaxAudioChannels, + MaxStreamingBitrate = request.MaxStreamingBitrate, + StartTimeTicks = request.StartTimeTicks, + UserId = request.UserId, + DeviceProfile = deviceProfile, + MediaSourceId = request.MediaSourceId + + }).ConfigureAwait(false); + + var mediaSource = playbackInfoResult.MediaSources[0]; + + var isStatic = mediaSource.SupportsDirectStream; + + if (!isStatic && string.Equals(mediaSource.TranscodingSubProtocol, "hls", StringComparison.OrdinalIgnoreCase)) + { + var service = new DynamicHlsService(ServerConfigurationManager, + UserManager, + LibraryManager, + IsoManager, + MediaEncoder, + FileSystem, + DlnaManager, + SubtitleEncoder, + DeviceManager, + MediaSourceManager, + ZipClient, + JsonSerializer, + AuthorizationContext, + NetworkManager) + { + Request = Request + }; + + var transcodingProfile = deviceProfile.TranscodingProfiles[0]; + + var newRequest = new GetMasterHlsAudioPlaylist + { + AudioBitRate = isStatic ? (int?)null : Convert.ToInt32(Math.Min(request.MaxStreamingBitrate ?? 192000, int.MaxValue)), + AudioCodec = transcodingProfile.AudioCodec, + Container = ".m3u8", + DeviceId = request.DeviceId, + Id = request.Id, + MaxAudioChannels = request.MaxAudioChannels, + MediaSourceId = mediaSource.Id, + PlaySessionId = playbackInfoResult.PlaySessionId, + StartTimeTicks = request.StartTimeTicks, + Static = isStatic + }; + + if (isHeadRequest) + { + return service.Head(newRequest); + } + return service.Get(newRequest); + } + else + { + var service = new AudioService(ServerConfigurationManager, + UserManager, + LibraryManager, + IsoManager, + MediaEncoder, + FileSystem, + DlnaManager, + SubtitleEncoder, + DeviceManager, + MediaSourceManager, + ZipClient, + JsonSerializer, + AuthorizationContext, + ImageProcessor) + { + Request = Request + }; + + var newRequest = new GetAudioStream + { + AudioBitRate = isStatic ? (int?)null : Convert.ToInt32(Math.Min(request.MaxStreamingBitrate ?? 192000, int.MaxValue)), + //AudioCodec = request.AudioCodec, + Container = isStatic ? null : ("." + mediaSource.TranscodingContainer), + DeviceId = request.DeviceId, + Id = request.Id, + MaxAudioChannels = request.MaxAudioChannels, + MediaSourceId = mediaSource.Id, + PlaySessionId = playbackInfoResult.PlaySessionId, + StartTimeTicks = request.StartTimeTicks, + Static = isStatic + }; + + if (isHeadRequest) + { + return service.Head(newRequest); + } + return service.Get(newRequest); + } + } + } +} diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index 33cd4f3d14..ebebe71a32 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -62,8 +62,6 @@ namespace MediaBrowser.Controller.Library /// BaseItem. BaseItem FindByPath(string path, bool? isFolder); - Guid? FindIdByPath(string path, bool? isFolder); - /// /// Gets the artist. ///