add DisplayTitle to media streams

This commit is contained in:
Luke Pulverenti
2016-05-14 14:02:06 -04:00
parent 4d66f6dc6c
commit ff980dc42c
6 changed files with 147 additions and 5 deletions

View File

@@ -1,4 +1,6 @@
using MediaBrowser.Model.Dlna;
using System;
using System.Collections.Generic;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Extensions;
using System.Diagnostics;
@@ -34,6 +36,91 @@ namespace MediaBrowser.Model.Entities
/// <value>The comment.</value>
public string Comment { get; set; }
public string Title { get; set; }
public string DisplayTitle
{
get
{
if (!string.IsNullOrEmpty(Title))
{
return Title;
}
if (Type == MediaStreamType.Audio)
{
List<string> attributes = new List<string>();
if (!string.IsNullOrEmpty(Language))
{
attributes.Add(Language);
}
if (!string.IsNullOrEmpty(Codec) && !StringHelper.EqualsIgnoreCase(Codec, "dca"))
{
attributes.Add(Codec);
}
if (!string.IsNullOrEmpty(Profile) && !StringHelper.EqualsIgnoreCase(Profile, "lc"))
{
attributes.Add(Profile);
}
if (Channels.HasValue)
{
attributes.Add(StringHelper.ToStringCultureInvariant(Channels.Value) + " ch");
}
string name = string.Join(" ", attributes.ToArray());
if (IsDefault)
{
name += " (D)";
}
return name;
}
if (Type == MediaStreamType.Subtitle)
{
List<string> attributes = new List<string>();
if (!string.IsNullOrEmpty(Language))
{
attributes.Add(Language);
}
if (!string.IsNullOrEmpty(Codec))
{
attributes.Add(Codec);
}
string name = string.Join(" ", attributes.ToArray());
if (IsDefault)
{
name += " (D)";
}
if (IsForced)
{
name += " (F)";
}
if (IsExternal)
{
name += " (EXT)";
}
return name;
}
if (Type == MediaStreamType.Video)
{
}
return null;
}
}
public string NalLengthSize { get; set; }
/// <summary>