Selaa lähdekoodia

Merge pull request #2372 from MediaBrowser/beta

Beta
Luke 8 vuotta sitten
vanhempi
sitoutus
2cb0f3eed6
100 muutettua tiedostoa jossa 739 lisäystä ja 626 poistoa
  1. 21 3
      BDInfo/BDROM.cs
  2. 2 0
      Emby.Common.Implementations/BaseApplicationHost.cs
  3. 6 0
      Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs
  4. 2 27
      Emby.Common.Implementations/IO/ManagedFileSystem.cs
  5. 14 6
      Emby.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
  6. 3 3
      Emby.Dlna/ContentDirectory/ControlHandler.cs
  7. 43 15
      Emby.Dlna/Didl/DidlBuilder.cs
  8. 1 1
      Emby.Dlna/PlayTo/PlayToController.cs
  9. 15 0
      Emby.Dlna/Profiles/DishHopperJoeyProfile.cs
  10. 3 4
      Emby.Dlna/Profiles/LgTvProfile.cs
  11. 3 3
      Emby.Dlna/Profiles/Xml/BubbleUPnp.xml
  12. 3 3
      Emby.Dlna/Profiles/Xml/Default.xml
  13. 3 3
      Emby.Dlna/Profiles/Xml/Denon AVR.xml
  14. 2 2
      Emby.Dlna/Profiles/Xml/DirecTV HD-DVR.xml
  15. 9 3
      Emby.Dlna/Profiles/Xml/Dish Hopper-Joey.xml
  16. 3 3
      Emby.Dlna/Profiles/Xml/Kodi.xml
  17. 7 7
      Emby.Dlna/Profiles/Xml/LG Smart TV.xml
  18. 3 3
      Emby.Dlna/Profiles/Xml/Linksys DMA2100.xml
  19. 3 3
      Emby.Dlna/Profiles/Xml/MediaMonkey.xml
  20. 3 3
      Emby.Dlna/Profiles/Xml/Panasonic Viera.xml
  21. 3 3
      Emby.Dlna/Profiles/Xml/Popcorn Hour.xml
  22. 3 3
      Emby.Dlna/Profiles/Xml/Samsung Smart TV.xml
  23. 3 3
      Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2013.xml
  24. 3 3
      Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2014.xml
  25. 3 3
      Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2015.xml
  26. 3 3
      Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2016.xml
  27. 3 3
      Emby.Dlna/Profiles/Xml/Sony Blu-ray Player.xml
  28. 3 3
      Emby.Dlna/Profiles/Xml/Sony Bravia (2010).xml
  29. 3 3
      Emby.Dlna/Profiles/Xml/Sony Bravia (2011).xml
  30. 3 3
      Emby.Dlna/Profiles/Xml/Sony Bravia (2012).xml
  31. 3 3
      Emby.Dlna/Profiles/Xml/Sony Bravia (2013).xml
  32. 3 3
      Emby.Dlna/Profiles/Xml/Sony Bravia (2014).xml
  33. 3 3
      Emby.Dlna/Profiles/Xml/Sony PlayStation 3.xml
  34. 3 3
      Emby.Dlna/Profiles/Xml/Sony PlayStation 4.xml
  35. 3 3
      Emby.Dlna/Profiles/Xml/Vlc.xml
  36. 3 3
      Emby.Dlna/Profiles/Xml/WDTV Live.xml
  37. 3 3
      Emby.Dlna/Profiles/Xml/Xbox 360.xml
  38. 3 3
      Emby.Dlna/Profiles/Xml/Xbox One.xml
  39. 3 3
      Emby.Dlna/Profiles/Xml/foobar2000.xml
  40. 7 3
      Emby.Server.Core/ApplicationHost.cs
  41. 3 80
      Emby.Server.Implementations/Channels/ChannelManager.cs
  42. 2 2
      Emby.Server.Implementations/Connect/ConnectManager.cs
  43. 12 0
      Emby.Server.Implementations/Data/SqliteExtensions.cs
  44. 9 1
      Emby.Server.Implementations/Data/SqliteItemRepository.cs
  45. 5 2
      Emby.Server.Implementations/Emby.Server.Implementations.csproj
  46. 3 1
      Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs
  47. 32 15
      Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
  48. 33 38
      Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
  49. 1 1
      Emby.Server.Implementations/HttpServer/IHttpListener.cs
  50. 2 2
      Emby.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpListener.cs
  51. 10 1
      Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
  52. 5 1
      Emby.Server.Implementations/Library/LibraryManager.cs
  53. 19 8
      Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
  54. 7 1
      Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs
  55. 15 2
      Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
  56. 1 1
      Emby.Server.Implementations/LiveTv/LiveTvManager.cs
  57. 7 0
      Emby.Server.Implementations/Localization/Ratings/uk.txt
  58. 1 1
      Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs
  59. 1 15
      Emby.Server.Implementations/Sync/CloudSyncProfile.cs
  60. 9 1
      Emby.Server.Implementations/Sync/SyncJobProcessor.cs
  61. 24 20
      Emby.Server.Implementations/Sync/SyncManager.cs
  62. 12 0
      Emby.Server.Implementations/Sync/SyncNotificationEntryPoint.cs
  63. 58 31
      Emby.Server.Implementations/Sync/SyncRepository.cs
  64. 13 0
      Emby.Server.Implementations/Udp/UdpServer.cs
  65. 1 1
      Emby.Server.Implementations/packages.config
  66. 1 0
      MediaBrowser.Api/ItemUpdateService.cs
  67. 54 32
      MediaBrowser.Api/Playback/BaseStreamingService.cs
  68. 1 2
      MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
  69. 1 1
      MediaBrowser.Api/Playback/Progressive/VideoService.cs
  70. 0 1
      MediaBrowser.Api/Playback/StreamRequest.cs
  71. 1 9
      MediaBrowser.Controller/Channels/IChannelManager.cs
  72. 1 1
      MediaBrowser.Controller/Entities/Audio/Audio.cs
  73. 1 1
      MediaBrowser.Controller/Entities/Video.cs
  74. 2 0
      MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs
  75. 5 0
      MediaBrowser.MediaEncoding/BdInfo/BdInfoExaminer.cs
  76. 14 2
      MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
  77. 32 12
      MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
  78. 8 1
      MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
  79. 4 6
      MediaBrowser.Model/Configuration/ServerConfiguration.cs
  80. 0 1
      MediaBrowser.Model/Configuration/UserConfiguration.cs
  81. 7 6
      MediaBrowser.Model/Dlna/ConditionProcessor.cs
  82. 2 6
      MediaBrowser.Model/Dlna/StreamBuilder.cs
  83. 0 2
      MediaBrowser.Model/Dlna/StreamInfo.cs
  84. 0 3
      MediaBrowser.Model/Dlna/TranscodingProfile.cs
  85. 1 0
      MediaBrowser.Model/Sync/SyncJobQuery.cs
  86. 5 0
      MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs
  87. 3 3
      MediaBrowser.Providers/Omdb/OmdbProvider.cs
  88. 7 1
      MediaBrowser.Providers/TV/MissingEpisodeProvider.cs
  89. 8 4
      MediaBrowser.Providers/TV/Omdb/OmdbEpisodeProvider.cs
  90. 15 9
      MediaBrowser.Server.Mac/Emby.Server.Mac.csproj
  91. 4 1
      MediaBrowser.Server.Mac/Main.cs
  92. 22 0
      MediaBrowser.Server.Mono/MonoAppHost.cs
  93. 2 67
      MediaBrowser.ServerApplication/Native/LnkShortcutHandler.cs
  94. 17 7
      MediaBrowser.ServerApplication/WindowsAppHost.cs
  95. 0 9
      MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj
  96. 4 54
      OpenSubtitlesHandler/Utilities.cs
  97. 2 2
      RSSDP/SsdpDevicePublisherBase.cs
  98. 2 2
      SocketHttpListener.Portable/Net/HttpConnection.cs
  99. 4 3
      SocketHttpListener.Portable/Net/HttpListenerResponse.cs
  100. 11 1
      SocketHttpListener.Portable/Net/ResponseStream.cs

+ 21 - 3
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;
                     }

+ 2 - 0
Emby.Common.Implementations/BaseApplicationHost.cs

@@ -795,6 +795,8 @@ return null;
         /// </summary>
         public void NotifyPendingRestart()
         {
+            Logger.Info("App needs to be restarted.");
+
             var changed = !HasPendingRestart;
 
             HasPendingRestart = true;

+ 6 - 0
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)
                 {

+ 2 - 27
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);
-        }
-
-        /// <summary>
-        /// Removes the hidden attribute.
-        /// </summary>
-        /// <param name="path">The path.</param>
-        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)

+ 14 - 6
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<TaskTriggerInfo, ITaskTrigger>(i, GetTrigger(i))).ToArray();
+                SaveTriggers(triggerList);
+
+                InternalTriggers = triggerList.Select(i => new Tuple<TaskTriggerInfo, ITaskTrigger>(i, GetTrigger(i))).ToArray();
             }
         }
 
@@ -535,7 +538,8 @@ namespace Emby.Common.Implementations.ScheduledTasks
         /// <returns>IEnumerable{BaseTaskTrigger}.</returns>
         private Tuple<TaskTriggerInfo, ITaskTrigger>[] 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<TaskTriggerInfo, ITaskTrigger>(i, GetTrigger(i))).ToArray();
         }
@@ -544,8 +548,12 @@ namespace Emby.Common.Implementations.ScheduledTasks
         {
             try
             {
-                return JsonSerializer.DeserializeFromFile<IEnumerable<TaskTriggerInfo>>(GetConfigurationFilePath())
-                .ToArray();
+                var list = JsonSerializer.DeserializeFromFile<IEnumerable<TaskTriggerInfo>>(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();
         }
 
         /// <summary>

+ 3 - 3
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);
                     }
                 }
 

+ 43 - 15
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());
-
-        //    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);
-        //    }
-        //}
+        private void AddSamsungBookmarkInfo(BaseItem item, User user, XmlWriter writer)
+        {
+            if (!item.SupportsPositionTicksResume || item is Folder)
+            {
+                return;
+            }
+
+            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);
+            }
+        }
 
         /// <summary>
         /// Adds fields used by both items and folders

+ 1 - 1
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;
 

+ 15 - 0
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"
+                        }
+                    }
                 }
             };
 

+ 3 - 4
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

+ 3 - 3
Emby.Dlna/Profiles/Xml/BubbleUPnp.xml

@@ -40,9 +40,9 @@
     <DirectPlayProfile container="" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles />
   <CodecProfiles />

+ 3 - 3
Emby.Dlna/Profiles/Xml/Default.xml

@@ -33,9 +33,9 @@
     <DirectPlayProfile container="mp3,wma,aac,wav" type="Audio" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles />
   <CodecProfiles />

+ 3 - 3
Emby.Dlna/Profiles/Xml/Denon AVR.xml

@@ -37,9 +37,9 @@
     <DirectPlayProfile container="mp3,flac,m4a,wma" type="Audio" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles />
   <CodecProfiles />

+ 2 - 2
Emby.Dlna/Profiles/Xml/DirecTV HD-DVR.xml

@@ -39,8 +39,8 @@
     <DirectPlayProfile container="jpeg,jpg" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mpeg" type="Video" videoCodec="mpeg2video" audioCodec="mp2" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mpeg" type="Video" videoCodec="mpeg2video" audioCodec="mp2" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles />
   <CodecProfiles>

+ 9 - 3
Emby.Dlna/Profiles/Xml/Dish Hopper-Joey.xml

@@ -43,9 +43,9 @@
     <DirectPlayProfile container="jpeg" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="mp4" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="mp4" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles />
   <CodecProfiles>
@@ -80,6 +80,12 @@
       </Conditions>
       <ApplyConditions />
     </CodecProfile>
+    <CodecProfile type="VideoAudio">
+      <Conditions>
+        <ProfileCondition condition="Equals" property="IsSecondaryAudio" value="false" isRequired="true" />
+      </Conditions>
+      <ApplyConditions />
+    </CodecProfile>
   </CodecProfiles>
   <ResponseProfiles>
     <ResponseProfile container="mkv,ts" type="Video" mimeType="video/mp4">

+ 3 - 3
Emby.Dlna/Profiles/Xml/Kodi.xml

@@ -40,9 +40,9 @@
     <DirectPlayProfile container="" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles />
   <CodecProfiles />

+ 7 - 7
Emby.Dlna/Profiles/Xml/LG Smart TV.xml

@@ -35,16 +35,16 @@
   <IgnoreTranscodeByteRangeRequests>false</IgnoreTranscodeByteRangeRequests>
   <XmlRootAttributes />
   <DirectPlayProfiles>
-    <DirectPlayProfile container="ts" audioCodec="aac,ac3,mp3" videoCodec="h264" type="Video" />
-    <DirectPlayProfile container="mkv" audioCodec="aac,ac3,mp3" videoCodec="h264" type="Video" />
-    <DirectPlayProfile container="mp4" audioCodec="aac,ac3,mp3" videoCodec="h264,mpeg4" type="Video" />
-    <DirectPlayProfile container="mp3" audioCodec="mp3" type="Audio" />
+    <DirectPlayProfile container="ts" audioCodec="aac,ac3,mp3,dca,dts" videoCodec="h264" type="Video" />
+    <DirectPlayProfile container="mkv" audioCodec="aac,ac3,mp3,dca,dts" videoCodec="h264" type="Video" />
+    <DirectPlayProfile container="mp4" audioCodec="aac,ac3,mp3,dca,dts" videoCodec="h264,mpeg4" type="Video" />
+    <DirectPlayProfile container="mp3" type="Audio" />
     <DirectPlayProfile container="jpeg" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3,aac,mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3,aac,mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles>
     <ContainerProfile type="Photo">

+ 3 - 3
Emby.Dlna/Profiles/Xml/Linksys DMA2100.xml

@@ -37,9 +37,9 @@
     <DirectPlayProfile container="avi,mp4,mkv,ts" type="Video" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles />
   <CodecProfiles />

+ 3 - 3
Emby.Dlna/Profiles/Xml/MediaMonkey.xml

@@ -43,9 +43,9 @@
     <DirectPlayProfile container="ogg" audioCodec="vorbis" type="Audio" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles />
   <CodecProfiles />

+ 3 - 3
Emby.Dlna/Profiles/Xml/Panasonic Viera.xml

@@ -50,9 +50,9 @@
     <DirectPlayProfile container="jpeg" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles>
     <ContainerProfile type="Photo">

+ 3 - 3
Emby.Dlna/Profiles/Xml/Popcorn Hour.xml

@@ -38,9 +38,9 @@
     <DirectPlayProfile container="jpeg,gif,bmp,png" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="mp4" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="mp4" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles />
   <CodecProfiles>

+ 3 - 3
Emby.Dlna/Profiles/Xml/Samsung Smart TV.xml

@@ -50,9 +50,9 @@
     <DirectPlayProfile container="jpeg" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3" estimateContentLength="true" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3" estimateContentLength="true" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles>
     <ContainerProfile type="Photo">

+ 3 - 3
Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2013.xml

@@ -52,9 +52,9 @@
     <DirectPlayProfile container="jpeg,png,gif" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="mkv" type="Video" videoCodec="h264" audioCodec="ac3,aac,mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="mkv" type="Video" videoCodec="h264" audioCodec="ac3,aac,mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles>
     <ContainerProfile type="Photo">

+ 3 - 3
Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2014.xml

@@ -52,9 +52,9 @@
     <DirectPlayProfile container="jpeg,png,gif" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="mkv" type="Video" videoCodec="h264" audioCodec="ac3,aac,mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="mkv" type="Video" videoCodec="h264" audioCodec="ac3,aac,mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles>
     <ContainerProfile type="Photo">

+ 3 - 3
Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2015.xml

@@ -50,9 +50,9 @@
     <DirectPlayProfile container="jpeg,png,gif" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="mkv" type="Video" videoCodec="h264" audioCodec="ac3,aac,mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="mkv" type="Video" videoCodec="h264" audioCodec="ac3,aac,mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles>
     <ContainerProfile type="Photo">

+ 3 - 3
Emby.Dlna/Profiles/Xml/Sony Blu-ray Player 2016.xml

@@ -50,9 +50,9 @@
     <DirectPlayProfile container="jpeg,png,gif" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="mkv" type="Video" videoCodec="h264" audioCodec="ac3,aac,mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="mkv" type="Video" videoCodec="h264" audioCodec="ac3,aac,mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles>
     <ContainerProfile type="Photo">

+ 3 - 3
Emby.Dlna/Profiles/Xml/Sony Blu-ray Player.xml

@@ -47,9 +47,9 @@
     <DirectPlayProfile container="jpeg" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="ts" type="Video" videoCodec="mpeg2video" audioCodec="ac3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="ts" type="Video" videoCodec="mpeg2video" audioCodec="ac3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles>
     <ContainerProfile type="Photo">

+ 3 - 3
Emby.Dlna/Profiles/Xml/Sony Bravia (2010).xml

@@ -45,9 +45,9 @@
     <DirectPlayProfile container="mp3" audioCodec="mp3" type="Audio" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3" estimateContentLength="false" enableMpegtsM2TsMode="true" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3" estimateContentLength="false" enableMpegtsM2TsMode="true" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles>
     <ContainerProfile type="Photo">

+ 3 - 3
Emby.Dlna/Profiles/Xml/Sony Bravia (2011).xml

@@ -48,9 +48,9 @@
     <DirectPlayProfile container="asf" audioCodec="wmav2,wmapro,wmavoice" type="Audio" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3" estimateContentLength="false" enableMpegtsM2TsMode="true" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3" estimateContentLength="false" enableMpegtsM2TsMode="true" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles>
     <ContainerProfile type="Photo">

+ 3 - 3
Emby.Dlna/Profiles/Xml/Sony Bravia (2012).xml

@@ -50,9 +50,9 @@
     <DirectPlayProfile container="jpeg" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3" estimateContentLength="false" enableMpegtsM2TsMode="true" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3" estimateContentLength="false" enableMpegtsM2TsMode="true" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles>
     <ContainerProfile type="Photo">

+ 3 - 3
Emby.Dlna/Profiles/Xml/Sony Bravia (2013).xml

@@ -55,9 +55,9 @@
     <DirectPlayProfile container="jpeg" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3" estimateContentLength="false" enableMpegtsM2TsMode="true" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3" estimateContentLength="false" enableMpegtsM2TsMode="true" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles>
     <ContainerProfile type="Photo">

+ 3 - 3
Emby.Dlna/Profiles/Xml/Sony Bravia (2014).xml

@@ -55,9 +55,9 @@
     <DirectPlayProfile container="jpeg" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3" estimateContentLength="false" enableMpegtsM2TsMode="true" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3" estimateContentLength="false" enableMpegtsM2TsMode="true" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles>
     <ContainerProfile type="Photo">

+ 3 - 3
Emby.Dlna/Profiles/Xml/Sony PlayStation 3.xml

@@ -45,9 +45,9 @@
     <DirectPlayProfile container="jpeg,png,gif,bmp,tiff" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3,aac,mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3,aac,mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles>
     <ContainerProfile type="Photo">

+ 3 - 3
Emby.Dlna/Profiles/Xml/Sony PlayStation 4.xml

@@ -45,9 +45,9 @@
     <DirectPlayProfile container="jpeg,png,gif,bmp,tiff" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles>
     <ContainerProfile type="Photo">

+ 3 - 3
Emby.Dlna/Profiles/Xml/Vlc.xml

@@ -40,9 +40,9 @@
     <DirectPlayProfile container="" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles />
   <CodecProfiles />

+ 3 - 3
Emby.Dlna/Profiles/Xml/WDTV Live.xml

@@ -51,9 +51,9 @@
     <DirectPlayProfile container="jpeg,png,gif,bmp,tiff" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles>
     <ContainerProfile type="Photo">

+ 3 - 3
Emby.Dlna/Profiles/Xml/Xbox 360.xml

@@ -46,9 +46,9 @@
     <DirectPlayProfile container="jpeg" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="asf" type="Video" videoCodec="wmv2" audioCodec="wmav2" estimateContentLength="true" enableMpegtsM2TsMode="false" transcodeSeekInfo="Bytes" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="asf" type="Video" videoCodec="wmv2" audioCodec="wmav2" estimateContentLength="true" enableMpegtsM2TsMode="false" transcodeSeekInfo="Bytes" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles>
     <ContainerProfile type="Video" container="mp4,mov">

+ 3 - 3
Emby.Dlna/Profiles/Xml/Xbox One.xml

@@ -46,9 +46,9 @@
     <DirectPlayProfile container="jpeg" type="Photo" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" videoCodec="jpeg" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" videoCodec="jpeg" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles>
     <ContainerProfile type="Video" container="mp4,mov">

+ 3 - 3
Emby.Dlna/Profiles/Xml/foobar2000.xml

@@ -43,9 +43,9 @@
     <DirectPlayProfile container="ogg" audioCodec="vorbis" type="Audio" />
   </DirectPlayProfiles>
   <TranscodingProfiles>
-    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
-    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" enableSplittingOnNonKeyFrames="false" />
+    <TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
+    <TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" />
   </TranscodingProfiles>
   <ContainerProfiles />
   <CodecProfiles />

+ 7 - 3
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
             });

+ 3 - 80
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<IChannel> GetAllChannels()
         {
             return _channels
@@ -288,7 +273,7 @@ namespace Emby.Server.Implementations.Channels
             _jsonSerializer.SerializeToFile(mediaSources, path);
         }
 
-        public async Task<IEnumerable<MediaSourceInfo>> GetStaticMediaSources(BaseItem item, bool includeCachedVersions, CancellationToken cancellationToken)
+        public async Task<IEnumerable<MediaSourceInfo>> GetStaticMediaSources(BaseItem item, CancellationToken cancellationToken)
         {
             IEnumerable<ChannelMediaInfo> results = new List<ChannelMediaInfo>();
             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<IEnumerable<MediaSourceInfo>> GetDynamicMediaSources(BaseItem item, CancellationToken cancellationToken)
@@ -334,14 +311,9 @@ namespace Emby.Server.Implementations.Channels
                 results = new List<ChannelMediaInfo>();
             }
 
-            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<string, Tuple<DateTime, List<ChannelMediaInfo>>> _channelItemMediaInfo =
@@ -369,55 +341,6 @@ namespace Emby.Server.Implementations.Channels
             return list;
         }
 
-        private IEnumerable<MediaSourceInfo> 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<MediaSourceInfo>();
-        }
-
         private MediaSourceInfo GetMediaSource(BaseItem item, ChannelMediaInfo info)
         {
             var source = info.ToMediaSource();

+ 2 - 2
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

+ 12 - 0
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)

+ 9 - 1
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)
                     {

+ 5 - 2
Emby.Server.Implementations/Emby.Server.Implementations.csproj

@@ -312,8 +312,8 @@
       <HintPath>..\packages\Emby.XmlTv.1.0.3\lib\portable-net45+win8\Emby.XmlTv.dll</HintPath>
       <Private>True</Private>
     </Reference>
-    <Reference Include="MediaBrowser.Naming, Version=1.0.6178.4191, Culture=neutral, processorArchitecture=MSIL">
-      <HintPath>..\packages\MediaBrowser.Naming.1.0.3\lib\portable-net45+win8\MediaBrowser.Naming.dll</HintPath>
+    <Reference Include="MediaBrowser.Naming, Version=1.0.6201.24431, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\MediaBrowser.Naming.1.0.4\lib\portable-net45+win8\MediaBrowser.Naming.dll</HintPath>
       <Private>True</Private>
     </Reference>
     <Reference Include="SQLitePCL.pretty, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
@@ -424,6 +424,9 @@
   <ItemGroup>
     <EmbeddedResource Include="Localization\Ratings\us.txt" />
   </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Localization\Ratings\uk.txt" />
+  </ItemGroup>
   <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.

+ 3 - 1
Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs

@@ -51,7 +51,7 @@ namespace Emby.Server.Implementations.EntryPoints
 
             if (_appHost.HasPendingRestart)
             {
-                _timer = _timerFactory.Create(TimerCallback, null, TimeSpan.FromMinutes(10), TimeSpan.FromMinutes(10));
+                _timer = _timerFactory.Create(TimerCallback, null, TimeSpan.FromMinutes(15), TimeSpan.FromMinutes(15));
             }
         }
 
@@ -65,6 +65,8 @@ namespace Emby.Server.Implementations.EntryPoints
                 {
                     DisposeTimer();
 
+                    _logger.Info("Automatically restarting the system because it is idle and a restart is required.");
+
                     try
                     {
                         _appHost.Restart();

+ 32 - 15
Emby.Server.Implementations/HttpServer/HttpListenerHost.cs

@@ -91,16 +91,12 @@ namespace Emby.Server.Implementations.HttpServer
 
         readonly Dictionary<Type, int> _mapExceptionToStatusCode = new Dictionary<Type, int>
             {
-                {typeof (InvalidOperationException), 500},
-                {typeof (NotImplementedException), 500},
                 {typeof (ResourceNotFoundException), 404},
                 {typeof (FileNotFoundException), 404},
                 //{typeof (DirectoryNotFoundException), 404},
                 {typeof (SecurityException), 401},
                 {typeof (PaymentRequiredException), 402},
-                {typeof (UnauthorizedAccessException), 500},
-                {typeof (PlatformNotSupportedException), 500},
-                {typeof (NotSupportedException), 500}
+                {typeof (ArgumentException), 400}
             };
 
         public override void Configure()
@@ -228,11 +224,30 @@ namespace Emby.Server.Implementations.HttpServer
             }
         }
 
-        private void ErrorHandler(Exception ex, IRequest httpReq)
+        private int GetStatusCode(Exception ex)
+        {
+            if (ex is ArgumentException)
+            {
+                return 400;
+            }
+
+            int statusCode;
+            if (!_mapExceptionToStatusCode.TryGetValue(ex.GetType(), out statusCode))
+            {
+                statusCode = 500;
+            }
+
+            return statusCode;
+        }
+
+        private void ErrorHandler(Exception ex, IRequest httpReq, bool logException = true)
         {
             try
             {
-                _logger.ErrorException("Error processing request", ex);
+                if (logException)
+                {
+                    _logger.ErrorException("Error processing request", ex);
+                }
 
                 var httpRes = httpReq.Response;
 
@@ -241,11 +256,7 @@ namespace Emby.Server.Implementations.HttpServer
                     return;
                 }
 
-                int statusCode;
-                if (!_mapExceptionToStatusCode.TryGetValue(ex.GetType(), out statusCode))
-                {
-                    statusCode = 500;
-                }
+                var statusCode = GetStatusCode(ex);
                 httpRes.StatusCode = statusCode;
 
                 httpRes.ContentType = "text/html";
@@ -264,7 +275,9 @@ namespace Emby.Server.Implementations.HttpServer
         {
             if (_listener != null)
             {
+                _logger.Info("Stopping HttpListener...");
                 _listener.Stop();
+                _logger.Info("HttpListener stopped");
             }
         }
 
@@ -529,6 +542,10 @@ namespace Emby.Server.Implementations.HttpServer
                     ErrorHandler(new FileNotFoundException(), httpReq);
                 }
             }
+            catch (OperationCanceledException ex)
+            {
+                ErrorHandler(ex, httpReq, false);
+            }
             catch (Exception ex)
             {
                 ErrorHandler(ex, httpReq);
@@ -698,19 +715,19 @@ namespace Emby.Server.Implementations.HttpServer
         protected virtual void Dispose(bool disposing)
         {
             if (_disposed) return;
+
             base.Dispose();
 
             lock (_disposeLock)
             {
                 if (_disposed) return;
 
+                _disposed = true;
+
                 if (disposing)
                 {
                     Stop();
                 }
-
-                //release unmanaged resources here...
-                _disposed = true;
             }
         }
 

+ 33 - 38
Emby.Server.Implementations/HttpServer/HttpResultFactory.cs

@@ -203,20 +203,12 @@ namespace Emby.Server.Implementations.HttpServer
             // Do not use the memoryStreamFactory here, they don't place nice with compression
             using (var ms = new MemoryStream())
             {
-                using (var compressionStream = GetCompressionStream(ms, compressionType))
-                {
-                    ContentTypes.Instance.SerializeToStream(request, dto, compressionStream);
-                    compressionStream.Dispose();
-
-                    var compressedBytes = ms.ToArray();
+                ContentTypes.Instance.SerializeToStream(request, dto, ms);
+                ms.Position = 0;
 
-                    var httpResult = new StreamWriter(compressedBytes, request.ResponseContentType, _logger);
+                var responseHeaders = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
 
-                    //httpResult.Headers["Content-Length"] = compressedBytes.Length.ToString(UsCulture);
-                    httpResult.Headers["Content-Encoding"] = compressionType;
-
-                    return httpResult;
-                }
+                return GetCompressedResult(ms, compressionType, responseHeaders, false, request.ResponseContentType).Result;
             }
         }
 
@@ -591,45 +583,53 @@ namespace Emby.Server.Implementations.HttpServer
                 };
             }
 
-            string content;
-
             using (var stream = await factoryFn().ConfigureAwait(false))
             {
-                using (var reader = new StreamReader(stream))
+                return await GetCompressedResult(stream, requestedCompressionType, responseHeaders, isHeadRequest, contentType).ConfigureAwait(false);
+            }
+        }
+
+        private async Task<IHasHeaders> GetCompressedResult(Stream stream, 
+            string requestedCompressionType, 
+            IDictionary<string,string> responseHeaders,
+            bool isHeadRequest,
+            string contentType)
+        {
+            using (var reader = new MemoryStream())
+            {
+                await stream.CopyToAsync(reader).ConfigureAwait(false);
+
+                reader.Position = 0;
+                var content = reader.ToArray();
+
+                if (content.Length >= 1024)
                 {
-                    content = await reader.ReadToEndAsync().ConfigureAwait(false);
+                    content = Compress(content, requestedCompressionType);
+                    responseHeaders["Content-Encoding"] = requestedCompressionType;
                 }
-            }
 
-            var contents = Compress(content, requestedCompressionType);
+                responseHeaders["Content-Length"] = content.Length.ToString(UsCulture);
 
-            responseHeaders["Content-Length"] = contents.Length.ToString(UsCulture);
-            responseHeaders["Content-Encoding"] = requestedCompressionType;
+                if (isHeadRequest)
+                {
+                    return GetHttpResult(new byte[] { }, contentType, true);
+                }
 
-            if (isHeadRequest)
-            {
-                return GetHttpResult(new byte[] { }, contentType, true);
+                return GetHttpResult(content, contentType, true, responseHeaders);
             }
-
-            return GetHttpResult(contents, contentType, true, responseHeaders);
         }
 
-        private byte[] Compress(string text, string compressionType)
+        private byte[] Compress(byte[] bytes, string compressionType)
         {
             if (compressionType == "deflate")
-                return Deflate(text);
+                return Deflate(bytes);
 
             if (compressionType == "gzip")
-                return GZip(text);
+                return GZip(bytes);
 
             throw new NotSupportedException(compressionType);
         }
 
-        private byte[] Deflate(string text)
-        {
-            return Deflate(Encoding.UTF8.GetBytes(text));
-        }
-
         private byte[] Deflate(byte[] bytes)
         {
             // In .NET FX incompat-ville, you can't access compressed bytes without closing DeflateStream
@@ -644,11 +644,6 @@ namespace Emby.Server.Implementations.HttpServer
             }
         }
 
-        private byte[] GZip(string text)
-        {
-            return GZip(Encoding.UTF8.GetBytes(text));
-        }
-
         private byte[] GZip(byte[] buffer)
         {
             using (var ms = new MemoryStream())

+ 1 - 1
Emby.Server.Implementations/HttpServer/IHttpListener.cs

@@ -12,7 +12,7 @@ namespace Emby.Server.Implementations.HttpServer
         /// Gets or sets the error handler.
         /// </summary>
         /// <value>The error handler.</value>
-        Action<Exception, IRequest> ErrorHandler { get; set; }
+        Action<Exception, IRequest, bool> ErrorHandler { get; set; }
 
         /// <summary>
         /// Gets or sets the request handler.

+ 2 - 2
Emby.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpListener.cs

@@ -44,7 +44,7 @@ namespace Emby.Server.Implementations.HttpServer.SocketSharp
             _httpRequestFactory = httpRequestFactory;
         }
 
-        public Action<Exception, IRequest> ErrorHandler { get; set; }
+        public Action<Exception, IRequest, bool> ErrorHandler { get; set; }
         public Func<IHttpRequest, Uri, Task> RequestHandler { get; set; }
 
         public Action<WebSocketConnectingEventArgs> WebSocketConnecting { get; set; }
@@ -102,7 +102,7 @@ namespace Emby.Server.Implementations.HttpServer.SocketSharp
                 _logger.ErrorException("Error processing request", ex);
 
                 httpReq = httpReq ?? GetRequest(context);
-                ErrorHandler(ex, httpReq);
+                ErrorHandler(ex, httpReq, true);
                 return Task.FromResult(true);
             }
 

+ 10 - 1
Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs

@@ -9,6 +9,7 @@ using System.Linq;
 using MediaBrowser.Common.IO;
 using MediaBrowser.Controller.IO;
 using MediaBrowser.Model.IO;
+using MediaBrowser.Model.Logging;
 
 namespace Emby.Server.Implementations.Library
 {
@@ -19,6 +20,7 @@ namespace Emby.Server.Implementations.Library
     {
         private readonly IFileSystem _fileSystem;
         private readonly ILibraryManager _libraryManager;
+        private readonly ILogger _logger;
 
         /// <summary>
         /// Any folder named in this list will be ignored - can be added to at runtime for extensibility
@@ -40,10 +42,11 @@ namespace Emby.Server.Implementations.Library
 
         };
         
-        public CoreResolutionIgnoreRule(IFileSystem fileSystem, ILibraryManager libraryManager)
+        public CoreResolutionIgnoreRule(IFileSystem fileSystem, ILibraryManager libraryManager, ILogger logger)
         {
             _fileSystem = fileSystem;
             _libraryManager = libraryManager;
+            _logger = logger;
         }
 
         /// <summary>
@@ -54,6 +57,12 @@ namespace Emby.Server.Implementations.Library
         /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
         public bool ShouldIgnore(FileSystemMetadata fileInfo, BaseItem parent)
         {
+            // Don't ignore top level folders
+            if (fileInfo.IsDirectory && parent is AggregateFolder)
+            {
+                return false;
+            }
+
             var filename = fileInfo.Name;
             var isHidden = fileInfo.IsHidden;
             var path = fileInfo.FullName;

+ 5 - 1
Emby.Server.Implementations/Library/LibraryManager.cs

@@ -3084,7 +3084,11 @@ namespace Emby.Server.Implementations.Library
 
             foreach (var contentType in ConfigurationManager.Configuration.ContentTypes)
             {
-                if (string.Equals(path, contentType.Name, StringComparison.OrdinalIgnoreCase)
+                if (string.IsNullOrWhiteSpace(contentType.Name))
+                {
+                    removeList.Add(contentType);
+                }
+                else if (string.Equals(path, contentType.Name, StringComparison.OrdinalIgnoreCase)
                     || _fileSystem.ContainsSubPath(path, contentType.Name))
                 {
                     removeList.Add(contentType);

+ 19 - 8
Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs

@@ -74,21 +74,21 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
 
             if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase))
             {
-                return ResolveVideos<MusicVideo>(parent, files, directoryService, false);
+                return ResolveVideos<MusicVideo>(parent, files, directoryService, false, collectionType);
             }
 
             if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) ||
                             string.Equals(collectionType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase))
             {
-                return ResolveVideos<Video>(parent, files, directoryService, false);
+                return ResolveVideos<Video>(parent, files, directoryService, false, collectionType);
             }
 
-            if (string.IsNullOrEmpty(collectionType))
+            if (string.IsNullOrWhiteSpace(collectionType))
             {
                 // Owned items should just use the plain video type
                 if (parent == null)
                 {
-                    return ResolveVideos<Video>(parent, files, directoryService, false);
+                    return ResolveVideos<Video>(parent, files, directoryService, false, collectionType);
                 }
 
                 if (parent is Series || parent.GetParents().OfType<Series>().Any())
@@ -96,18 +96,18 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
                     return null;
                 }
 
-                return ResolveVideos<Movie>(parent, files, directoryService, false);
+                return ResolveVideos<Movie>(parent, files, directoryService, false, collectionType);
             }
 
             if (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase))
             {
-                return ResolveVideos<Movie>(parent, files, directoryService, true);
+                return ResolveVideos<Movie>(parent, files, directoryService, true, collectionType);
             }
 
             return null;
         }
 
-        private MultiItemResolverResult ResolveVideos<T>(Folder parent, IEnumerable<FileSystemMetadata> fileSystemEntries, IDirectoryService directoryService, bool suppportMultiEditions)
+        private MultiItemResolverResult ResolveVideos<T>(Folder parent, IEnumerable<FileSystemMetadata> fileSystemEntries, IDirectoryService directoryService, bool suppportMultiEditions, string collectionType)
             where T : Video, new()
         {
             var files = new List<FileSystemMetadata>();
@@ -117,6 +117,16 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
             // Loop through each child file/folder and see if we find a video
             foreach (var child in fileSystemEntries)
             {
+                // This is a hack but currently no better way to resolve a sometimes ambiguous situation
+                if (string.IsNullOrWhiteSpace(collectionType))
+                {
+                    if (string.Equals(child.Name, "tvshow.nfo", StringComparison.OrdinalIgnoreCase) ||
+                        string.Equals(child.Name, "season.nfo", StringComparison.OrdinalIgnoreCase))
+                    {
+                        return null;
+                    }
+                }
+
                 if (child.IsDirectory)
                 {
                     leftOver.Add(child);
@@ -408,7 +418,8 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
                                         !string.Equals(collectionType, CollectionType.Photos) &&
                                         !string.Equals(collectionType, CollectionType.MusicVideos);
 
-                var result = ResolveVideos<T>(parent, fileSystemEntries, directoryService, supportsMultiVersion);
+                var result = ResolveVideos<T>(parent, fileSystemEntries, directoryService, supportsMultiVersion, collectionType) ??
+                    new MultiItemResolverResult();
 
                 if (result.Items.Count == 1)
                 {

+ 7 - 1
Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs

@@ -34,7 +34,13 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
             var httpRequestOptions = new HttpRequestOptions
             {
                 Url = mediaSource.Path,
-                BufferContent = false
+                BufferContent = false,
+
+                // Some remote urls will expect a user agent to be supplied
+                UserAgent = "Emby/3.0",
+
+                // Shouldn't matter but may cause issues
+                EnableHttpCompression = false
             };
 
             using (var response = await _httpClient.SendAsync(httpRequestOptions, "GET").ConfigureAwait(false))

+ 15 - 2
Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs

@@ -422,7 +422,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
             }
 
             var showType = details.showType ?? string.Empty;
-
+            
             var info = new ProgramInfo
             {
                 ChannelId = channel,
@@ -440,10 +440,23 @@ namespace Emby.Server.Implementations.LiveTv.Listings
                 IsKids = string.Equals(details.audience, "children", StringComparison.OrdinalIgnoreCase),
                 IsSports = showType.IndexOf("sports", StringComparison.OrdinalIgnoreCase) != -1,
                 IsMovie = showType.IndexOf("movie", StringComparison.OrdinalIgnoreCase) != -1 || showType.IndexOf("film", StringComparison.OrdinalIgnoreCase) != -1,
-                ShowId = programInfo.programID,
                 Etag = programInfo.md5
             };
 
+            var showId = programInfo.programID ?? string.Empty;
+
+            // According to SchedulesDirect, these are generic, unidentified episodes
+            // SH005316560000
+            var hasUniqueShowId = !showId.StartsWith("SH", StringComparison.OrdinalIgnoreCase) ||
+                !showId.EndsWith("0000", StringComparison.OrdinalIgnoreCase);
+
+            if (!hasUniqueShowId)
+            {
+                showId = newID;
+            }
+
+            info.ShowId = showId;
+
             if (programInfo.videoProperties != null)
             {
                 info.IsHD = programInfo.videoProperties.Contains("hdtv", StringComparer.OrdinalIgnoreCase);

+ 1 - 1
Emby.Server.Implementations/LiveTv/LiveTvManager.cs

@@ -2647,7 +2647,7 @@ namespace Emby.Server.Implementations.LiveTv
         public GuideInfo GetGuideInfo()
         {
             var startDate = DateTime.UtcNow;
-            var endDate = startDate.AddDays(14);
+            var endDate = startDate.AddDays(GetGuideDays());
 
             return new GuideInfo
             {

+ 7 - 0
Emby.Server.Implementations/Localization/Ratings/uk.txt

@@ -0,0 +1,7 @@
+UK-U,1
+UK-PG,5
+UK-12,7
+UK-12A,7
+UK-15,9
+UK-18,10
+UK-R18,15

+ 1 - 1
Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs

@@ -62,7 +62,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
                 new TaskTriggerInfo
                 {
                     Type = TaskTriggerInfo.TriggerDaily,
-                    TimeOfDayTicks = TimeSpan.FromHours(1).Ticks,
+                    TimeOfDayTicks = TimeSpan.FromHours(2).Ticks,
                     MaxRuntimeMs = Convert.ToInt32(TimeSpan.FromHours(4).TotalMilliseconds)
                 }
             };

+ 1 - 15
Emby.Server.Implementations/Sync/CloudSyncProfile.cs

@@ -68,7 +68,7 @@ namespace Emby.Server.Implementations.Sync
                         },
                         new ProfileCondition
                         {
-                            Condition = ProfileConditionType.EqualsAny,
+                            Condition = ProfileConditionType.Equals,
                             Property = ProfileConditionValue.NumVideoStreams,
                             Value = "1",
                             IsRequired = false
@@ -230,20 +230,6 @@ namespace Emby.Server.Implementations.Sync
                 Codec = "aac,mp3",
                 Conditions = new[]
                     {
-                        new ProfileCondition
-                        {
-                            Condition = ProfileConditionType.LessThanEqual,
-                            Property = ProfileConditionValue.AudioChannels,
-                            Value = "2",
-                            IsRequired = true
-                        },
-                        new ProfileCondition
-                        {
-                            Condition = ProfileConditionType.LessThanEqual,
-                            Property = ProfileConditionValue.AudioBitrate,
-                            Value = "320000",
-                            IsRequired = true
-                        },
                         new ProfileCondition
                         {
                             Condition = ProfileConditionType.Equals,

+ 9 - 1
Emby.Server.Implementations/Sync/SyncJobProcessor.cs

@@ -515,8 +515,14 @@ namespace Emby.Server.Implementations.Sync
 
             jobItem.Progress = 0;
 
-            var syncOptions = _config.GetSyncOptions();
             var job = _syncManager.GetJob(jobItem.JobId);
+            if (job == null)
+            {
+                _logger.Error("Job not found. Cannot complete the sync job.");
+                await _syncManager.CancelJobItem(jobItem.Id).ConfigureAwait(false);
+                return;
+            }
+
             var user = _userManager.GetUserById(job.UserId);
             if (user == null)
             {
@@ -552,6 +558,8 @@ namespace Emby.Server.Implementations.Sync
                 }
             }
 
+            var syncOptions = _config.GetSyncOptions();
+
             var video = item as Video;
             if (video != null)
             {

+ 24 - 20
Emby.Server.Implementations/Sync/SyncManager.cs

@@ -1030,6 +1030,18 @@ namespace Emby.Server.Implementations.Sync
                 {
                     await CancelJobItem(jobItem.Id).ConfigureAwait(false);
                 }
+
+                var syncJobResult = await GetJobs(new SyncJobQuery
+                {
+                    ItemId = item,
+                    TargetId = targetId
+
+                }).ConfigureAwait(false);
+
+                foreach (var job in syncJobResult.Items)
+                {
+                    await CancelJob(job.Id).ConfigureAwait(false);
+                }
             }
         }
 
@@ -1037,15 +1049,7 @@ namespace Emby.Server.Implementations.Sync
         {
             var jobItem = _repo.GetJobItem(id);
 
-            if (jobItem.Status != SyncJobItemStatus.Queued && jobItem.Status != SyncJobItemStatus.ReadyToTransfer && jobItem.Status != SyncJobItemStatus.Converting && jobItem.Status != SyncJobItemStatus.Failed && jobItem.Status != SyncJobItemStatus.Synced && jobItem.Status != SyncJobItemStatus.Transferring)
-            {
-                throw new ArgumentException("Operation is not valid for this job item");
-            }
-
-            if (jobItem.Status != SyncJobItemStatus.Synced)
-            {
-                jobItem.Status = SyncJobItemStatus.Cancelled;
-            }
+            jobItem.Status = SyncJobItemStatus.Cancelled;
 
             jobItem.Progress = 0;
             jobItem.IsMarkedForRemoval = true;
@@ -1071,18 +1075,18 @@ namespace Emby.Server.Implementations.Sync
                 _logger.ErrorException("Error deleting directory {0}", ex, path);
             }
 
-            //var jobItemsResult = GetJobItems(new SyncJobItemQuery
-            //{
-            //    AddMetadata = false,
-            //    JobId = jobItem.JobId,
-            //    Limit = 0,
-            //    Statuses = new[] { SyncJobItemStatus.Converting, SyncJobItemStatus.Failed, SyncJobItemStatus.Queued, SyncJobItemStatus.ReadyToTransfer, SyncJobItemStatus.Synced, SyncJobItemStatus.Transferring }
-            //});
+            var jobItemsResult = GetJobItems(new SyncJobItemQuery
+            {
+                AddMetadata = false,
+                JobId = jobItem.JobId,
+                Limit = 0,
+                Statuses = new[] { SyncJobItemStatus.Converting, SyncJobItemStatus.Queued, SyncJobItemStatus.ReadyToTransfer, SyncJobItemStatus.Synced, SyncJobItemStatus.Transferring }
+            });
 
-            //if (jobItemsResult.TotalRecordCount == 0)
-            //{
-            //    await CancelJob(jobItem.JobId).ConfigureAwait(false);
-            //}
+            if (jobItemsResult.TotalRecordCount == 0)
+            {
+                await CancelJob(jobItem.JobId).ConfigureAwait(false);
+            }
         }
 
         public Task MarkJobItemForRemoval(string id)

+ 12 - 0
Emby.Server.Implementations/Sync/SyncNotificationEntryPoint.cs

@@ -38,6 +38,18 @@ namespace Emby.Server.Implementations.Sync
 
                 }
             }
+
+            if (item.Status == SyncJobItemStatus.Cancelled)
+            {
+                try
+                {
+                    await _sessionManager.SendMessageToUserDeviceSessions(item.TargetId, "SyncJobItemCancelled", item, CancellationToken.None).ConfigureAwait(false);
+                }
+                catch
+                {
+
+                }
+            }
         }
 
         public void Dispose()

+ 58 - 31
Emby.Server.Implementations/Sync/SyncRepository.cs

@@ -221,48 +221,70 @@ namespace Emby.Server.Implementations.Sync
                 using (var connection = CreateConnection())
                 {
                     string commandText;
-                    var paramList = new List<object>();
 
                     if (insert)
                     {
-                        commandText = "insert into SyncJobs (Id, TargetId, Name, Profile, Quality, Bitrate, Status, Progress, UserId, ItemIds, Category, ParentId, UnwatchedOnly, ItemLimit, SyncNewContent, DateCreated, DateLastModified, ItemCount) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+                        commandText = "insert into SyncJobs (Id, TargetId, Name, Profile, Quality, Bitrate, Status, Progress, UserId, ItemIds, Category, ParentId, UnwatchedOnly, ItemLimit, SyncNewContent, DateCreated, DateLastModified, ItemCount) values (@Id, @TargetId, @Name, @Profile, @Quality, @Bitrate, @Status, @Progress, @UserId, @ItemIds, @Category, @ParentId, @UnwatchedOnly, @ItemLimit, @SyncNewContent, @DateCreated, @DateLastModified, @ItemCount)";
                     }
                     else
                     {
-                        commandText = "update SyncJobs set TargetId=?,Name=?,Profile=?,Quality=?,Bitrate=?,Status=?,Progress=?,UserId=?,ItemIds=?,Category=?,ParentId=?,UnwatchedOnly=?,ItemLimit=?,SyncNewContent=?,DateCreated=?,DateLastModified=?,ItemCount=? where Id=?";
+                        commandText = "update SyncJobs set TargetId=@TargetId,Name=@Name,Profile=@Profile,Quality=@Quality,Bitrate=@Bitrate,Status=@Status,Progress=@Progress,UserId=@UserId,ItemIds=@ItemIds,Category=@Category,ParentId=@ParentId,UnwatchedOnly=@UnwatchedOnly,ItemLimit=@ItemLimit,SyncNewContent=@SyncNewContent,DateCreated=@DateCreated,DateLastModified=@DateLastModified,ItemCount=@ItemCount where Id=@Id";
                     }
 
-                    paramList.Add(job.TargetId);
-                    paramList.Add(job.Name);
-                    paramList.Add(job.Profile);
-                    paramList.Add(job.Quality);
-                    paramList.Add(job.Bitrate);
-                    paramList.Add(job.Status.ToString());
-                    paramList.Add(job.Progress);
-                    paramList.Add(job.UserId);
+                    connection.RunInTransaction(conn =>
+                    {
+                        using (var statement = PrepareStatementSafe(connection, commandText))
+                        {
+                            statement.TryBind("@TargetId", job.TargetId);
+                            statement.TryBind("@Name", job.Name);
+                            statement.TryBind("@Profile", job.Profile);
+                            statement.TryBind("@Quality", job.Quality);
+                            statement.TryBind("@Bitrate", job.Bitrate);
+                            statement.TryBind("@Status", job.Status.ToString());
+                            statement.TryBind("@Progress", job.Progress);
+                            statement.TryBind("@UserId", job.UserId);
+
+                            statement.TryBind("@ItemIds", string.Join(",", job.RequestedItemIds.ToArray()));
+
+                            if (job.Category.HasValue)
+                            {
+                                statement.TryBind("@Category", job.Category.Value.ToString());
+                            }
+                            else
+                            {
+                                statement.TryBindNull("@Category");
+                            }
 
-                    paramList.Add(string.Join(",", job.RequestedItemIds.ToArray()));
-                    paramList.Add(job.Category);
-                    paramList.Add(job.ParentId);
-                    paramList.Add(job.UnwatchedOnly);
-                    paramList.Add(job.ItemLimit);
-                    paramList.Add(job.SyncNewContent);
-                    paramList.Add(job.DateCreated.ToDateTimeParamValue());
-                    paramList.Add(job.DateLastModified.ToDateTimeParamValue());
-                    paramList.Add(job.ItemCount);
+                            if (!string.IsNullOrWhiteSpace(job.ParentId))
+                            {
+                                statement.TryBind("@ParentId", job.ParentId);
+                            }
+                            else
+                            {
+                                statement.TryBindNull("@ParentId");
+                            }
 
-                    if (insert)
-                    {
-                        paramList.Insert(0, job.Id.ToGuidParamValue());
-                    }
-                    else
-                    {
-                        paramList.Add(job.Id.ToGuidParamValue());
-                    }
+                            statement.TryBind("@UnwatchedOnly", job.UnwatchedOnly);
 
-                    connection.RunInTransaction(conn =>
-                    {
-                        conn.Execute(commandText, paramList.ToArray());
+                            if (job.ItemLimit.HasValue)
+                            {
+                                statement.TryBind("@ItemLimit", job.ItemLimit);
+                            }
+                            else
+                            {
+                                statement.TryBindNull("@ItemLimit");
+                            }
+
+                            statement.TryBind("@SyncNewContent", job.SyncNewContent);
+
+                            statement.TryBind("@DateCreated", job.DateCreated.ToDateTimeParamValue());
+                            statement.TryBind("@DateLastModified", job.DateLastModified.ToDateTimeParamValue());
+
+                            statement.TryBind("@ItemCount", job.ItemCount);
+                            statement.TryBind("@Id", job.Id.ToGuidParamValue());
+
+                            statement.MoveNext();
+                        }
                     }, TransactionMode);
                 }
             }
@@ -338,6 +360,11 @@ namespace Emby.Server.Implementations.Sync
                         whereClauses.Add("UserId=?");
                         paramList.Add(query.UserId);
                     }
+                    if (!string.IsNullOrWhiteSpace(query.ItemId))
+                    {
+                        whereClauses.Add("ItemIds like ?");
+                        paramList.Add("%" + query.ItemId + "%");
+                    }
                     if (query.SyncNewContent.HasValue)
                     {
                         whereClauses.Add("SyncNewContent=?");

+ 13 - 0
Emby.Server.Implementations/Udp/UdpServer.cs

@@ -154,6 +154,9 @@ namespace Emby.Server.Implementations.Udp
                 catch (ObjectDisposedException)
                 {
                 }
+                catch (OperationCanceledException)
+                {
+                }
                 catch (Exception ex)
                 {
                     _logger.ErrorException("Error receiving udp message", ex);
@@ -167,6 +170,11 @@ namespace Emby.Server.Implementations.Udp
         /// <param name="message">The message.</param>
         private void OnMessageReceived(SocketReceiveResult message)
         {
+            if (_isDisposed)
+            {
+                return;
+            }
+
             if (message.RemoteEndPoint.Port == 0)
             {
                 return;
@@ -221,6 +229,11 @@ namespace Emby.Server.Implementations.Udp
 
         public async Task SendAsync(byte[] bytes, IpEndPointInfo remoteEndPoint)
         {
+            if (_isDisposed)
+            {
+                throw new ObjectDisposedException(GetType().Name);
+            }
+
             if (bytes == null)
             {
                 throw new ArgumentNullException("bytes");

+ 1 - 1
Emby.Server.Implementations/packages.config

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
   <package id="Emby.XmlTv" version="1.0.3" targetFramework="portable45-net45+win8" />
-  <package id="MediaBrowser.Naming" version="1.0.3" targetFramework="portable45-net45+win8" />
+  <package id="MediaBrowser.Naming" version="1.0.4" targetFramework="portable45-net45+win8" />
   <package id="SQLitePCL.pretty" version="1.1.0" targetFramework="portable45-net45+win8" />
   <package id="SQLitePCLRaw.core" version="1.1.1" targetFramework="portable45-net45+win8" />
   <package id="UniversalDetector" version="1.0.1" targetFramework="portable45-net45+win8" />

+ 1 - 0
MediaBrowser.Api/ItemUpdateService.cs

@@ -99,6 +99,7 @@ namespace MediaBrowser.Api
             var path = item.ContainingFolderPath;
 
             var types = _config.Configuration.ContentTypes
+                .Where(i => !string.IsNullOrWhiteSpace(i.Name))
                 .Where(i => !string.Equals(i.Name, path, StringComparison.OrdinalIgnoreCase))
                 .ToList();
 

+ 54 - 32
MediaBrowser.Api/Playback/BaseStreamingService.cs

@@ -870,33 +870,47 @@ namespace MediaBrowser.Api.Playback
                 inputChannels = null;
             }
 
-            int? resultChannels = null;
+            int? transcoderChannelLimit = null;
             var codec = outputAudioCodec ?? string.Empty;
 
             if (codec.IndexOf("wma", StringComparison.OrdinalIgnoreCase) != -1)
             {
                 // wmav2 currently only supports two channel output
-                resultChannels = Math.Min(2, inputChannels ?? 2);
+                transcoderChannelLimit = 2;
             }
 
-            else if (request.MaxAudioChannels.HasValue)
+            else if (codec.IndexOf("mp3", StringComparison.OrdinalIgnoreCase) != -1)
+            {
+                // libmp3lame currently only supports two channel output
+                transcoderChannelLimit = 2;
+            }
+            else
             {
-                var channelLimit = codec.IndexOf("mp3", StringComparison.OrdinalIgnoreCase) != -1
-                   ? 2
-                   : 6;
+                // If we don't have any media info then limit it to 6 to prevent encoding errors due to asking for too many channels
+                transcoderChannelLimit = 6;
+            }
 
-                if (inputChannels.HasValue)
-                {
-                    channelLimit = Math.Min(channelLimit, inputChannels.Value);
-                }
+            var isTranscodingAudio = !string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase);
+
+            int? resultChannels = null;
+            if (isTranscodingAudio)
+            {
+                resultChannels = request.TranscodingMaxAudioChannels;
+            }
+            resultChannels = resultChannels ?? request.MaxAudioChannels ?? request.AudioChannels;
 
-                // If we don't have any media info then limit it to 5 to prevent encoding errors due to asking for too many channels
-                resultChannels = Math.Min(request.MaxAudioChannels.Value, channelLimit);
+            if (inputChannels.HasValue)
+            {
+                resultChannels = resultChannels.HasValue
+                    ? Math.Min(resultChannels.Value, inputChannels.Value)
+                    : inputChannels.Value;
             }
 
-            if (request.TranscodingMaxAudioChannels.HasValue && !string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase))
+            if (isTranscodingAudio && transcoderChannelLimit.HasValue)
             {
-                resultChannels = Math.Min(request.TranscodingMaxAudioChannels.Value, resultChannels ?? inputChannels ?? request.TranscodingMaxAudioChannels.Value);
+                resultChannels = resultChannels.HasValue
+                    ? Math.Min(resultChannels.Value, transcoderChannelLimit.Value)
+                    : transcoderChannelLimit.Value;
             }
 
             return resultChannels ?? request.AudioChannels;
@@ -1054,7 +1068,19 @@ namespace MediaBrowser.Api.Playback
 
                         arg += string.Format(" -canvas_size {0}:{1}", state.VideoStream.Width.Value.ToString(CultureInfo.InvariantCulture), Convert.ToInt32(height).ToString(CultureInfo.InvariantCulture));
                     }
-                    arg += " -i \"" + state.SubtitleStream.Path + "\"";
+
+                    var subtitlePath = state.SubtitleStream.Path;
+
+                    if (string.Equals(Path.GetExtension(subtitlePath), ".sub", StringComparison.OrdinalIgnoreCase))
+                    {
+                        var idxFile = Path.ChangeExtension(subtitlePath, ".idx");
+                        if (FileSystem.FileExists(idxFile))
+                        {
+                            subtitlePath = idxFile;
+                        }
+                    }
+
+                    arg += " -i \"" + subtitlePath + "\"";
                 }
             }
 
@@ -1467,7 +1493,7 @@ namespace MediaBrowser.Api.Playback
                 }
 
                 // h264
-                return string.Format(" -b:v {0} -maxrate {0} -bufsize {1}",
+                return string.Format(" -maxrate {0} -bufsize {1}",
                     bitrate.Value.ToString(UsCulture),
                     (bitrate.Value * 2).ToString(UsCulture));
             }
@@ -1753,13 +1779,6 @@ namespace MediaBrowser.Api.Playback
                     request.Tag = val;
                 }
                 else if (i == 29)
-                {
-                    if (videoRequest != null)
-                    {
-                        videoRequest.EnableSplittingOnNonKeyFrames = string.Equals("true", val, StringComparison.OrdinalIgnoreCase);
-                    }
-                }
-                else if (i == 30)
                 {
                     if (videoRequest != null)
                     {
@@ -1948,10 +1967,15 @@ namespace MediaBrowser.Api.Playback
                 state.OutputVideoCodec = state.VideoRequest.VideoCodec;
                 state.OutputVideoBitrate = GetVideoBitrateParamValue(state.VideoRequest, state.VideoStream, state.OutputVideoCodec);
 
-                if (state.OutputVideoBitrate.HasValue)
+                if (videoRequest != null)
+                {
+                    TryStreamCopy(state, videoRequest);
+                }
+
+                if (state.OutputVideoBitrate.HasValue && !string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
                 {
                     var resolution = ResolutionNormalizer.Normalize(
-                        state.VideoStream == null ? (int?)null : state.VideoStream.BitRate,
+                        state.VideoStream == null ? (int?) null : state.VideoStream.BitRate,
                         state.OutputVideoBitrate.Value,
                         state.VideoStream == null ? null : state.VideoStream.Codec,
                         state.OutputVideoCodec,
@@ -1961,13 +1985,12 @@ namespace MediaBrowser.Api.Playback
                     videoRequest.MaxWidth = resolution.MaxWidth;
                     videoRequest.MaxHeight = resolution.MaxHeight;
                 }
-            }
 
-            ApplyDeviceProfileSettings(state);
-
-            if (videoRequest != null)
+                ApplyDeviceProfileSettings(state);
+            }
+            else
             {
-                TryStreamCopy(state, videoRequest);
+                ApplyDeviceProfileSettings(state);
             }
 
             state.OutputFilePath = GetOutputFilePath(state);
@@ -2096,7 +2119,7 @@ namespace MediaBrowser.Api.Playback
             state.MediaSource = mediaSource;
         }
 
-        protected virtual bool CanStreamCopyVideo(StreamState state)
+        protected bool CanStreamCopyVideo(StreamState state)
         {
             var request = state.VideoRequest;
             var videoStream = state.VideoStream;
@@ -2381,7 +2404,6 @@ namespace MediaBrowser.Api.Playback
                     {
                         state.VideoRequest.CopyTimestamps = transcodingProfile.CopyTimestamps;
                         state.VideoRequest.EnableSubtitlesInManifest = transcodingProfile.EnableSubtitlesInManifest;
-                        state.VideoRequest.EnableSplittingOnNonKeyFrames = transcodingProfile.EnableSplittingOnNonKeyFrames;
                     }
                 }
             }

+ 1 - 2
MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs

@@ -886,8 +886,7 @@ namespace MediaBrowser.Api.Playback.Hls
             }
 
             var mapArgs = state.IsOutputVideo ? GetMapArgs(state) : string.Empty;
-            var enableSplittingOnNonKeyFrames = state.VideoRequest.EnableSplittingOnNonKeyFrames && string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase);
-            enableSplittingOnNonKeyFrames = false;
+            var enableSplittingOnNonKeyFrames = string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase) && false;
 
             // TODO: check libavformat version for 57 50.100 and use -hls_flags split_by_time
             var hlsProtocolSupportsSplittingByTime = false;

+ 1 - 1
MediaBrowser.Api/Playback/Progressive/VideoService.cs

@@ -153,7 +153,7 @@ namespace MediaBrowser.Api.Playback.Progressive
 
                 if (!state.RunTimeTicks.HasValue)
                 {
-                    args += " -fflags +genpts -flags +global_header";
+                    args += " -flags -global_header -fflags +genpts";
                 }
 
                 return args;

+ 0 - 1
MediaBrowser.Api/Playback/StreamRequest.cs

@@ -194,7 +194,6 @@ namespace MediaBrowser.Api.Playback
         public bool CopyTimestamps { get; set; }
 
         public bool EnableSubtitlesInManifest { get; set; }
-        public bool EnableSplittingOnNonKeyFrames { get; set; }
         public bool RequireAvc { get; set; }
 
         public VideoStreamRequest()

+ 1 - 9
MediaBrowser.Controller/Channels/IChannelManager.cs

@@ -15,15 +15,8 @@ namespace MediaBrowser.Controller.Channels
         /// Adds the parts.
         /// </summary>
         /// <param name="channels">The channels.</param>
-        /// <param name="factories">The factories.</param>
         void AddParts(IEnumerable<IChannel> channels);
 
-        /// <summary>
-        /// Gets the channel download path.
-        /// </summary>
-        /// <value>The channel download path.</value>
-        string ChannelDownloadPath { get; }
-
         /// <summary>
         /// Gets the channel features.
         /// </summary>
@@ -115,10 +108,9 @@ namespace MediaBrowser.Controller.Channels
         /// Gets the channel item media sources.
         /// </summary>
         /// <param name="item">The item.</param>
-        /// <param name="includeCachedVersions">if set to <c>true</c> [include cached versions].</param>
         /// <param name="cancellationToken">The cancellation token.</param>
         /// <returns>Task{IEnumerable{MediaSourceInfo}}.</returns>
-        Task<IEnumerable<MediaSourceInfo>> GetStaticMediaSources(BaseItem item, bool includeCachedVersions, CancellationToken cancellationToken);
+        Task<IEnumerable<MediaSourceInfo>> GetStaticMediaSources(BaseItem item, CancellationToken cancellationToken);
 
         /// <summary>
         /// Gets the channel folder.

+ 1 - 1
MediaBrowser.Controller/Entities/Audio/Audio.cs

@@ -206,7 +206,7 @@ namespace MediaBrowser.Controller.Entities.Audio
         {
             if (SourceType == SourceType.Channel)
             {
-                var sources = ChannelManager.GetStaticMediaSources(this, false, CancellationToken.None)
+                var sources = ChannelManager.GetStaticMediaSources(this, CancellationToken.None)
                            .Result.ToList();
 
                 if (sources.Count > 0)

+ 1 - 1
MediaBrowser.Controller/Entities/Video.cs

@@ -549,7 +549,7 @@ namespace MediaBrowser.Controller.Entities
         {
             if (SourceType == SourceType.Channel)
             {
-                var sources = ChannelManager.GetStaticMediaSources(this, false, CancellationToken.None)
+                var sources = ChannelManager.GetStaticMediaSources(this, CancellationToken.None)
                            .Result.ToList();
 
                 if (sources.Count > 0)

+ 2 - 0
MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs

@@ -35,6 +35,7 @@ namespace MediaBrowser.Controller.MediaEncoding
 
         public string VideoCodec { get; set; }
 
+        public int? TranscodingMaxAudioChannels { get; set; }
         public int? VideoBitRate { get; set; }
         public int? AudioStreamIndex { get; set; }
         public int? VideoStreamIndex { get; set; }
@@ -86,6 +87,7 @@ namespace MediaBrowser.Controller.MediaEncoding
             MaxVideoBitDepth = info.MaxVideoBitDepth;
             SubtitleMethod = info.SubtitleDeliveryMethod;
             Context = info.Context;
+            TranscodingMaxAudioChannels = info.TranscodingMaxAudioChannels;
 
             if (info.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External)
             {

+ 5 - 0
MediaBrowser.MediaEncoding/BdInfo/BdInfoExaminer.cs

@@ -30,6 +30,11 @@ namespace MediaBrowser.MediaEncoding.BdInfo
         /// <returns>BlurayDiscInfo.</returns>
         public BlurayDiscInfo GetDiscInfo(string path)
         {
+            if (string.IsNullOrWhiteSpace(path))
+            {
+                throw new ArgumentNullException("path");
+            }
+
             var bdrom = new BDROM(path, _fileSystem, _textEncoding);
 
             bdrom.Scan();

+ 14 - 2
MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs

@@ -474,7 +474,19 @@ namespace MediaBrowser.MediaEncoding.Encoder
 
                         arg += string.Format(" -canvas_size {0}:{1}", state.VideoStream.Width.Value.ToString(CultureInfo.InvariantCulture), Convert.ToInt32(height).ToString(CultureInfo.InvariantCulture));
                     }
-                    arg += " -i \"" + state.SubtitleStream.Path + "\"";
+
+                    var subtitlePath = state.SubtitleStream.Path;
+
+                    if (string.Equals(Path.GetExtension(subtitlePath), ".sub", StringComparison.OrdinalIgnoreCase))
+                    {
+                        var idxFile = Path.ChangeExtension(subtitlePath, ".idx");
+                        if (FileSystem.FileExists(idxFile))
+                        {
+                            subtitlePath = idxFile;
+                        }
+                    }
+
+                    arg += " -i \"" + subtitlePath + "\"";
                 }
             }
 
@@ -816,7 +828,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
                 }
 
                 // h264
-                return string.Format(" -b:v {0} -maxrate {0} -bufsize {1}",
+                return string.Format(" -maxrate {0} -bufsize {1}",
                     bitrate.Value.ToString(UsCulture),
                     (bitrate.Value * 2).ToString(UsCulture));
             }

+ 32 - 12
MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs

@@ -370,30 +370,50 @@ namespace MediaBrowser.MediaEncoding.Encoder
                 inputChannels = null;
             }
 
+            int? transcoderChannelLimit = null;
             var codec = outputAudioCodec ?? string.Empty;
 
             if (codec.IndexOf("wma", StringComparison.OrdinalIgnoreCase) != -1)
             {
                 // wmav2 currently only supports two channel output
-                return Math.Min(2, inputChannels ?? 2);
+                transcoderChannelLimit = 2;
             }
 
-            if (request.MaxAudioChannels.HasValue)
+            else if (codec.IndexOf("mp3", StringComparison.OrdinalIgnoreCase) != -1)
             {
-                var channelLimit = codec.IndexOf("mp3", StringComparison.OrdinalIgnoreCase) != -1
-                   ? 2
-                   : 6;
+                // libmp3lame currently only supports two channel output
+                transcoderChannelLimit = 2;
+            }
+            else
+            {
+                // If we don't have any media info then limit it to 6 to prevent encoding errors due to asking for too many channels
+                transcoderChannelLimit = 6;
+            }
 
-                if (inputChannels.HasValue)
-                {
-                    channelLimit = Math.Min(channelLimit, inputChannels.Value);
-                }
+            var isTranscodingAudio = !string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase);
 
-                // If we don't have any media info then limit it to 5 to prevent encoding errors due to asking for too many channels
-                return Math.Min(request.MaxAudioChannels.Value, channelLimit);
+            int? resultChannels = null;
+            if (isTranscodingAudio)
+            {
+                resultChannels = request.TranscodingMaxAudioChannels;
+            }
+            resultChannels = resultChannels ?? request.MaxAudioChannels ?? request.AudioChannels;
+
+            if (inputChannels.HasValue)
+            {
+                resultChannels = resultChannels.HasValue
+                    ? Math.Min(resultChannels.Value, inputChannels.Value)
+                    : inputChannels.Value;
+            }
+
+            if (isTranscodingAudio && transcoderChannelLimit.HasValue)
+            {
+                resultChannels = resultChannels.HasValue
+                    ? Math.Min(resultChannels.Value, transcoderChannelLimit.Value)
+                    : transcoderChannelLimit.Value;
             }
 
-            return request.AudioChannels;
+            return resultChannels ?? request.AudioChannels;
         }
 
         private int? GetVideoBitrateParamValue(EncodingJobOptions request, MediaStream videoStream, string outputVideoCodec)

+ 8 - 1
MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs

@@ -95,6 +95,11 @@ namespace MediaBrowser.MediaEncoding.Encoder
             int defaultImageExtractionTimeoutMs,
             bool enableEncoderFontFile, IEnvironmentInfo environmentInfo)
         {
+            if (jsonSerializer == null)
+            {
+                throw new ArgumentNullException("jsonSerializer");
+            }
+
             _logger = logger;
             _jsonSerializer = jsonSerializer;
             ConfigurationManager = configurationManager;
@@ -282,6 +287,8 @@ namespace MediaBrowser.MediaEncoding.Encoder
                 return;
             }
 
+            _logger.Info("Attempting to update encoder path to {0}. pathType: {1}", path ?? string.Empty, pathType ?? string.Empty);
+
             Tuple<string, string> newPaths;
 
             if (string.Equals(pathType, "system", StringComparison.OrdinalIgnoreCase))
@@ -632,7 +639,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
 
                     var result = _jsonSerializer.DeserializeFromStream<InternalMediaInfoResult>(process.StandardOutput.BaseStream);
 
-                    if (result.streams == null && result.format == null)
+                    if (result == null || (result.streams == null && result.format == null))
                     {
                         throw new Exception("ffprobe failed - streams and format are both null.");
                     }

+ 4 - 6
MediaBrowser.Model/Configuration/ServerConfiguration.cs

@@ -462,11 +462,9 @@ namespace MediaBrowser.Model.Configuration
                             Type = ImageType.Art
                         },
 
-                        // Don't download this by default
-                        // Generally not used
                         new ImageOption
                         {
-                            Limit = 0,
+                            Limit = 1,
                             Type = ImageType.Logo
                         }
                     },
@@ -556,7 +554,7 @@ namespace MediaBrowser.Model.Configuration
                             Type = ImageType.Thumb
                         }
                     },
-                    DisabledMetadataFetchers = new []{ "The Open Movie Database", "TheMovieDb" }
+                    DisabledMetadataFetchers = new []{ "TheMovieDb" }
                 },
 
                 new MetadataOptions(0, 1280)
@@ -577,8 +575,8 @@ namespace MediaBrowser.Model.Configuration
                             Type = ImageType.Primary
                         }
                     },
-                    DisabledMetadataFetchers = new []{ "The Open Movie Database" },
-                    DisabledImageFetchers = new []{ "TheMovieDb" }
+                    DisabledMetadataFetchers = new []{ "The Open Movie Database", "TheMovieDb" },
+                    DisabledImageFetchers = new []{ "The Open Movie Database", "TheMovieDb" }
                 }
             };
         }

+ 0 - 1
MediaBrowser.Model/Configuration/UserConfiguration.cs

@@ -27,7 +27,6 @@ namespace MediaBrowser.Model.Configuration
         public bool DisplayMissingEpisodes { get; set; }
         public bool DisplayUnairedEpisodes { get; set; }
 
-        public string[] ExcludeFoldersFromGrouping { get; set; }
         public string[] GroupedFolders { get; set; }
 
         public SubtitlePlaybackMode SubtitleMode { get; set; }

+ 7 - 6
MediaBrowser.Model/Dlna/ConditionProcessor.cs

@@ -124,6 +124,7 @@ namespace MediaBrowser.Model.Dlna
                 switch (condition.Condition)
                 {
                     case ProfileConditionType.Equals:
+                    case ProfileConditionType.EqualsAny:
                         return currentValue.Value.Equals(expected);
                     case ProfileConditionType.GreaterThanEqual:
                         return currentValue.Value >= expected;
@@ -132,7 +133,7 @@ namespace MediaBrowser.Model.Dlna
                     case ProfileConditionType.NotEquals:
                         return !currentValue.Value.Equals(expected);
                     default:
-                        throw new InvalidOperationException("Unexpected ProfileConditionType");
+                        throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
                 }
             }
 
@@ -160,7 +161,7 @@ namespace MediaBrowser.Model.Dlna
                 case ProfileConditionType.NotEquals:
                     return !StringHelper.EqualsIgnoreCase(currentValue, expected);
                 default:
-                    throw new InvalidOperationException("Unexpected ProfileConditionType");
+                    throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
             }
         }
 
@@ -182,7 +183,7 @@ namespace MediaBrowser.Model.Dlna
                     case ProfileConditionType.NotEquals:
                         return currentValue.Value != expected;
                     default:
-                        throw new InvalidOperationException("Unexpected ProfileConditionType");
+                        throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
                 }
             }
 
@@ -211,7 +212,7 @@ namespace MediaBrowser.Model.Dlna
                     case ProfileConditionType.NotEquals:
                         return !currentValue.Value.Equals(expected);
                     default:
-                        throw new InvalidOperationException("Unexpected ProfileConditionType");
+                        throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
                 }
             }
 
@@ -240,7 +241,7 @@ namespace MediaBrowser.Model.Dlna
                     case ProfileConditionType.NotEquals:
                         return !currentValue.Value.Equals(expected);
                     default:
-                        throw new InvalidOperationException("Unexpected ProfileConditionType");
+                        throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
                 }
             }
 
@@ -264,7 +265,7 @@ namespace MediaBrowser.Model.Dlna
                 case ProfileConditionType.NotEquals:
                     return timestamp != expected;
                 default:
-                    throw new InvalidOperationException("Unexpected ProfileConditionType");
+                    throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
             }
         }
     }

+ 2 - 6
MediaBrowser.Model/Dlna/StreamBuilder.cs

@@ -410,8 +410,6 @@ namespace MediaBrowser.Model.Dlna
                 audioStreamIndex = audioStream.Index;
             }
 
-            var allMediaStreams = item.MediaStreams;
-
             MediaStream videoStream = item.VideoStream;
 
             // TODO: This doesn't accout for situation of device being able to handle media bitrate, but wifi connection not fast enough
@@ -427,7 +425,7 @@ namespace MediaBrowser.Model.Dlna
             if (isEligibleForDirectPlay || isEligibleForDirectStream)
             {
                 // See if it can be direct played
-                PlayMethod? directPlay = GetVideoDirectPlayProfile(options, item, videoStream, audioStream, isEligibleForDirectPlay, isEligibleForDirectStream, allMediaStreams);
+                PlayMethod? directPlay = GetVideoDirectPlayProfile(options, item, videoStream, audioStream, isEligibleForDirectPlay, isEligibleForDirectStream);
 
                 if (directPlay != null)
                 {
@@ -482,7 +480,6 @@ namespace MediaBrowser.Model.Dlna
                 playlistItem.VideoCodec = transcodingProfile.VideoCodec;
                 playlistItem.CopyTimestamps = transcodingProfile.CopyTimestamps;
                 playlistItem.EnableSubtitlesInManifest = transcodingProfile.EnableSubtitlesInManifest;
-                playlistItem.EnableSplittingOnNonKeyFrames = transcodingProfile.EnableSplittingOnNonKeyFrames;
 
                 if (!string.IsNullOrEmpty(transcodingProfile.MaxAudioChannels))
                 {
@@ -656,8 +653,7 @@ namespace MediaBrowser.Model.Dlna
             MediaStream videoStream,
             MediaStream audioStream,
             bool isEligibleForDirectPlay,
-            bool isEligibleForDirectStream,
-            List<MediaStream> allMediaStreams)
+            bool isEligibleForDirectStream)
         {
             DeviceProfile profile = options.Profile;
 

+ 0 - 2
MediaBrowser.Model/Dlna/StreamInfo.cs

@@ -39,7 +39,6 @@ namespace MediaBrowser.Model.Dlna
         public bool RequireAvc { get; set; }
         public bool CopyTimestamps { get; set; }
         public bool EnableSubtitlesInManifest { get; set; }
-        public bool EnableSplittingOnNonKeyFrames { get; set; }
         public string[] AudioCodecs { get; set; }
 
         public int? AudioStreamIndex { get; set; }
@@ -267,7 +266,6 @@ namespace MediaBrowser.Model.Dlna
             list.Add(new NameValuePair("EnableSubtitlesInManifest", item.EnableSubtitlesInManifest.ToString().ToLower()));
 
             list.Add(new NameValuePair("Tag", item.MediaSource.ETag ?? string.Empty));
-            list.Add(new NameValuePair("EnableSplittingOnNonKeyFrames", item.EnableSplittingOnNonKeyFrames.ToString().ToLower()));
             list.Add(new NameValuePair("RequireAvc", item.RequireAvc.ToString().ToLower()));
 
             return list;

+ 0 - 3
MediaBrowser.Model/Dlna/TranscodingProfile.cs

@@ -39,9 +39,6 @@ namespace MediaBrowser.Model.Dlna
         [XmlAttribute("enableSubtitlesInManifest")]
         public bool EnableSubtitlesInManifest { get; set; }
 
-        [XmlAttribute("enableSplittingOnNonKeyFrames")]
-        public bool EnableSplittingOnNonKeyFrames { get; set; }
-
         [XmlAttribute("maxAudioChannels")]
         public string MaxAudioChannels { get; set; }
 

+ 1 - 0
MediaBrowser.Model/Sync/SyncJobQuery.cs

@@ -24,6 +24,7 @@ namespace MediaBrowser.Model.Sync
         /// <value>The user identifier.</value>
         public string UserId { get; set; }
         public string ExcludeTargetIds { get; set; }
+        public string ItemId { get; set; }
         /// <summary>
         /// Gets or sets the status.
         /// </summary>

+ 5 - 0
MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs

@@ -328,6 +328,11 @@ namespace MediaBrowser.Providers.MediaInfo
         /// <returns>VideoStream.</returns>
         private BlurayDiscInfo GetBDInfo(string path)
         {
+            if (string.IsNullOrWhiteSpace(path))
+            {
+                throw new ArgumentNullException("path");
+            }
+
             try
             {
                 return _blurayExaminer.GetDiscInfo(path);

+ 3 - 3
MediaBrowser.Providers/Omdb/OmdbProvider.cs

@@ -46,7 +46,7 @@ namespace MediaBrowser.Providers.Omdb
 
             T item = itemResult.Item;
 
-            var result = await GetRootObject(imdbId, cancellationToken);
+            var result = await GetRootObject(imdbId, cancellationToken).ConfigureAwait(false);
 
             // Only take the name and rating if the user's language is set to english, since Omdb has no localization
             if (string.Equals(language, "en", StringComparison.OrdinalIgnoreCase))
@@ -221,7 +221,7 @@ namespace MediaBrowser.Providers.Omdb
 
         internal async Task<RootObject> GetRootObject(string imdbId, CancellationToken cancellationToken)
         {
-            var path = await EnsureItemInfo(imdbId, cancellationToken);
+            var path = await EnsureItemInfo(imdbId, cancellationToken).ConfigureAwait(false);
 
             string resultString;
 
@@ -240,7 +240,7 @@ namespace MediaBrowser.Providers.Omdb
 
         internal async Task<SeasonRootObject> GetSeasonRootObject(string imdbId, int seasonId, CancellationToken cancellationToken)
         {
-            var path = await EnsureSeasonInfo(imdbId, seasonId, cancellationToken);
+            var path = await EnsureSeasonInfo(imdbId, seasonId, cancellationToken).ConfigureAwait(false);
 
             string resultString;
 

+ 7 - 1
MediaBrowser.Providers/TV/MissingEpisodeProvider.cs

@@ -87,6 +87,12 @@ namespace MediaBrowser.Providers.TV
 
             var seriesDataPath = TvdbSeriesProvider.GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds);
 
+            // Doesn't have required provider id's
+            if (string.IsNullOrWhiteSpace(seriesDataPath))
+            {
+                return;
+            }
+
             var episodeFiles = _fileSystem.GetFilePaths(seriesDataPath)
                 .Where(i => string.Equals(Path.GetExtension(i), ".xml", StringComparison.OrdinalIgnoreCase))
                 .Select(Path.GetFileNameWithoutExtension)
@@ -238,7 +244,7 @@ namespace MediaBrowser.Providers.TV
                 var targetSeries = DetermineAppropriateSeries(series, tuple.Item1);
                 var seasonOffset = TvdbSeriesProvider.GetSeriesOffset(targetSeries.ProviderIds) ?? ((targetSeries.AnimeSeriesIndex ?? 1) - 1);
 
-                var unairedThresholdDays = 1;
+                var unairedThresholdDays = 2;
                 now = now.AddDays(0 - unairedThresholdDays);
 
                 if (airDate.Value < now)

+ 8 - 4
MediaBrowser.Providers/TV/Omdb/OmdbEpisodeProvider.cs

@@ -55,11 +55,15 @@ namespace MediaBrowser.Providers.TV
                 return result;
             }
 
-            if (OmdbProvider.IsValidSeries(info.SeriesProviderIds) && info.IndexNumber.HasValue && info.ParentIndexNumber.HasValue)
+            string seriesImdbId;
+            if (info.SeriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out seriesImdbId) && !string.IsNullOrEmpty(seriesImdbId))
             {
-                var seriesImdbId = info.GetProviderId(MetadataProviders.Imdb);
-
-                result.HasMetadata = await new OmdbProvider(_jsonSerializer, _httpClient, _fileSystem, _configurationManager).FetchEpisodeData(result, info.IndexNumber.Value, info.ParentIndexNumber.Value, seriesImdbId, info.MetadataLanguage, info.MetadataCountryCode, cancellationToken).ConfigureAwait(false);
+                if (info.IndexNumber.HasValue &&
+                    info.ParentIndexNumber.HasValue)
+                {
+                    result.HasMetadata = await new OmdbProvider(_jsonSerializer, _httpClient, _fileSystem, _configurationManager)
+                        .FetchEpisodeData(result, info.IndexNumber.Value, info.ParentIndexNumber.Value, seriesImdbId, info.MetadataLanguage, info.MetadataCountryCode, cancellationToken).ConfigureAwait(false);
+                }
             }
 
             return result;

+ 15 - 9
MediaBrowser.Server.Mac/Emby.Server.Mac.csproj

@@ -512,9 +512,6 @@
     <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\syncactivity.html">
       <Link>Resources\dashboard-ui\syncactivity.html</Link>
     </BundleResource>
-    <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\syncjob.html">
-      <Link>Resources\dashboard-ui\syncjob.html</Link>
-    </BundleResource>
     <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\syncsettings.html">
       <Link>Resources\dashboard-ui\syncsettings.html</Link>
     </BundleResource>
@@ -929,6 +926,9 @@
     <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-apiclient\bower.json">
       <Link>Resources\dashboard-ui\bower_components\emby-apiclient\bower.json</Link>
     </BundleResource>
+    <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-apiclient\cameraroll.js">
+      <Link>Resources\dashboard-ui\bower_components\emby-apiclient\cameraroll.js</Link>
+    </BundleResource>
     <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-apiclient\connectionmanager.js">
       <Link>Resources\dashboard-ui\bower_components\emby-apiclient\connectionmanager.js</Link>
     </BundleResource>
@@ -1031,6 +1031,9 @@
     <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\filedownloader.js">
       <Link>Resources\dashboard-ui\bower_components\emby-webcomponents\filedownloader.js</Link>
     </BundleResource>
+    <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\filesystem.js">
+      <Link>Resources\dashboard-ui\bower_components\emby-webcomponents\filesystem.js</Link>
+    </BundleResource>
     <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\focusmanager.js">
       <Link>Resources\dashboard-ui\bower_components\emby-webcomponents\focusmanager.js</Link>
     </BundleResource>
@@ -1172,6 +1175,9 @@
     <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\emby-collapse\emby-collapse.js">
       <Link>Resources\dashboard-ui\bower_components\emby-webcomponents\emby-collapse\emby-collapse.js</Link>
     </BundleResource>
+    <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\emby-connect\connecthelper.js">
+      <Link>Resources\dashboard-ui\bower_components\emby-webcomponents\emby-connect\connecthelper.js</Link>
+    </BundleResource>
     <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\emby-input\emby-input.css">
       <Link>Resources\dashboard-ui\bower_components\emby-webcomponents\emby-input\emby-input.css</Link>
     </BundleResource>
@@ -1805,6 +1811,12 @@
     <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\sync\sync.js">
       <Link>Resources\dashboard-ui\bower_components\emby-webcomponents\sync\sync.js</Link>
     </BundleResource>
+    <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\sync\syncjobeditor.js">
+      <Link>Resources\dashboard-ui\bower_components\emby-webcomponents\sync\syncjobeditor.js</Link>
+    </BundleResource>
+    <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\sync\syncjoblist.js">
+      <Link>Resources\dashboard-ui\bower_components\emby-webcomponents\sync\syncjoblist.js</Link>
+    </BundleResource>
     <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\bower_components\emby-webcomponents\sync\synctoggle.js">
       <Link>Resources\dashboard-ui\bower_components\emby-webcomponents\sync\synctoggle.js</Link>
     </BundleResource>
@@ -2684,9 +2696,6 @@
     <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\components\navdrawer\navdrawer.js">
       <Link>Resources\dashboard-ui\components\navdrawer\navdrawer.js</Link>
     </BundleResource>
-    <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\components\syncjoblist\syncjoblist.js">
-      <Link>Resources\dashboard-ui\components\syncjoblist\syncjoblist.js</Link>
-    </BundleResource>
     <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\components\tvproviders\schedulesdirect.js">
       <Link>Resources\dashboard-ui\components\tvproviders\schedulesdirect.js</Link>
     </BundleResource>
@@ -3347,9 +3356,6 @@
     <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\scripts\syncactivity.js">
       <Link>Resources\dashboard-ui\scripts\syncactivity.js</Link>
     </BundleResource>
-    <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\scripts\syncjob.js">
-      <Link>Resources\dashboard-ui\scripts\syncjob.js</Link>
-    </BundleResource>
     <BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\scripts\syncsettings.js">
       <Link>Resources\dashboard-ui\scripts\syncsettings.js</Link>
     </BundleResource>

+ 4 - 1
MediaBrowser.Server.Mac/Main.cs

@@ -142,7 +142,10 @@ namespace MediaBrowser.Server.Mac
 
         private static EnvironmentInfo GetEnvironmentInfo()
         {
-            var info = new EnvironmentInfo();
+            var info = new EnvironmentInfo()
+            {
+                CustomOperatingSystem = MediaBrowser.Model.System.OperatingSystem.OSX
+            };
 
             var uname = GetUnixName();
 

+ 22 - 0
MediaBrowser.Server.Mono/MonoAppHost.cs

@@ -51,8 +51,11 @@ namespace MediaBrowser.Server.Mono
             }
             else if (environment.OperatingSystem == Model.System.OperatingSystem.Linux)
             {
+                info.FFMpegFilename = "ffmpeg";
+                info.FFProbeFilename = "ffprobe";
                 info.ArchiveType = "7z";
                 info.Version = "20160215";
+                info.DownloadUrls = GetDownloadUrls();
             }
 
             // No version available - user requirement
@@ -61,6 +64,25 @@ namespace MediaBrowser.Server.Mono
             return info;
         }
 
+        private string[] GetDownloadUrls()
+        {
+            switch (EnvironmentInfo.SystemArchitecture)
+            {
+                case Architecture.X64:
+                    return new[]
+                    {
+                                "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-64bit-static.7z"
+                    };
+                case Architecture.X86:
+                    return new[]
+                    {
+                                "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-32bit-static.7z"
+                    };
+            }
+
+            return new string[] { };
+        }
+
         protected override void RestartInternal()
         {
             MainClass.Restart(StartupOptions);

+ 2 - 67
MediaBrowser.ServerApplication/Native/LnkShortcutHandler.cs

@@ -1,6 +1,7 @@
 using System;
 using System.IO;
 using System.Runtime.InteropServices;
+using System.Runtime.InteropServices.ComTypes;
 using System.Security;
 using System.Text;
 using MediaBrowser.Model.IO;
@@ -52,7 +53,7 @@ namespace MediaBrowser.ServerApplication.Native
         /// <summary>
         /// The STG m_ READ
         /// </summary>
-        public const uint STGM_READ = 0;
+        public const int STGM_READ = 0;
     }
 
     /// <summary>
@@ -319,72 +320,6 @@ namespace MediaBrowser.ServerApplication.Native
 
     }
 
-    /// <summary>
-    /// Interface IPersist
-    /// </summary>
-    [ComImport, Guid("0000010c-0000-0000-c000-000000000046"),
-    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
-    public interface IPersist
-    {
-        /// <summary>
-        /// Gets the class ID.
-        /// </summary>
-        /// <param name="pClassID">The p class ID.</param>
-        [PreserveSig]
-        void GetClassID(out Guid pClassID);
-    }
-
-    /// <summary>
-    /// Interface IPersistFile
-    /// </summary>
-    [ComImport, Guid("0000010b-0000-0000-C000-000000000046"),
-    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
-    public interface IPersistFile : IPersist
-    {
-        /// <summary>
-        /// Gets the class ID.
-        /// </summary>
-        /// <param name="pClassID">The p class ID.</param>
-        new void GetClassID(out Guid pClassID);
-        /// <summary>
-        /// Determines whether this instance is dirty.
-        /// </summary>
-        [PreserveSig]
-        int IsDirty();
-
-        /// <summary>
-        /// Loads the specified PSZ file name.
-        /// </summary>
-        /// <param name="pszFileName">Name of the PSZ file.</param>
-        /// <param name="dwMode">The dw mode.</param>
-        [PreserveSig]
-        void Load([In, MarshalAs(UnmanagedType.LPWStr)]
-            string pszFileName, uint dwMode);
-
-        /// <summary>
-        /// Saves the specified PSZ file name.
-        /// </summary>
-        /// <param name="pszFileName">Name of the PSZ file.</param>
-        /// <param name="remember">if set to <c>true</c> [remember].</param>
-        [PreserveSig]
-        void Save([In, MarshalAs(UnmanagedType.LPWStr)] string pszFileName,
-            [In, MarshalAs(UnmanagedType.Bool)] bool remember);
-
-        /// <summary>
-        /// Saves the completed.
-        /// </summary>
-        /// <param name="pszFileName">Name of the PSZ file.</param>
-        [PreserveSig]
-        void SaveCompleted([In, MarshalAs(UnmanagedType.LPWStr)] string pszFileName);
-
-        /// <summary>
-        /// Gets the cur file.
-        /// </summary>
-        /// <param name="ppszFileName">Name of the PPSZ file.</param>
-        [PreserveSig]
-        void GetCurFile([In, MarshalAs(UnmanagedType.LPWStr)] string ppszFileName);
-    }
-
     // CLSID_ShellLink from ShlGuid.h 
     /// <summary>
     /// Class ShellLink

+ 17 - 7
MediaBrowser.ServerApplication/WindowsAppHost.cs

@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using System.Diagnostics;
 using System.IO;
 using System.Reflection;
+using System.Runtime.InteropServices.ComTypes;
 using Emby.Server.Core;
 using Emby.Server.Implementations;
 using Emby.Server.Implementations.EntryPoints;
@@ -93,21 +94,30 @@ namespace MediaBrowser.ServerApplication
 
         protected override void ConfigureAutoRunInternal(bool autorun)
         {
-            var shortcutPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.StartMenu), "Emby", "Emby Server.lnk");
-
             var startupPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Startup);
 
-            if (autorun)
+            if (autorun && !MainStartup.IsRunningAsService)
             {
                 //Copy our shortut into the startup folder for this user
-                var targetPath = Path.Combine(startupPath, Path.GetFileName(shortcutPath) ?? "Emby Server.lnk");
-                FileSystemManager.CreateDirectory(Path.GetDirectoryName(targetPath));
-                File.Copy(shortcutPath, targetPath, true);
+                var targetPath = Path.Combine(startupPath, "Emby Server.lnk");
+
+                IShellLinkW link = (IShellLinkW)new ShellLink();
+
+                var appPath = Process.GetCurrentProcess().MainModule.FileName;
+
+                // setup shortcut information
+                link.SetDescription(Name);
+                link.SetPath(appPath);
+                link.SetWorkingDirectory(Path.GetDirectoryName(appPath));
+
+                // save it
+                IPersistFile file = (IPersistFile)link;
+                file.Save(targetPath, true);
             }
             else
             {
                 //Remove our shortcut from the startup folder for this user
-                FileSystemManager.DeleteFile(Path.Combine(startupPath, Path.GetFileName(shortcutPath) ?? "Emby Server.lnk"));
+                FileSystemManager.DeleteFile(Path.Combine(startupPath, "Emby Server.lnk"));
             }
         }
 

+ 0 - 9
MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj

@@ -162,9 +162,6 @@
     <Content Include="dashboard-ui\components\remotecontrolautoplay.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
-    <Content Include="dashboard-ui\components\syncjoblist\syncjoblist.js">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
     <Content Include="dashboard-ui\components\tvproviders\xmltv.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
@@ -507,9 +504,6 @@
     <Content Include="dashboard-ui\scripts\streamingsettings.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
-    <Content Include="dashboard-ui\scripts\syncjob.js">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
     <Content Include="dashboard-ui\scripts\appservices.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
@@ -534,9 +528,6 @@
     <Content Include="dashboard-ui\streamingsettings.html">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
-    <Content Include="dashboard-ui\syncjob.html">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
     <Content Include="dashboard-ui\appservices.html">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>

+ 4 - 54
OpenSubtitlesHandler/Utilities.cs

@@ -37,7 +37,9 @@ namespace OpenSubtitlesHandler
         public static IHttpClient HttpClient { get; set; }
         public static ITextEncoding EncodingHelper { get; set; }
 
-        private const string XML_RPC_SERVER = "https://api.opensubtitles.org/xml-rpc";
+        //private static string XML_RPC_SERVER = "https://api.opensubtitles.org/xml-rpc";
+        private static string XML_RPC_SERVER = "https://92.240.234.122/xml-rpc";
+        private static string HostHeader = "api.opensubtitles.org:443";
 
         /// <summary>
         /// Compute movie hash
@@ -142,32 +144,6 @@ namespace OpenSubtitlesHandler
         public static Stream SendRequest(byte[] request, string userAgent)
         {
             return SendRequestAsync(request, userAgent, CancellationToken.None).Result;
-
-            //HttpWebRequest req = (HttpWebRequest)WebRequest.Create(XML_RPC_SERVER);
-            //req.ContentType = "text/xml";
-            //req.Host = "api.opensubtitles.org:80";
-            //req.Method = "POST";
-            //req.UserAgent = "xmlrpc-epi-php/0.2 (PHP)";
-            //req.ContentLength = request.Length;
-            //ServicePointManager.Expect100Continue = false;
-            //try
-            //{
-            //    using (Stream stm = req.GetRequestStream())
-            //    {
-            //        stm.Write(request, 0, request.Length);
-            //    }
-
-            //    WebResponse response = req.GetResponse();
-            //    return response.GetResponseStream();
-            //}
-            //catch (Exception ex)
-            //{
-            //    Stream errorStream = new MemoryStream();
-            //    byte[] dd = Encoding.ASCII.GetBytes("ERROR: " + ex.Message);
-            //    errorStream.Write(dd, 0, dd.Length);
-            //    errorStream.Position = 0;
-            //    return errorStream;
-            //}
         }
 
         public static async Task<Stream> SendRequestAsync(byte[] request, string userAgent, CancellationToken cancellationToken)
@@ -177,7 +153,7 @@ namespace OpenSubtitlesHandler
                 RequestContentBytes = request,
                 RequestContentType = "text/xml",
                 UserAgent = userAgent,
-                Host = "api.opensubtitles.org:443",
+                Host = HostHeader,
                 Url = XML_RPC_SERVER,
 
                 // Response parsing will fail with this enabled
@@ -195,32 +171,6 @@ namespace OpenSubtitlesHandler
             var result = await HttpClient.Post(options).ConfigureAwait(false);
 
             return result.Content;
-
-            //HttpWebRequest req = (HttpWebRequest)WebRequest.Create(XML_RPC_SERVER);
-            //req.ContentType = "text/xml";
-            //req.Host = "api.opensubtitles.org:80";
-            //req.Method = "POST";
-            //req.UserAgent = "xmlrpc-epi-php/0.2 (PHP)";
-            //req.ContentLength = request.Length;
-            //ServicePointManager.Expect100Continue = false;
-            //try
-            //{
-            //    using (Stream stm = req.GetRequestStream())
-            //    {
-            //        stm.Write(request, 0, request.Length);
-            //    }
-
-            //    WebResponse response = req.GetResponse();
-            //    return response.GetResponseStream();
-            //}
-            //catch (Exception ex)
-            //{
-            //    Stream errorStream = new MemoryStream();
-            //    byte[] dd = Encoding.ASCII.GetBytes("ERROR: " + ex.Message);
-            //    errorStream.Write(dd, 0, dd.Length);
-            //    errorStream.Position = 0;
-            //    return errorStream;
-            //}
         }
 
     }

+ 2 - 2
RSSDP/SsdpDevicePublisherBase.cs

@@ -359,7 +359,7 @@ namespace Rssdp.Infrastructure
                 
             }
 
-            WriteTrace(String.Format("Sent search response to " + endPoint.ToString()), device);
+            //WriteTrace(String.Format("Sent search response to " + endPoint.ToString()), device);
         }
 
         private bool IsDuplicateSearchRequest(string searchTarget, IpEndPointInfo endPoint)
@@ -485,7 +485,7 @@ namespace Rssdp.Infrastructure
 
             _CommsServer.SendMulticastMessage(message);
 
-            WriteTrace(String.Format("Sent alive notification"), device);
+            //WriteTrace(String.Format("Sent alive notification"), device);
         }
 
         #endregion

+ 2 - 2
SocketHttpListener.Portable/Net/HttpConnection.cs

@@ -209,7 +209,7 @@ namespace SocketHttpListener.Net
             // TODO: can we get this stream before reading the input?
             if (o_stream == null)
             {
-                context.Response.DetermineIfChunked();
+                //context.Response.DetermineIfChunked();
 
                 if (context.Response.SendChunked || isExpect100Continue || context.Request.IsWebSocketRequest || true)
                 {
@@ -508,7 +508,7 @@ namespace SocketHttpListener.Net
             {
                 force_close |= !context.Request.KeepAlive;
                 if (!force_close)
-                    force_close = (context.Response.Headers["connection"] == "close");
+                    force_close = (string.Equals(context.Response.Headers["connection"], "close", StringComparison.OrdinalIgnoreCase));
                 /*
 				if (!force_close) {
 //					bool conn_close = (status_code == 400 || status_code == 408 || status_code == 411 ||

+ 4 - 3
SocketHttpListener.Portable/Net/HttpListenerResponse.cs

@@ -386,7 +386,7 @@ namespace SocketHttpListener.Net
 
             if (content_type != null)
             {
-                if (content_encoding != null && content_type.IndexOf("charset=", StringComparison.Ordinal) == -1)
+                if (content_encoding != null && content_type.IndexOf("charset=", StringComparison.OrdinalIgnoreCase) == -1)
                 {
                     string enc_name = content_encoding.WebName;
                     headers.SetInternal("Content-Type", content_type + "; charset=" + enc_name);
@@ -429,9 +429,10 @@ namespace SocketHttpListener.Net
              *	HttpStatusCode.InternalServerError 	500
              *	HttpStatusCode.ServiceUnavailable 	503
              */
-            bool conn_close = (status_code == 408 || status_code == 411 ||
+            bool conn_close = status_code == 400 || status_code == 408 || status_code == 411 ||
                     status_code == 413 || status_code == 414 ||
-                    status_code == 503);
+                    status_code == 500 ||
+                    status_code == 503;
 
             if (conn_close == false)
                 conn_close = !context.Request.KeepAlive;

+ 11 - 1
SocketHttpListener.Portable/Net/ResponseStream.cs

@@ -136,6 +136,11 @@ namespace SocketHttpListener.Net
             if (disposed)
                 throw new ObjectDisposedException(GetType().ToString());
 
+            if (count == 0)
+            {
+                //return;
+            }
+
             byte[] bytes = null;
             MemoryStream ms = GetHeaders(response, _memoryStreamFactory, false);
             bool chunked = response.SendChunked;
@@ -176,6 +181,11 @@ namespace SocketHttpListener.Net
             if (disposed)
                 throw new ObjectDisposedException(GetType().ToString());
 
+            if (count == 0)
+            {
+                //return;
+            }
+
             byte[] bytes = null;
             MemoryStream ms = GetHeaders(response, _memoryStreamFactory, false);
             bool chunked = response.SendChunked;
@@ -206,7 +216,7 @@ namespace SocketHttpListener.Net
                 await stream.WriteAsync(buffer, offset, count, cancellationToken).ConfigureAwait(false);
             }
 
-            if (response.SendChunked)
+            if (chunked)
                 stream.Write(crlf, 0, 2);
         }