update stream sorting
This commit is contained in:
parent
8921e152ea
commit
7e312e75bb
|
@ -413,6 +413,9 @@
|
|||
<Compile Include="..\MediaBrowser.Model\Dlna\StreamInfo.cs">
|
||||
<Link>Dlna\StreamInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MediaBrowser.Model\Dlna\StreamInfoSorter.cs">
|
||||
<Link>Dlna\StreamInfoSorter.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MediaBrowser.Model\Dlna\SubtitleDeliveryMethod.cs">
|
||||
<Link>Dlna\SubtitleDeliveryMethod.cs</Link>
|
||||
</Compile>
|
||||
|
|
|
@ -378,6 +378,9 @@
|
|||
<Compile Include="..\MediaBrowser.Model\Dlna\StreamInfo.cs">
|
||||
<Link>Dlna\StreamInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MediaBrowser.Model\Dlna\StreamInfoSorter.cs">
|
||||
<Link>Dlna\StreamInfoSorter.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MediaBrowser.Model\Dlna\SubtitleDeliveryMethod.cs">
|
||||
<Link>Dlna\SubtitleDeliveryMethod.cs</Link>
|
||||
</Compile>
|
||||
|
|
|
@ -89,29 +89,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
|
||||
private StreamInfo GetOptimalStream(List<StreamInfo> 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)
|
||||
{
|
||||
|
|
40
MediaBrowser.Model/Dlna/StreamInfoSorter.cs
Normal file
40
MediaBrowser.Model/Dlna/StreamInfoSorter.cs
Normal file
|
@ -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<StreamInfo> SortMediaSources(List<StreamInfo> 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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -126,6 +126,7 @@
|
|||
<Compile Include="Devices\DevicesOptions.cs" />
|
||||
<Compile Include="Dlna\EncodingContext.cs" />
|
||||
<Compile Include="Dlna\ILocalPlayer.cs" />
|
||||
<Compile Include="Dlna\StreamInfoSorter.cs" />
|
||||
<Compile Include="Dlna\NullLocalPlayer.cs" />
|
||||
<Compile Include="Dlna\PlaybackErrorCode.cs" />
|
||||
<Compile Include="Dlna\PlaybackException.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)
|
||||
|
|
|
@ -223,8 +223,8 @@ namespace MediaBrowser.Server.Implementations.Photos
|
|||
|
||||
protected virtual List<BaseItem> GetFinalItems(List<BaseItem> 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
|
||||
|
|
|
@ -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<string> responder)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common.Internal</id>
|
||||
<version>3.0.598</version>
|
||||
<version>3.0.599</version>
|
||||
<title>MediaBrowser.Common.Internal</title>
|
||||
<authors>Luke</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<dependencies>
|
||||
<dependency id="MediaBrowser.Common" version="3.0.598" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.599" />
|
||||
<dependency id="NLog" version="3.2.0.0" />
|
||||
<dependency id="SimpleInjector" version="2.7.0" />
|
||||
</dependencies>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common</id>
|
||||
<version>3.0.598</version>
|
||||
<version>3.0.599</version>
|
||||
<title>MediaBrowser.Common</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Model.Signed</id>
|
||||
<version>3.0.598</version>
|
||||
<version>3.0.599</version>
|
||||
<title>MediaBrowser.Model - Signed Edition</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Server.Core</id>
|
||||
<version>3.0.598</version>
|
||||
<version>3.0.599</version>
|
||||
<title>Media Browser.Server.Core</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<dependencies>
|
||||
<dependency id="MediaBrowser.Common" version="3.0.598" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.599" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
|
|
|
@ -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")]
|
||||
|
|
Loading…
Reference in New Issue
Block a user