diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-06-07 00:56:48 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-06-07 00:56:48 -0400 |
| commit | 5e57b829d305e08f5b72b02611628df7b3756e02 (patch) | |
| tree | 86fd36004a88cbaa74bf47bef218be763a7f7ca6 /MediaBrowser.Model/Dlna/CodecProfile.cs | |
| parent | 2546eaa1c2b41096204b9bc9a9e5a3854b37a3be (diff) | |
update CodecProfile checks
Diffstat (limited to 'MediaBrowser.Model/Dlna/CodecProfile.cs')
| -rw-r--r-- | MediaBrowser.Model/Dlna/CodecProfile.cs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/MediaBrowser.Model/Dlna/CodecProfile.cs b/MediaBrowser.Model/Dlna/CodecProfile.cs index 29d4d21ec..e04e04d21 100644 --- a/MediaBrowser.Model/Dlna/CodecProfile.cs +++ b/MediaBrowser.Model/Dlna/CodecProfile.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Xml.Serialization; using MediaBrowser.Model.Dlna; +using System.Linq; namespace MediaBrowser.Model.Dlna { @@ -26,24 +27,24 @@ namespace MediaBrowser.Model.Dlna ApplyConditions = new ProfileCondition[] { }; } - public List<string> GetCodecs() + private static List<string> SplitValue(string value) { List<string> list = new List<string>(); - foreach (string i in (Codec ?? string.Empty).Split(',')) + foreach (string i in (value ?? string.Empty).Split(',')) { if (!string.IsNullOrEmpty(i)) list.Add(i); } return list; } + public List<string> GetCodecs() + { + return SplitValue(Codec); + } + public List<string> GetContainers() { - List<string> list = new List<string>(); - foreach (string i in (Container ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) list.Add(i); - } - return list; + return SplitValue(Container); } private bool ContainsContainer(string container) @@ -62,7 +63,8 @@ namespace MediaBrowser.Model.Dlna List<string> codecs = GetCodecs(); - return codecs.Count == 0 || ListHelper.ContainsIgnoreCase(codecs, codec); + return codecs.Count == 0 || ListHelper.ContainsIgnoreCase(codecs, SplitValue(codec)[0]); + //return codecs.Count == 0 || SplitValue(codec).Any(i => ListHelper.ContainsIgnoreCase(codecs, i)); } } } |
