Added video bitrate sort order
This commit is contained in:
parent
b07a1e67c2
commit
93fdbc17d8
|
@ -82,5 +82,6 @@ namespace MediaBrowser.Model.Querying
|
||||||
public const string AlbumCount = "AlbumCount";
|
public const string AlbumCount = "AlbumCount";
|
||||||
public const string MusicVideoCount = "MusicVideoCount";
|
public const string MusicVideoCount = "MusicVideoCount";
|
||||||
public const string SeriesSortName = "SeriesSortName";
|
public const string SeriesSortName = "SeriesSortName";
|
||||||
|
public const string VideoBitRate = "VideoBitRate";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,6 +210,7 @@
|
||||||
<Compile Include="Persistence\SqliteUserDataRepository.cs" />
|
<Compile Include="Persistence\SqliteUserDataRepository.cs" />
|
||||||
<Compile Include="Persistence\SqliteUserRepository.cs" />
|
<Compile Include="Persistence\SqliteUserRepository.cs" />
|
||||||
<Compile Include="Sorting\TrailerCountComparer.cs" />
|
<Compile Include="Sorting\TrailerCountComparer.cs" />
|
||||||
|
<Compile Include="Sorting\VideoBitRateComparer.cs" />
|
||||||
<Compile Include="Udp\UdpMessageReceivedEventArgs.cs" />
|
<Compile Include="Udp\UdpMessageReceivedEventArgs.cs" />
|
||||||
<Compile Include="Udp\UdpServer.cs" />
|
<Compile Include="Udp\UdpServer.cs" />
|
||||||
<Compile Include="WebSocket\AlchemyServer.cs" />
|
<Compile Include="WebSocket\AlchemyServer.cs" />
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
using System;
|
using MediaBrowser.Controller.Entities;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using MediaBrowser.Controller.Entities;
|
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Persistence;
|
using MediaBrowser.Controller.Persistence;
|
||||||
using MediaBrowser.Controller.Sorting;
|
using MediaBrowser.Controller.Sorting;
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
|
using MediaBrowser.Controller.Sorting;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
using MediaBrowser.Model.Querying;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Server.Implementations.Sorting
|
||||||
|
{
|
||||||
|
class VideoBitRateComparer : IBaseItemComparer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Compares the specified x.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x">The x.</param>
|
||||||
|
/// <param name="y">The y.</param>
|
||||||
|
/// <returns>System.Int32.</returns>
|
||||||
|
public int Compare(BaseItem x, BaseItem y)
|
||||||
|
{
|
||||||
|
return GetValue(x).CompareTo(GetValue(y));
|
||||||
|
}
|
||||||
|
|
||||||
|
private int GetValue(BaseItem item)
|
||||||
|
{
|
||||||
|
var video = item as IHasMediaStreams;
|
||||||
|
|
||||||
|
if (video != null)
|
||||||
|
{
|
||||||
|
var videoStream = video.MediaStreams
|
||||||
|
.FirstOrDefault(i => i.Type == MediaStreamType.Video);
|
||||||
|
|
||||||
|
if (videoStream != null)
|
||||||
|
{
|
||||||
|
return videoStream.BitRate ?? 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the name.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The name.</value>
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return ItemSortBy.VideoBitRate; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user