diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj index 118e5659a..ab77dc271 100644 --- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj +++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj @@ -413,6 +413,9 @@ Dlna\StreamInfo.cs + + Dlna\StreamInfoSorter.cs + Dlna\SubtitleDeliveryMethod.cs diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj index a97bf2a8c..b772e1753 100644 --- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj +++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj @@ -378,6 +378,9 @@ Dlna\StreamInfo.cs + + Dlna\StreamInfoSorter.cs + Dlna\SubtitleDeliveryMethod.cs diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index 7338f604c..62ac321fe 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -89,29 +89,7 @@ namespace MediaBrowser.Model.Dlna private StreamInfo GetOptimalStream(List streams) { - // Grab the first one that can be direct streamed - // If that doesn't produce anything, just take the first - foreach (StreamInfo i in streams) - { - if (i.PlayMethod == PlayMethod.DirectPlay && i.MediaSource.Protocol == MediaProtocol.File) - { - return i; - } - } - foreach (StreamInfo i in streams) - { - if (i.PlayMethod == PlayMethod.DirectPlay) - { - return i; - } - } - foreach (StreamInfo i in streams) - { - if (i.PlayMethod == PlayMethod.DirectStream) - { - return i; - } - } + streams = StreamInfoSorter.SortMediaSources(streams); foreach (StreamInfo stream in streams) { diff --git a/MediaBrowser.Model/Dlna/StreamInfoSorter.cs b/MediaBrowser.Model/Dlna/StreamInfoSorter.cs new file mode 100644 index 000000000..80eca193f --- /dev/null +++ b/MediaBrowser.Model/Dlna/StreamInfoSorter.cs @@ -0,0 +1,40 @@ +using MediaBrowser.Model.MediaInfo; +using MediaBrowser.Model.Session; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace MediaBrowser.Model.Dlna +{ + public class StreamInfoSorter + { + public static List SortMediaSources(List streams) + { + return streams.OrderBy(i => + { + switch (i.PlayMethod) + { + case PlayMethod.DirectPlay: + return 0; + case PlayMethod.DirectStream: + return 1; + case PlayMethod.Transcode: + return 2; + default: + throw new ArgumentException("Unrecognized PlayMethod"); + } + + }).ThenBy(i => + { + switch (i.MediaSource.Protocol) + { + case MediaProtocol.File: + return 0; + default: + return 1; + } + + }).ToList(); + } + } +} diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 30eec434d..fe67038df 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -126,6 +126,7 @@ + diff --git a/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs b/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs index a9affe1ec..5474892e8 100644 --- a/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs +++ b/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs @@ -268,8 +268,6 @@ namespace MediaBrowser.Server.Implementations.Drawing originalImage.CurrentImage.CompressionQuality = quality; originalImage.SaveImage(cacheFilePath); - - return cacheFilePath; } } else @@ -286,8 +284,6 @@ namespace MediaBrowser.Server.Implementations.Drawing wand.CurrentImage.CompressionQuality = quality; wand.SaveImage(cacheFilePath); - - return cacheFilePath; } } } @@ -296,6 +292,8 @@ namespace MediaBrowser.Server.Implementations.Drawing { semaphore.Release(); } + + return cacheFilePath; } private ImageFormat GetOutputFormat(ImageFormat requestedFormat) diff --git a/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs b/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs index 6fb02358e..eac0cd96d 100644 --- a/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs +++ b/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs @@ -223,8 +223,8 @@ namespace MediaBrowser.Server.Implementations.Photos protected virtual List GetFinalItems(List items, int limit) { - // Rotate the images no more than once per week - var random = new Random(GetWeekOfYear()).Next(); + // Rotate the images once every 7 days + var random = DateTime.Now.DayOfYear % 7; return items .OrderBy(i => (random + "" + items.IndexOf(i)).GetMD5()) @@ -233,18 +233,6 @@ namespace MediaBrowser.Server.Implementations.Photos .ToList(); } - private int GetWeekOfYear() - { - return DateTime.Now.Second; - var usCulture = new CultureInfo("en-US"); - var weekNo = usCulture.Calendar.GetWeekOfYear( - DateTime.Now, - usCulture.DateTimeFormat.CalendarWeekRule, - usCulture.DateTimeFormat.FirstDayOfWeek); - - return weekNo; - } - public int Order { get diff --git a/MediaBrowser.Server.Implementations/Udp/UdpServer.cs b/MediaBrowser.Server.Implementations/Udp/UdpServer.cs index 9dbffa922..966129f4b 100644 --- a/MediaBrowser.Server.Implementations/Udp/UdpServer.cs +++ b/MediaBrowser.Server.Implementations/Udp/UdpServer.cs @@ -51,6 +51,7 @@ namespace MediaBrowser.Server.Implementations.Udp AddMessageResponder("who is MediaBrowserServer?", RespondToV1Message); AddMessageResponder("who is MediaBrowserServer_v2?", RespondToV2Message); + AddMessageResponder("who is EmbyServer_v2?", RespondToV2Message); } private void AddMessageResponder(string message, Action responder) diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index 5f1c138b8..d229302bd 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.598 + 3.0.599 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption. Copyright © Media Browser 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index b5a0f3bba..65205fa25 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.598 + 3.0.599 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Model.Signed.nuspec b/Nuget/MediaBrowser.Model.Signed.nuspec index 085408f2e..2e829b436 100644 --- a/Nuget/MediaBrowser.Model.Signed.nuspec +++ b/Nuget/MediaBrowser.Model.Signed.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Model.Signed - 3.0.598 + 3.0.599 MediaBrowser.Model - Signed Edition Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index dca8aa61a..f5d5b788b 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.598 + 3.0.599 Media Browser.Server.Core Media Browser Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Media Browser Server. Copyright © Media Browser 2013 - + diff --git a/SharedVersion.cs b/SharedVersion.cs index 7528d4060..fa4ca1ac7 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,4 +1,4 @@ using System.Reflection; -//[assembly: AssemblyVersion("3.0.*")] -[assembly: AssemblyVersion("3.0.5557.20000")] +[assembly: AssemblyVersion("3.0.*")] +//[assembly: AssemblyVersion("3.0.5557.20000")]