aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-01-21 15:27:07 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-01-21 15:27:07 -0500
commit2ef30a3ba85190adb38ad7b2f360c2018cd0a5ff (patch)
tree99bceeee3e86def1c651ad209416202a67db7daa /MediaBrowser.Model
parent0bf95da493e91b6713f9b3ec76d6c9659a04ec10 (diff)
update program titles
Diffstat (limited to 'MediaBrowser.Model')
-rw-r--r--MediaBrowser.Model/Dto/MediaSourceInfo.cs30
-rw-r--r--MediaBrowser.Model/System/SystemInfo.cs6
2 files changed, 28 insertions, 8 deletions
diff --git a/MediaBrowser.Model/Dto/MediaSourceInfo.cs b/MediaBrowser.Model/Dto/MediaSourceInfo.cs
index 4f93f476f..250cbeb10 100644
--- a/MediaBrowser.Model/Dto/MediaSourceInfo.cs
+++ b/MediaBrowser.Model/Dto/MediaSourceInfo.cs
@@ -1,8 +1,8 @@
-using System;
-using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.MediaInfo;
using System.Collections.Generic;
+using System.Linq;
using MediaBrowser.Model.Serialization;
namespace MediaBrowser.Model.Dto
@@ -72,6 +72,32 @@ namespace MediaBrowser.Model.Dto
SupportsProbing = true;
}
+ public void InferTotalBitrate()
+ {
+ if (Bitrate.HasValue || MediaStreams == null)
+ {
+ return;
+ }
+
+ var internalStreams = MediaStreams
+ .Where(i => !i.IsExternal)
+ .ToList();
+
+ if (internalStreams.Count == 0)
+ {
+ return;
+ }
+
+ var bitrate = internalStreams
+ .Select(m => m.BitRate ?? 0)
+ .Sum();
+
+ if (bitrate > 0)
+ {
+ Bitrate = bitrate;
+ }
+ }
+
public int? DefaultAudioStreamIndex { get; set; }
public int? DefaultSubtitleStreamIndex { get; set; }
diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.cs
index 6145c7b61..4154093cb 100644
--- a/MediaBrowser.Model/System/SystemInfo.cs
+++ b/MediaBrowser.Model/System/SystemInfo.cs
@@ -17,12 +17,6 @@ namespace MediaBrowser.Model.System
public string OperatingSystemDisplayName { get; set; }
/// <summary>
- /// Gets or sets a value indicating whether this instance is running as service.
- /// </summary>
- /// <value><c>true</c> if this instance is running as service; otherwise, <c>false</c>.</value>
- public bool IsRunningAsService { get; set; }
-
- /// <summary>
/// Gets or sets a value indicating whether [supports running as service].
/// </summary>
/// <value><c>true</c> if [supports running as service]; otherwise, <c>false</c>.</value>