aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Dlna/SubtitleProfile.cs
blob: 1795c374a43a19801d4304bf4dce9ca2a4bd3460 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using MediaBrowser.Model.Extensions;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace MediaBrowser.Model.Dlna
{
    public class SubtitleProfile
    {
        [XmlAttribute("format")]
        public string Format { get; set; }

        [XmlAttribute("method")]
        public SubtitleDeliveryMethod Method { get; set; }

        [XmlAttribute("didlMode")]
        public string DidlMode { get; set; }

        [XmlAttribute("language")]
        public string Language { get; set; }

        public List<string> GetLanguages()
        {
            List<string> list = new List<string>();
            foreach (string i in (Language ?? string.Empty).Split(','))
            {
                if (!string.IsNullOrEmpty(i)) list.Add(i);
            }
            return list;
        }

        public bool SupportsLanguage(string language)
        {
            if (string.IsNullOrEmpty(language))
            {
                language = "und";
            }

            List<string> languages = GetLanguages();
            return languages.Count == 0 || ListHelper.ContainsIgnoreCase(languages, language);
        }
    }
}