aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Entities
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2017-11-20 13:02:59 -0500
committerGitHub <noreply@github.com>2017-11-20 13:02:59 -0500
commit8f78652398ad4e9e9af53a1bd065afe4b9d9260e (patch)
tree32bc4144212d7f6ee3941c9c2471b56ab9c5d3e2 /MediaBrowser.Model/Entities
parent7d15b140cfe4f761e03f661f82cf946f327863f5 (diff)
parent71ff88284be60fb39a7389e0c4990c94f2207ed4 (diff)
Merge pull request #3032 from MediaBrowser/beta
Beta
Diffstat (limited to 'MediaBrowser.Model/Entities')
-rw-r--r--MediaBrowser.Model/Entities/MediaStream.cs82
1 files changed, 77 insertions, 5 deletions
diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs
index 747528cbfe..8a402e6f45 100644
--- a/MediaBrowser.Model/Entities/MediaStream.cs
+++ b/MediaBrowser.Model/Entities/MediaStream.cs
@@ -46,13 +46,13 @@ namespace MediaBrowser.Model.Entities
{
get
{
- if (!string.IsNullOrEmpty(Title))
- {
- return AddLanguageIfNeeded(Title);
- }
-
if (Type == MediaStreamType.Audio)
{
+ //if (!string.IsNullOrEmpty(Title))
+ //{
+ // return AddLanguageIfNeeded(Title);
+ //}
+
List<string> attributes = new List<string>();
if (!string.IsNullOrEmpty(Language))
@@ -84,8 +84,32 @@ namespace MediaBrowser.Model.Entities
return string.Join(" ", attributes.ToArray(attributes.Count));
}
+ if (Type == MediaStreamType.Video)
+ {
+ List<string> attributes = new List<string>();
+
+ var resolutionText = GetResolutionText();
+
+ if (!string.IsNullOrEmpty(resolutionText))
+ {
+ attributes.Add(resolutionText);
+ }
+
+ if (!string.IsNullOrEmpty(Codec))
+ {
+ attributes.Add(Codec.ToUpper());
+ }
+
+ return string.Join(" ", attributes.ToArray(attributes.Count));
+ }
+
if (Type == MediaStreamType.Subtitle)
{
+ //if (!string.IsNullOrEmpty(Title))
+ //{
+ // return AddLanguageIfNeeded(Title);
+ //}
+
List<string> attributes = new List<string>();
if (!string.IsNullOrEmpty(Language))
@@ -121,6 +145,54 @@ namespace MediaBrowser.Model.Entities
}
}
+ private string GetResolutionText()
+ {
+ var i = this;
+
+ if (i.Width.HasValue)
+ {
+ if (i.Width >= 3800)
+ {
+ return "4K";
+ }
+ if (i.Width >= 2500)
+ {
+ if (i.IsInterlaced)
+ {
+ return "1440I";
+ }
+ return "1440P";
+ }
+ if (i.Width >= 1900)
+ {
+ if (i.IsInterlaced)
+ {
+ return "1080I";
+ }
+ return "1080P";
+ }
+ if (i.Width >= 1260)
+ {
+ if (i.IsInterlaced)
+ {
+ return "720I";
+ }
+ return "720P";
+ }
+ if (i.Width >= 700)
+ {
+
+ if (i.IsInterlaced)
+ {
+ return "480I";
+ }
+ return "480P";
+ }
+
+ }
+ return null;
+ }
+
private string AddLanguageIfNeeded(string title)
{
if (!string.IsNullOrEmpty(Language) &&