diff --git a/BDInfo/BDROM.cs b/BDInfo/BDROM.cs index 97dbfbf3bd..2faeb405e2 100644 --- a/BDInfo/BDROM.cs +++ b/BDInfo/BDROM.cs @@ -77,6 +77,11 @@ namespace BDInfo public BDROM( string path, IFileSystem fileSystem, ITextEncoding textEncoding) { + if (string.IsNullOrWhiteSpace(path)) + { + throw new ArgumentNullException("path"); + } + _fileSystem = fileSystem; // // Locate BDMV directories. @@ -326,15 +331,28 @@ namespace BDInfo private FileSystemMetadata GetDirectoryBDMV( string path) { + if (string.IsNullOrWhiteSpace(path)) + { + throw new ArgumentNullException("path"); + } + FileSystemMetadata dir = _fileSystem.GetDirectoryInfo(path); while (dir != null) { - if (dir.Name == "BDMV") + if (string.Equals(dir.Name, "BDMV", StringComparison.OrdinalIgnoreCase)) { 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); @@ -350,7 +368,7 @@ namespace BDInfo FileSystemMetadata[] children = _fileSystem.GetDirectories(dir.FullName).ToArray(); foreach (FileSystemMetadata child in children) { - if (child.Name == name) + if (string.Equals(child.Name, name, StringComparison.OrdinalIgnoreCase)) { return child; } diff --git a/Emby.Common.Implementations/BaseApplicationHost.cs b/Emby.Common.Implementations/BaseApplicationHost.cs index 02d7cb31fd..9c9e14ec6b 100644 --- a/Emby.Common.Implementations/BaseApplicationHost.cs +++ b/Emby.Common.Implementations/BaseApplicationHost.cs @@ -795,6 +795,8 @@ return null; /// public void NotifyPendingRestart() { + Logger.Info("App needs to be restarted."); + var changed = !HasPendingRestart; HasPendingRestart = true; diff --git a/Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs b/Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs index 6cc4626eaf..dcc9744136 100644 --- a/Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs +++ b/Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs @@ -10,11 +10,17 @@ namespace Emby.Common.Implementations.EnvironmentInfo public class EnvironmentInfo : IEnvironmentInfo { public MediaBrowser.Model.System.Architecture? CustomArchitecture { get; set; } + public MediaBrowser.Model.System.OperatingSystem? CustomOperatingSystem { get; set; } public MediaBrowser.Model.System.OperatingSystem OperatingSystem { get { + if (CustomOperatingSystem.HasValue) + { + return CustomOperatingSystem.Value; + } + #if NET46 switch (Environment.OSVersion.Platform) { diff --git a/Emby.Common.Implementations/IO/ManagedFileSystem.cs b/Emby.Common.Implementations/IO/ManagedFileSystem.cs index 62d285072c..78070a5d91 100644 --- a/Emby.Common.Implementations/IO/ManagedFileSystem.cs +++ b/Emby.Common.Implementations/IO/ManagedFileSystem.cs @@ -490,38 +490,13 @@ namespace Emby.Common.Implementations.IO var temp1 = Path.GetTempFileName(); // Copying over will fail against hidden files - RemoveHiddenAttribute(file1); - RemoveHiddenAttribute(file2); + SetHidden(file1, false); + SetHidden(file2, false); CopyFile(file1, temp1, true); CopyFile(file2, file1, true); CopyFile(temp1, file2, true); - - DeleteFile(temp1); - } - - /// - /// Removes the hidden attribute. - /// - /// The path. - private void RemoveHiddenAttribute(string path) - { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException("path"); - } - - var currentFile = new FileInfo(path); - - // This will fail if the file is hidden - if (currentFile.Exists) - { - if ((currentFile.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden) - { - currentFile.Attributes &= ~FileAttributes.Hidden; - } - } } public bool ContainsSubPath(string parentPath, string path) diff --git a/Emby.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/Emby.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs index cbc7c7c2d8..de528a94f3 100644 --- a/Emby.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs +++ b/Emby.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs @@ -282,9 +282,12 @@ namespace Emby.Common.Implementations.ScheduledTasks throw new ArgumentNullException("value"); } - SaveTriggers(value); + // This null check is not great, but is needed to handle bad user input, or user mucking with the config file incorrectly + var triggerList = value.Where(i => i != null).ToArray(); - InternalTriggers = value.Select(i => new Tuple(i, GetTrigger(i))).ToArray(); + SaveTriggers(triggerList); + + InternalTriggers = triggerList.Select(i => new Tuple(i, GetTrigger(i))).ToArray(); } } @@ -535,7 +538,8 @@ namespace Emby.Common.Implementations.ScheduledTasks /// IEnumerable{BaseTaskTrigger}. private Tuple[] LoadTriggers() { - var settings = LoadTriggerSettings(); + // This null check is not great, but is needed to handle bad user input, or user mucking with the config file incorrectly + var settings = LoadTriggerSettings().Where(i => i != null).ToArray(); return settings.Select(i => new Tuple(i, GetTrigger(i))).ToArray(); } @@ -544,8 +548,12 @@ namespace Emby.Common.Implementations.ScheduledTasks { try { - return JsonSerializer.DeserializeFromFile>(GetConfigurationFilePath()) - .ToArray(); + var list = JsonSerializer.DeserializeFromFile>(GetConfigurationFilePath()); + + if (list != null) + { + return list.ToArray(); + } } catch (FileNotFoundException) { @@ -555,8 +563,8 @@ namespace Emby.Common.Implementations.ScheduledTasks catch (DirectoryNotFoundException) { // File doesn't exist. No biggie. Return defaults. - return ScheduledTask.GetDefaultTriggers().ToArray(); } + return ScheduledTask.GetDefaultTriggers().ToArray(); } /// diff --git a/Emby.Dlna/ContentDirectory/ControlHandler.cs b/Emby.Dlna/ContentDirectory/ControlHandler.cs index 4329911289..5718cbd09f 100644 --- a/Emby.Dlna/ContentDirectory/ControlHandler.cs +++ b/Emby.Dlna/ContentDirectory/ControlHandler.cs @@ -268,7 +268,7 @@ namespace Emby.Dlna.ContentDirectory } else { - _didlBuilder.WriteItemElement(_config.GetDlnaConfiguration(), writer, item, null, null, deviceId, filter); + _didlBuilder.WriteItemElement(_config.GetDlnaConfiguration(), writer, item, user, null, null, deviceId, filter); } provided++; @@ -294,7 +294,7 @@ namespace Emby.Dlna.ContentDirectory } else { - _didlBuilder.WriteItemElement(_config.GetDlnaConfiguration(), writer, childItem, item, serverItem.StubType, deviceId, filter); + _didlBuilder.WriteItemElement(_config.GetDlnaConfiguration(), writer, childItem, user, item, serverItem.StubType, deviceId, filter); } } } @@ -390,7 +390,7 @@ namespace Emby.Dlna.ContentDirectory } else { - _didlBuilder.WriteItemElement(_config.GetDlnaConfiguration(), writer, i, item, serverItem.StubType, deviceId, filter); + _didlBuilder.WriteItemElement(_config.GetDlnaConfiguration(), writer, i, user, item, serverItem.StubType, deviceId, filter); } } diff --git a/Emby.Dlna/Didl/DidlBuilder.cs b/Emby.Dlna/Didl/DidlBuilder.cs index 3dcdaf2efc..3e47362f65 100644 --- a/Emby.Dlna/Didl/DidlBuilder.cs +++ b/Emby.Dlna/Didl/DidlBuilder.cs @@ -61,7 +61,7 @@ namespace Emby.Dlna.Didl _user = user; } - public string GetItemDidl(DlnaOptions options, BaseItem item, BaseItem context, string deviceId, Filter filter, StreamInfo streamInfo) + public string GetItemDidl(DlnaOptions options, BaseItem item, User user, BaseItem context, string deviceId, Filter filter, StreamInfo streamInfo) { var settings = new XmlWriterSettings { @@ -86,7 +86,7 @@ namespace Emby.Dlna.Didl WriteXmlRootAttributes(_profile, writer); - WriteItemElement(options, writer, item, context, null, deviceId, filter, streamInfo); + WriteItemElement(options, writer, item, user, context, null, deviceId, filter, streamInfo); writer.WriteFullEndElement(); //writer.WriteEndDocument(); @@ -111,7 +111,15 @@ namespace Emby.Dlna.Didl } } - public void WriteItemElement(DlnaOptions options, XmlWriter writer, BaseItem item, BaseItem context, StubType? contextStubType, string deviceId, Filter filter, StreamInfo streamInfo = null) + public void WriteItemElement(DlnaOptions options, + XmlWriter writer, + BaseItem item, + User user, + BaseItem context, + StubType? contextStubType, + string deviceId, + Filter filter, + StreamInfo streamInfo = null) { var clientId = GetClientId(item, null); @@ -135,7 +143,7 @@ namespace Emby.Dlna.Didl AddGeneralProperties(item, null, context, writer, filter); - //AddBookmarkInfo(item, user, element); + AddSamsungBookmarkInfo(item, user, writer); // refID? // storeAttribute(itemNode, object, ClassProperties.REF_ID, false); @@ -555,17 +563,37 @@ namespace Emby.Dlna.Didl writer.WriteFullEndElement(); } - //private void AddBookmarkInfo(BaseItem item, User user, XmlElement element) - //{ - // var userdata = _userDataManager.GetUserData(user.Id, item.GetUserDataKey()); + private void AddSamsungBookmarkInfo(BaseItem item, User user, XmlWriter writer) + { + if (!item.SupportsPositionTicksResume || item is Folder) + { + return; + } - // if (userdata.PlaybackPositionTicks > 0) - // { - // var dcmInfo = element.OwnerDocument.CreateElement("sec", "dcmInfo", NS_SEC); - // dcmInfo.InnerText = string.Format("BM={0}", Convert.ToInt32(TimeSpan.FromTicks(userdata.PlaybackPositionTicks).TotalSeconds).ToString(_usCulture)); - // element.AppendChild(dcmInfo); - // } - //} + XmlAttribute secAttribute = null; + foreach (var attribute in _profile.XmlRootAttributes) + { + if (string.Equals(attribute.Name, "xmlns:sec", StringComparison.OrdinalIgnoreCase)) + { + secAttribute = attribute; + break; + } + } + + // Not a samsung device + if (secAttribute == null) + { + return; + } + + var userdata = _userDataManager.GetUserData(user.Id, item); + + if (userdata.PlaybackPositionTicks > 0) + { + var elementValue = string.Format("BM={0}", Convert.ToInt32(TimeSpan.FromTicks(userdata.PlaybackPositionTicks).TotalSeconds).ToString(_usCulture)); + AddValue(writer, "sec", "dcmInfo", elementValue, secAttribute.Value); + } + } /// /// Adds fields used by both items and folders diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.cs index 7dff8bda13..4ad62216e4 100644 --- a/Emby.Dlna/PlayTo/PlayToController.cs +++ b/Emby.Dlna/PlayTo/PlayToController.cs @@ -493,7 +493,7 @@ namespace Emby.Dlna.PlayTo playlistItem.StreamUrl = playlistItem.StreamInfo.ToDlnaUrl(_serverAddress, _accessToken); var itemXml = new DidlBuilder(profile, user, _imageProcessor, _serverAddress, _accessToken, _userDataManager, _localization, _mediaSourceManager, _logger, _libraryManager, _mediaEncoder) - .GetItemDidl(_config.GetDlnaConfiguration(), item, null, _session.DeviceId, new Filter(), playlistItem.StreamInfo); + .GetItemDidl(_config.GetDlnaConfiguration(), item, user, null, _session.DeviceId, new Filter(), playlistItem.StreamInfo); playlistItem.Didl = itemXml; diff --git a/Emby.Dlna/Profiles/DishHopperJoeyProfile.cs b/Emby.Dlna/Profiles/DishHopperJoeyProfile.cs index 9f31377101..d494a7bfca 100644 --- a/Emby.Dlna/Profiles/DishHopperJoeyProfile.cs +++ b/Emby.Dlna/Profiles/DishHopperJoeyProfile.cs @@ -201,6 +201,21 @@ namespace Emby.Dlna.Profiles IsRequired = true } } + }, + + new CodecProfile + { + Type = CodecType.VideoAudio, + Conditions = new [] + { + // The device does not have any audio switching capabilities + new ProfileCondition + { + Condition = ProfileConditionType.Equals, + Property = ProfileConditionValue.IsSecondaryAudio, + Value = "false" + } + } } }; diff --git a/Emby.Dlna/Profiles/LgTvProfile.cs b/Emby.Dlna/Profiles/LgTvProfile.cs index faaf63b314..f7cf7b9a19 100644 --- a/Emby.Dlna/Profiles/LgTvProfile.cs +++ b/Emby.Dlna/Profiles/LgTvProfile.cs @@ -55,27 +55,26 @@ namespace Emby.Dlna.Profiles { Container = "ts", VideoCodec = "h264", - AudioCodec = "aac,ac3,mp3", + AudioCodec = "aac,ac3,mp3,dca,dts", Type = DlnaProfileType.Video }, new DirectPlayProfile { Container = "mkv", VideoCodec = "h264", - AudioCodec = "aac,ac3,mp3", + AudioCodec = "aac,ac3,mp3,dca,dts", Type = DlnaProfileType.Video }, new DirectPlayProfile { Container = "mp4", VideoCodec = "h264,mpeg4", - AudioCodec = "aac,ac3,mp3", + AudioCodec = "aac,ac3,mp3,dca,dts", Type = DlnaProfileType.Video }, new DirectPlayProfile { Container = "mp3", - AudioCodec = "mp3", Type = DlnaProfileType.Audio }, new DirectPlayProfile diff --git a/Emby.Dlna/Profiles/Xml/BubbleUPnp.xml b/Emby.Dlna/Profiles/Xml/BubbleUPnp.xml index 25f981ee06..754be1af80 100644 --- a/Emby.Dlna/Profiles/Xml/BubbleUPnp.xml +++ b/Emby.Dlna/Profiles/Xml/BubbleUPnp.xml @@ -40,9 +40,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/Default.xml b/Emby.Dlna/Profiles/Xml/Default.xml index 81209c1f68..4e29f651ba 100644 --- a/Emby.Dlna/Profiles/Xml/Default.xml +++ b/Emby.Dlna/Profiles/Xml/Default.xml @@ -33,9 +33,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/Denon AVR.xml b/Emby.Dlna/Profiles/Xml/Denon AVR.xml index cdf09df0e9..6ddad31467 100644 --- a/Emby.Dlna/Profiles/Xml/Denon AVR.xml +++ b/Emby.Dlna/Profiles/Xml/Denon AVR.xml @@ -37,9 +37,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/DirecTV HD-DVR.xml b/Emby.Dlna/Profiles/Xml/DirecTV HD-DVR.xml index b8afed60e8..2021dae922 100644 --- a/Emby.Dlna/Profiles/Xml/DirecTV HD-DVR.xml +++ b/Emby.Dlna/Profiles/Xml/DirecTV HD-DVR.xml @@ -39,8 +39,8 @@ - - + + diff --git a/Emby.Dlna/Profiles/Xml/Dish Hopper-Joey.xml b/Emby.Dlna/Profiles/Xml/Dish Hopper-Joey.xml index 3ad2a01295..eb63352a3f 100644 --- a/Emby.Dlna/Profiles/Xml/Dish Hopper-Joey.xml +++ b/Emby.Dlna/Profiles/Xml/Dish Hopper-Joey.xml @@ -43,9 +43,9 @@ - - - + + + @@ -80,6 +80,12 @@ + + + + + + diff --git a/Emby.Dlna/Profiles/Xml/Kodi.xml b/Emby.Dlna/Profiles/Xml/Kodi.xml index 58f9e8e235..a78984b097 100644 --- a/Emby.Dlna/Profiles/Xml/Kodi.xml +++ b/Emby.Dlna/Profiles/Xml/Kodi.xml @@ -40,9 +40,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/LG Smart TV.xml b/Emby.Dlna/Profiles/Xml/LG Smart TV.xml index 3a185e7331..dc0e977720 100644 --- a/Emby.Dlna/Profiles/Xml/LG Smart TV.xml +++ b/Emby.Dlna/Profiles/Xml/LG Smart TV.xml @@ -35,16 +35,16 @@ false - - - - + + + + - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/Linksys DMA2100.xml b/Emby.Dlna/Profiles/Xml/Linksys DMA2100.xml index 5723f144bf..862bede9b4 100644 --- a/Emby.Dlna/Profiles/Xml/Linksys DMA2100.xml +++ b/Emby.Dlna/Profiles/Xml/Linksys DMA2100.xml @@ -37,9 +37,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/MediaMonkey.xml b/Emby.Dlna/Profiles/Xml/MediaMonkey.xml index 929f6898e4..48dfbf9bb1 100644 --- a/Emby.Dlna/Profiles/Xml/MediaMonkey.xml +++ b/Emby.Dlna/Profiles/Xml/MediaMonkey.xml @@ -43,9 +43,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/Panasonic Viera.xml b/Emby.Dlna/Profiles/Xml/Panasonic Viera.xml index 3e3049d302..d7b142d84e 100644 --- a/Emby.Dlna/Profiles/Xml/Panasonic Viera.xml +++ b/Emby.Dlna/Profiles/Xml/Panasonic Viera.xml @@ -50,9 +50,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/Popcorn Hour.xml b/Emby.Dlna/Profiles/Xml/Popcorn Hour.xml index bc73d23716..9bc4c2e312 100644 --- a/Emby.Dlna/Profiles/Xml/Popcorn Hour.xml +++ b/Emby.Dlna/Profiles/Xml/Popcorn Hour.xml @@ -38,9 +38,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/Samsung Smart TV.xml b/Emby.Dlna/Profiles/Xml/Samsung Smart TV.xml index 31210fac14..5b2106da54 100644 --- a/Emby.Dlna/Profiles/Xml/Samsung Smart TV.xml +++ b/Emby.Dlna/Profiles/Xml/Samsung Smart TV.xml @@ -50,9 +50,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2013.xml b/Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2013.xml index 2bf57d4260..19a8ed5f9f 100644 --- a/Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2013.xml +++ b/Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2013.xml @@ -52,9 +52,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2014.xml b/Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2014.xml index 703edc35ae..2fb9cf5838 100644 --- a/Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2014.xml +++ b/Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2014.xml @@ -52,9 +52,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2015.xml b/Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2015.xml index 69f4b73c64..956977643a 100644 --- a/Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2015.xml +++ b/Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2015.xml @@ -50,9 +50,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2016.xml b/Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2016.xml index a24cfab895..ddb8f21008 100644 --- a/Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2016.xml +++ b/Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2016.xml @@ -50,9 +50,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/Sony Blu-ray Player.xml b/Emby.Dlna/Profiles/Xml/Sony Blu-ray Player.xml index 7ce41dea0a..154d9a68f7 100644 --- a/Emby.Dlna/Profiles/Xml/Sony Blu-ray Player.xml +++ b/Emby.Dlna/Profiles/Xml/Sony Blu-ray Player.xml @@ -47,9 +47,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/Sony Bravia (2010).xml b/Emby.Dlna/Profiles/Xml/Sony Bravia (2010).xml index 600d76ea71..4b7feded91 100644 --- a/Emby.Dlna/Profiles/Xml/Sony Bravia (2010).xml +++ b/Emby.Dlna/Profiles/Xml/Sony Bravia (2010).xml @@ -45,9 +45,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/Sony Bravia (2011).xml b/Emby.Dlna/Profiles/Xml/Sony Bravia (2011).xml index 232896c8a7..39d7674a1e 100644 --- a/Emby.Dlna/Profiles/Xml/Sony Bravia (2011).xml +++ b/Emby.Dlna/Profiles/Xml/Sony Bravia (2011).xml @@ -48,9 +48,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/Sony Bravia (2012).xml b/Emby.Dlna/Profiles/Xml/Sony Bravia (2012).xml index 5cf1c5eadb..8b6e88702e 100644 --- a/Emby.Dlna/Profiles/Xml/Sony Bravia (2012).xml +++ b/Emby.Dlna/Profiles/Xml/Sony Bravia (2012).xml @@ -50,9 +50,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/Sony Bravia (2013).xml b/Emby.Dlna/Profiles/Xml/Sony Bravia (2013).xml index f009d6f11b..e76ca2c771 100644 --- a/Emby.Dlna/Profiles/Xml/Sony Bravia (2013).xml +++ b/Emby.Dlna/Profiles/Xml/Sony Bravia (2013).xml @@ -55,9 +55,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/Sony Bravia (2014).xml b/Emby.Dlna/Profiles/Xml/Sony Bravia (2014).xml index f996652a8c..ff4aa9cf8e 100644 --- a/Emby.Dlna/Profiles/Xml/Sony Bravia (2014).xml +++ b/Emby.Dlna/Profiles/Xml/Sony Bravia (2014).xml @@ -55,9 +55,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/Sony PlayStation 3.xml b/Emby.Dlna/Profiles/Xml/Sony PlayStation 3.xml index 3608c343be..ff2e282f8a 100644 --- a/Emby.Dlna/Profiles/Xml/Sony PlayStation 3.xml +++ b/Emby.Dlna/Profiles/Xml/Sony PlayStation 3.xml @@ -45,9 +45,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/Sony PlayStation 4.xml b/Emby.Dlna/Profiles/Xml/Sony PlayStation 4.xml index 498f9966fb..7ec4ccc907 100644 --- a/Emby.Dlna/Profiles/Xml/Sony PlayStation 4.xml +++ b/Emby.Dlna/Profiles/Xml/Sony PlayStation 4.xml @@ -45,9 +45,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/Vlc.xml b/Emby.Dlna/Profiles/Xml/Vlc.xml index 3a5b7927bd..f1d9c1f2d1 100644 --- a/Emby.Dlna/Profiles/Xml/Vlc.xml +++ b/Emby.Dlna/Profiles/Xml/Vlc.xml @@ -40,9 +40,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/WDTV Live.xml b/Emby.Dlna/Profiles/Xml/WDTV Live.xml index bf3531a307..96d37e7fb0 100644 --- a/Emby.Dlna/Profiles/Xml/WDTV Live.xml +++ b/Emby.Dlna/Profiles/Xml/WDTV Live.xml @@ -51,9 +51,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/Xbox 360.xml b/Emby.Dlna/Profiles/Xml/Xbox 360.xml index 2f0fee8c18..a470fa4cbc 100644 --- a/Emby.Dlna/Profiles/Xml/Xbox 360.xml +++ b/Emby.Dlna/Profiles/Xml/Xbox 360.xml @@ -46,9 +46,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/Xbox One.xml b/Emby.Dlna/Profiles/Xml/Xbox One.xml index e47c308e43..8c13ed8fda 100644 --- a/Emby.Dlna/Profiles/Xml/Xbox One.xml +++ b/Emby.Dlna/Profiles/Xml/Xbox One.xml @@ -46,9 +46,9 @@ - - - + + + diff --git a/Emby.Dlna/Profiles/Xml/foobar2000.xml b/Emby.Dlna/Profiles/Xml/foobar2000.xml index 51f649e36a..b793e22741 100644 --- a/Emby.Dlna/Profiles/Xml/foobar2000.xml +++ b/Emby.Dlna/Profiles/Xml/foobar2000.xml @@ -43,9 +43,9 @@ - - - + + + diff --git a/Emby.Server.Core/ApplicationHost.cs b/Emby.Server.Core/ApplicationHost.cs index a0a7416e7b..215ac84924 100644 --- a/Emby.Server.Core/ApplicationHost.cs +++ b/Emby.Server.Core/ApplicationHost.cs @@ -1083,6 +1083,8 @@ namespace Emby.Server.Core if (requiresRestart) { + Logger.Info("App needs to be restarted due to configuration change."); + NotifyPendingRestart(); } } @@ -1204,7 +1206,8 @@ namespace Emby.Server.Core var exclude = new[] { "mbplus.dll", - "mbintros.dll" + "mbintros.dll", + "embytv.dll" }; return !exclude.Contains(filename ?? string.Empty, StringComparer.OrdinalIgnoreCase); @@ -1583,7 +1586,8 @@ namespace Emby.Server.Core public void LaunchUrl(string url) { - if (EnvironmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.Windows) + if (EnvironmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.Windows && + EnvironmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.OSX) { throw new NotImplementedException(); } @@ -1591,7 +1595,7 @@ namespace Emby.Server.Core var process = ProcessFactory.Create(new ProcessOptions { FileName = url, - EnableRaisingEvents = true, + //EnableRaisingEvents = true, UseShellExecute = true, ErrorDialog = false }); diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.cs index 0df916ded3..f7dc930097 100644 --- a/Emby.Server.Implementations/Channels/ChannelManager.cs +++ b/Emby.Server.Implementations/Channels/ChannelManager.cs @@ -79,21 +79,6 @@ namespace Emby.Server.Implementations.Channels _channels = channels.ToArray(); } - public string ChannelDownloadPath - { - get - { - var options = _config.GetChannelsConfiguration(); - - if (!string.IsNullOrWhiteSpace(options.DownloadPath)) - { - return options.DownloadPath; - } - - return Path.Combine(_config.ApplicationPaths.ProgramDataPath, "channels"); - } - } - private IEnumerable GetAllChannels() { return _channels @@ -288,7 +273,7 @@ namespace Emby.Server.Implementations.Channels _jsonSerializer.SerializeToFile(mediaSources, path); } - public async Task> GetStaticMediaSources(BaseItem item, bool includeCachedVersions, CancellationToken cancellationToken) + public async Task> GetStaticMediaSources(BaseItem item, CancellationToken cancellationToken) { IEnumerable results = new List(); var video = item as Video; @@ -302,17 +287,9 @@ namespace Emby.Server.Implementations.Channels results = audio.ChannelMediaSources ?? GetSavedMediaSources(audio); } - var sources = SortMediaInfoResults(results) + return SortMediaInfoResults(results) .Select(i => GetMediaSource(item, i)) .ToList(); - - if (includeCachedVersions) - { - var cachedVersions = GetCachedChannelItemMediaSources(item); - sources.InsertRange(0, cachedVersions); - } - - return sources; } public async Task> GetDynamicMediaSources(BaseItem item, CancellationToken cancellationToken) @@ -334,14 +311,9 @@ namespace Emby.Server.Implementations.Channels results = new List(); } - var list = SortMediaInfoResults(results) + return SortMediaInfoResults(results) .Select(i => GetMediaSource(item, i)) .ToList(); - - var cachedVersions = GetCachedChannelItemMediaSources(item); - list.InsertRange(0, cachedVersions); - - return list; } private readonly ConcurrentDictionary>> _channelItemMediaInfo = @@ -369,55 +341,6 @@ namespace Emby.Server.Implementations.Channels return list; } - private IEnumerable GetCachedChannelItemMediaSources(BaseItem item) - { - var filenamePrefix = item.Id.ToString("N"); - var parentPath = Path.Combine(ChannelDownloadPath, item.ChannelId); - - try - { - var files = _fileSystem.GetFiles(parentPath); - - if (string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase)) - { - files = files.Where(i => _libraryManager.IsVideoFile(i.FullName)); - } - else - { - files = files.Where(i => _libraryManager.IsAudioFile(i.FullName)); - } - - var file = files - .FirstOrDefault(i => i.Name.StartsWith(filenamePrefix, StringComparison.OrdinalIgnoreCase)); - - if (file != null) - { - var cachedItem = _libraryManager.ResolvePath(file); - - if (cachedItem != null) - { - var hasMediaSources = _libraryManager.GetItemById(cachedItem.Id) as IHasMediaSources; - - if (hasMediaSources != null) - { - var source = hasMediaSources.GetMediaSources(true).FirstOrDefault(); - - if (source != null) - { - return new[] { source }; - } - } - } - } - } - catch (IOException) - { - - } - - return new List(); - } - private MediaSourceInfo GetMediaSource(BaseItem item, ChannelMediaInfo info) { var source = info.ToMediaSource(); diff --git a/Emby.Server.Implementations/Connect/ConnectManager.cs b/Emby.Server.Implementations/Connect/ConnectManager.cs index b7faaa9013..8c8b7b0268 100644 --- a/Emby.Server.Implementations/Connect/ConnectManager.cs +++ b/Emby.Server.Implementations/Connect/ConnectManager.cs @@ -570,9 +570,9 @@ namespace Emby.Server.Implementations.Connect } catch (HttpException ex) { - if (!ex.StatusCode.HasValue) + if (!ex.StatusCode.HasValue || ex.IsTimedOut) { - throw; + throw new Exception("Unable to invite guest, " + ex.Message, ex); } // If they entered a username, then whatever the error is just throw it, for example, user not found diff --git a/Emby.Server.Implementations/Data/SqliteExtensions.cs b/Emby.Server.Implementations/Data/SqliteExtensions.cs index d6ad0ba8ab..783258a138 100644 --- a/Emby.Server.Implementations/Data/SqliteExtensions.cs +++ b/Emby.Server.Implementations/Data/SqliteExtensions.cs @@ -346,6 +346,18 @@ namespace Emby.Server.Implementations.Data } } + public static void TryBind(this IStatement statement, string name, double? value) + { + if (value.HasValue) + { + TryBind(statement, name, value.Value); + } + else + { + TryBindNull(statement, name); + } + } + public static void TryBind(this IStatement statement, string name, int? value) { if (value.HasValue) diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 8e6a277a47..8c16216b95 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -5267,11 +5267,19 @@ namespace Emby.Server.Implementations.Data { foreach (var pair in values) { + var itemValue = pair.Item2; + + // Don't save if invalid + if (string.IsNullOrWhiteSpace(itemValue)) + { + continue; + } + statement.Reset(); statement.TryBind("@ItemId", itemId.ToGuidParamValue()); statement.TryBind("@Type", pair.Item1); - statement.TryBind("@Value", pair.Item2); + statement.TryBind("@Value", itemValue); if (pair.Item2 == null) { diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj index d773fbbf73..7ee0c566f7 100644 --- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj +++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj @@ -312,8 +312,8 @@ ..\packages\Emby.XmlTv.1.0.3\lib\portable-net45+win8\Emby.XmlTv.dll True - - ..\packages\MediaBrowser.Naming.1.0.3\lib\portable-net45+win8\MediaBrowser.Naming.dll + + ..\packages\MediaBrowser.Naming.1.0.4\lib\portable-net45+win8\MediaBrowser.Naming.dll True @@ -424,6 +424,9 @@ + + +