From 9fa6868af3decfa85fe51243b863e5d790fa1246 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 7 Mar 2017 13:27:56 -0500 Subject: [PATCH] update legacy hd homerun support --- Emby.Dlna/Profiles/DefaultProfile.cs | 6 ++++ Emby.Dlna/Profiles/DirectTvProfile.cs | 9 +++++ Emby.Dlna/Profiles/DishHopperJoeyProfile.cs | 8 +++++ Emby.Dlna/Profiles/LinksysDMA2100Profile.cs | 9 +++++ Emby.Dlna/Profiles/PopcornHourProfile.cs | 9 +++++ Emby.Dlna/Profiles/SonyBlurayPlayerProfile.cs | 9 +++++ Emby.Dlna/Profiles/SonyBravia2010Profile.cs | 9 +++++ Emby.Dlna/Profiles/SonyBravia2011Profile.cs | 9 +++++ Emby.Dlna/Profiles/SonyBravia2012Profile.cs | 9 +++++ Emby.Dlna/Profiles/SonyBravia2013Profile.cs | 9 +++++ Emby.Dlna/Profiles/SonyBravia2014Profile.cs | 9 +++++ Emby.Dlna/Profiles/SonyPs3Profile.cs | 9 +++++ Emby.Dlna/Profiles/SonyPs4Profile.cs | 9 +++++ Emby.Dlna/Profiles/Xbox360Profile.cs | 9 +++++ Emby.Dlna/Profiles/XboxOneProfile.cs | 9 +++++ Emby.Dlna/Profiles/Xml/Default.xml | 1 + Emby.Dlna/Profiles/Xml/Denon AVR.xml | 1 + Emby.Dlna/Profiles/Xml/MediaMonkey.xml | 1 + Emby.Dlna/Profiles/Xml/foobar2000.xml | 1 + .../Devices/DeviceManager.cs | 7 ++-- .../Library/LibraryManager.cs | 35 +++++++++++++++---- .../Library/UserManager.cs | 5 +++ .../TunerHosts/HdHomerun/HdHomerunHost.cs | 1 + .../TunerHosts/HdHomerun/HdHomerunManager.cs | 25 ++++++++++++- .../MediaEncoding/EncodingHelper.cs | 5 +++ MediaBrowser.Model/Dto/UserDto.cs | 4 ++- SharedVersion.cs | 2 +- 27 files changed, 206 insertions(+), 13 deletions(-) diff --git a/Emby.Dlna/Profiles/DefaultProfile.cs b/Emby.Dlna/Profiles/DefaultProfile.cs index c670f268ee..f05a4869a7 100644 --- a/Emby.Dlna/Profiles/DefaultProfile.cs +++ b/Emby.Dlna/Profiles/DefaultProfile.cs @@ -83,6 +83,12 @@ namespace Emby.Dlna.Profiles { Format = "srt", Method = SubtitleDeliveryMethod.Embed + }, + + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.External, } }; diff --git a/Emby.Dlna/Profiles/DirectTvProfile.cs b/Emby.Dlna/Profiles/DirectTvProfile.cs index 153d552045..bb9ce903ca 100644 --- a/Emby.Dlna/Profiles/DirectTvProfile.cs +++ b/Emby.Dlna/Profiles/DirectTvProfile.cs @@ -113,6 +113,15 @@ namespace Emby.Dlna.Profiles } }; + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; + ResponseProfiles = new ResponseProfile[] { }; } } diff --git a/Emby.Dlna/Profiles/DishHopperJoeyProfile.cs b/Emby.Dlna/Profiles/DishHopperJoeyProfile.cs index 89e0697c16..331312bec1 100644 --- a/Emby.Dlna/Profiles/DishHopperJoeyProfile.cs +++ b/Emby.Dlna/Profiles/DishHopperJoeyProfile.cs @@ -214,6 +214,14 @@ namespace Emby.Dlna.Profiles } }; + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/LinksysDMA2100Profile.cs b/Emby.Dlna/Profiles/LinksysDMA2100Profile.cs index 2b31ab55f0..d2f5fef760 100644 --- a/Emby.Dlna/Profiles/LinksysDMA2100Profile.cs +++ b/Emby.Dlna/Profiles/LinksysDMA2100Profile.cs @@ -40,6 +40,15 @@ namespace Emby.Dlna.Profiles MimeType = "video/mp4" } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/PopcornHourProfile.cs b/Emby.Dlna/Profiles/PopcornHourProfile.cs index d13b5c6ade..ac8fba84c6 100644 --- a/Emby.Dlna/Profiles/PopcornHourProfile.cs +++ b/Emby.Dlna/Profiles/PopcornHourProfile.cs @@ -210,6 +210,15 @@ namespace Emby.Dlna.Profiles MimeType = "video/mp4" } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/SonyBlurayPlayerProfile.cs b/Emby.Dlna/Profiles/SonyBlurayPlayerProfile.cs index c67bd85b27..d9eab28e15 100644 --- a/Emby.Dlna/Profiles/SonyBlurayPlayerProfile.cs +++ b/Emby.Dlna/Profiles/SonyBlurayPlayerProfile.cs @@ -269,6 +269,15 @@ namespace Emby.Dlna.Profiles Type = DlnaProfileType.Audio } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/SonyBravia2010Profile.cs b/Emby.Dlna/Profiles/SonyBravia2010Profile.cs index 5185503711..60a99561fd 100644 --- a/Emby.Dlna/Profiles/SonyBravia2010Profile.cs +++ b/Emby.Dlna/Profiles/SonyBravia2010Profile.cs @@ -351,6 +351,15 @@ namespace Emby.Dlna.Profiles } } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/SonyBravia2011Profile.cs b/Emby.Dlna/Profiles/SonyBravia2011Profile.cs index 427820a332..346845d9d0 100644 --- a/Emby.Dlna/Profiles/SonyBravia2011Profile.cs +++ b/Emby.Dlna/Profiles/SonyBravia2011Profile.cs @@ -374,6 +374,15 @@ namespace Emby.Dlna.Profiles } } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/SonyBravia2012Profile.cs b/Emby.Dlna/Profiles/SonyBravia2012Profile.cs index 206ca554c3..23a39a9220 100644 --- a/Emby.Dlna/Profiles/SonyBravia2012Profile.cs +++ b/Emby.Dlna/Profiles/SonyBravia2012Profile.cs @@ -292,6 +292,15 @@ namespace Emby.Dlna.Profiles } } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/SonyBravia2013Profile.cs b/Emby.Dlna/Profiles/SonyBravia2013Profile.cs index c618c9990a..2d36d34143 100644 --- a/Emby.Dlna/Profiles/SonyBravia2013Profile.cs +++ b/Emby.Dlna/Profiles/SonyBravia2013Profile.cs @@ -310,6 +310,15 @@ namespace Emby.Dlna.Profiles } } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/SonyBravia2014Profile.cs b/Emby.Dlna/Profiles/SonyBravia2014Profile.cs index c30bcfc853..2c871a5d60 100644 --- a/Emby.Dlna/Profiles/SonyBravia2014Profile.cs +++ b/Emby.Dlna/Profiles/SonyBravia2014Profile.cs @@ -310,6 +310,15 @@ namespace Emby.Dlna.Profiles } } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/SonyPs3Profile.cs b/Emby.Dlna/Profiles/SonyPs3Profile.cs index 001ef2bd8e..2a0490f9ae 100644 --- a/Emby.Dlna/Profiles/SonyPs3Profile.cs +++ b/Emby.Dlna/Profiles/SonyPs3Profile.cs @@ -255,6 +255,15 @@ namespace Emby.Dlna.Profiles Type = DlnaProfileType.Audio } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/SonyPs4Profile.cs b/Emby.Dlna/Profiles/SonyPs4Profile.cs index 8327331846..c7f70f9895 100644 --- a/Emby.Dlna/Profiles/SonyPs4Profile.cs +++ b/Emby.Dlna/Profiles/SonyPs4Profile.cs @@ -264,6 +264,15 @@ namespace Emby.Dlna.Profiles MimeType = "video/mp4" } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/Xbox360Profile.cs b/Emby.Dlna/Profiles/Xbox360Profile.cs index 9f0130856f..7bdcd2a6f8 100644 --- a/Emby.Dlna/Profiles/Xbox360Profile.cs +++ b/Emby.Dlna/Profiles/Xbox360Profile.cs @@ -312,6 +312,15 @@ namespace Emby.Dlna.Profiles } } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/XboxOneProfile.cs b/Emby.Dlna/Profiles/XboxOneProfile.cs index 8994082ad5..e17640f2fa 100644 --- a/Emby.Dlna/Profiles/XboxOneProfile.cs +++ b/Emby.Dlna/Profiles/XboxOneProfile.cs @@ -357,6 +357,15 @@ namespace Emby.Dlna.Profiles MimeType = "video/mp4" } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/Xml/Default.xml b/Emby.Dlna/Profiles/Xml/Default.xml index b5a5d24b64..b0b0d7ac11 100644 --- a/Emby.Dlna/Profiles/Xml/Default.xml +++ b/Emby.Dlna/Profiles/Xml/Default.xml @@ -46,5 +46,6 @@ + \ No newline at end of file diff --git a/Emby.Dlna/Profiles/Xml/Denon AVR.xml b/Emby.Dlna/Profiles/Xml/Denon AVR.xml index 6ddad31467..00b56c03d5 100644 --- a/Emby.Dlna/Profiles/Xml/Denon AVR.xml +++ b/Emby.Dlna/Profiles/Xml/Denon AVR.xml @@ -46,5 +46,6 @@ + \ No newline at end of file diff --git a/Emby.Dlna/Profiles/Xml/MediaMonkey.xml b/Emby.Dlna/Profiles/Xml/MediaMonkey.xml index 48dfbf9bb1..9b726ad4cf 100644 --- a/Emby.Dlna/Profiles/Xml/MediaMonkey.xml +++ b/Emby.Dlna/Profiles/Xml/MediaMonkey.xml @@ -52,5 +52,6 @@ + \ No newline at end of file diff --git a/Emby.Dlna/Profiles/Xml/foobar2000.xml b/Emby.Dlna/Profiles/Xml/foobar2000.xml index b793e22741..779e59310e 100644 --- a/Emby.Dlna/Profiles/Xml/foobar2000.xml +++ b/Emby.Dlna/Profiles/Xml/foobar2000.xml @@ -52,5 +52,6 @@ + \ No newline at end of file diff --git a/Emby.Server.Implementations/Devices/DeviceManager.cs b/Emby.Server.Implementations/Devices/DeviceManager.cs index 88c0ea2035..588b42a093 100644 --- a/Emby.Server.Implementations/Devices/DeviceManager.cs +++ b/Emby.Server.Implementations/Devices/DeviceManager.cs @@ -195,13 +195,12 @@ namespace Emby.Server.Implementations.Devices } var config = _config.GetUploadOptions(); - if (!string.IsNullOrWhiteSpace(config.CameraUploadPath)) + var path = config.CameraUploadPath; + if (string.IsNullOrWhiteSpace(path)) { - return config.CameraUploadPath; + path = DefaultCameraUploadsPath; } - var path = DefaultCameraUploadsPath; - if (config.EnableCameraUploadSubfolders) { path = Path.Combine(path, _fileSystem.GetValidFilename(device.Name)); diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 32fb4ca7af..f7706db478 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -409,18 +409,41 @@ namespace Emby.Server.Implementations.Library if (options.DeleteFileLocation && locationType != LocationType.Remote && locationType != LocationType.Virtual) { + // Assume only the first is required + // Add this flag to GetDeletePaths if required in the future + var isRequiredForDelete = true; + foreach (var fileSystemInfo in item.GetDeletePaths().ToList()) { - if (fileSystemInfo.IsDirectory) + try { - _logger.Debug("Deleting path {0}", fileSystemInfo.FullName); - _fileSystem.DeleteDirectory(fileSystemInfo.FullName, true); + if (fileSystemInfo.IsDirectory) + { + _logger.Debug("Deleting path {0}", fileSystemInfo.FullName); + _fileSystem.DeleteDirectory(fileSystemInfo.FullName, true); + } + else + { + _logger.Debug("Deleting path {0}", fileSystemInfo.FullName); + _fileSystem.DeleteFile(fileSystemInfo.FullName); + } } - else + catch (IOException) { - _logger.Debug("Deleting path {0}", fileSystemInfo.FullName); - _fileSystem.DeleteFile(fileSystemInfo.FullName); + if (isRequiredForDelete) + { + throw; + } } + catch (UnauthorizedAccessException) + { + if (isRequiredForDelete) + { + throw; + } + } + + isRequiredForDelete = false; } if (parent != null) diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs index eb0d0cf9b0..3b11a4767e 100644 --- a/Emby.Server.Implementations/Library/UserManager.cs +++ b/Emby.Server.Implementations/Library/UserManager.cs @@ -434,6 +434,11 @@ namespace Emby.Server.Implementations.Library Policy = user.Policy }; + if (!hasPassword && Users.Count() == 1) + { + dto.EnableAutoLogin = true; + } + var image = user.GetImageInfo(ImageType.Primary, 0); if (image != null) diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs index 25d7de0fd8..62385e1720 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs @@ -596,6 +596,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun else { var mediaSource = GetMediaSource(info, hdhrId, channelInfo, profile); + //var modelInfo = await GetModelInfo(info, false, cancellationToken).ConfigureAwait(false); return new HdHomerunHttpStream(mediaSource, streamId, _fileSystem, _httpClient, Logger, Config.ApplicationPaths, _appHost); //return new HdHomerunUdpStream(mediaSource, streamId, new HdHomerunChannelCommands(hdhomerunChannel.Number), modelInfo.TunerCount, _fileSystem, _httpClient, Logger, Config.ApplicationPaths, _appHost, _socketFactory, _networkManager); diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs index 0c3ba30415..2c678d9f8d 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs @@ -145,7 +145,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun { var channelMsg = CreateSetMessage(i, command.Item1, command.Item2, _lockkey.Value); await tcpClient.SendAsync(channelMsg, channelMsg.Length, ipEndPoint, cancellationToken).ConfigureAwait(false); - await tcpClient.ReceiveAsync(cancellationToken).ConfigureAwait(false); + response = await tcpClient.ReceiveAsync(cancellationToken).ConfigureAwait(false); // parse response to make sure it worked if (!ParseReturnMessage(response.Buffer, response.ReceivedBytes, out returnVal)) { @@ -172,6 +172,29 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun } } + public async Task ChangeChannel(IHdHomerunChannelCommands commands, CancellationToken cancellationToken) + { + if (!_lockkey.HasValue) + return; + + using (var tcpClient = _socketFactory.CreateTcpSocket(_remoteIp, HdHomeRunPort)) + { + var commandList = commands.GetCommands(); + foreach (Tuple command in commandList) + { + var channelMsg = CreateSetMessage(_activeTuner, command.Item1, command.Item2, _lockkey.Value); + await tcpClient.SendAsync(channelMsg, channelMsg.Length, new IpEndPointInfo(_remoteIp, HdHomeRunPort), cancellationToken).ConfigureAwait(false); + var response = await tcpClient.ReceiveAsync(cancellationToken).ConfigureAwait(false); + // parse response to make sure it worked + string returnVal; + if (!ParseReturnMessage(response.Buffer, response.ReceivedBytes, out returnVal)) + { + return; + } + } + } + } + public async Task StopStreaming() { if (!_lockkey.HasValue) diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index d66d0dbcb3..21a3494c56 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -179,6 +179,11 @@ namespace MediaBrowser.Controller.MediaEncoding { return null; } + // Seeing reported failures here, not sure yet if this is related to specfying input format + if (string.Equals(container, "m4v", StringComparison.OrdinalIgnoreCase)) + { + return null; + } return container; } diff --git a/MediaBrowser.Model/Dto/UserDto.cs b/MediaBrowser.Model/Dto/UserDto.cs index f9e3f7718c..37a5541666 100644 --- a/MediaBrowser.Model/Dto/UserDto.cs +++ b/MediaBrowser.Model/Dto/UserDto.cs @@ -89,7 +89,9 @@ namespace MediaBrowser.Model.Dto /// /// true if this instance has configured easy password; otherwise, false. public bool HasConfiguredEasyPassword { get; set; } - + + public bool? EnableAutoLogin { get; set; } + /// /// Gets or sets the last login date. /// diff --git a/SharedVersion.cs b/SharedVersion.cs index 864fc86330..80c22d9e38 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.5.7")] +[assembly: AssemblyVersion("3.2.6.1")]