diff options
Diffstat (limited to 'MediaBrowser.Model/Dlna/StreamInfoSorter.cs')
| -rw-r--r-- | MediaBrowser.Model/Dlna/StreamInfoSorter.cs | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/MediaBrowser.Model/Dlna/StreamInfoSorter.cs b/MediaBrowser.Model/Dlna/StreamInfoSorter.cs deleted file mode 100644 index e13b327672..0000000000 --- a/MediaBrowser.Model/Dlna/StreamInfoSorter.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using MediaBrowser.Model.MediaInfo; -using MediaBrowser.Model.Session; -using System.Collections.Generic; -using System.Linq; - -namespace MediaBrowser.Model.Dlna -{ - public class StreamInfoSorter - { - public static StreamInfo[] SortMediaSources(List<StreamInfo> streams, long? maxBitrate) - { - return streams.OrderBy(i => - { - // Nothing beats direct playing a file - if (i.PlayMethod == PlayMethod.DirectPlay && i.MediaSource.Protocol == MediaProtocol.File) - { - return 0; - } - - return 1; - - }).ThenBy(i => - { - switch (i.PlayMethod) - { - // Let's assume direct streaming a file is just as desirable as direct playing a remote url - case PlayMethod.DirectStream: - case PlayMethod.DirectPlay: - return 0; - default: - return 1; - } - - }).ThenBy(i => - { - switch (i.MediaSource.Protocol) - { - case MediaProtocol.File: - return 0; - default: - return 1; - } - - }).ThenBy(i => - { - if (maxBitrate.HasValue) - { - if (i.MediaSource.Bitrate.HasValue) - { - return Math.Abs(i.MediaSource.Bitrate.Value - maxBitrate.Value); - } - } - - return 0; - - }).ToArray(); - } - } -} |
