aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Dlna/SubtitleProfile.cs
blob: 1879f2dd232ab0d1107360b7836f3acffd70b8ac (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#nullable disable

using System.Xml.Serialization;
using MediaBrowser.Model.Extensions;

namespace MediaBrowser.Model.Dlna;

/// <summary>
/// A class for subtitle profile information.
/// </summary>
public class SubtitleProfile
{
    /// <summary>
    /// Gets or sets the format.
    /// </summary>
    [XmlAttribute("format")]
    public string Format { get; set; }

    /// <summary>
    /// Gets or sets the delivery method.
    /// </summary>
    [XmlAttribute("method")]
    public SubtitleDeliveryMethod Method { get; set; }

    /// <summary>
    /// Gets or sets the DIDL mode.
    /// </summary>
    [XmlAttribute("didlMode")]
    public string DidlMode { get; set; }

    /// <summary>
    /// Gets or sets the language.
    /// </summary>
    [XmlAttribute("language")]
    public string Language { get; set; }

    /// <summary>
    /// Gets or sets the container.
    /// </summary>
    [XmlAttribute("container")]
    public string Container { get; set; }

    /// <summary>
    /// Checks if a language is supported.
    /// </summary>
    /// <param name="subLanguage">The language to check for support.</param>
    /// <returns><c>true</c> if supported.</returns>
    public bool SupportsLanguage(string subLanguage)
    {
        if (string.IsNullOrEmpty(Language))
        {
            return true;
        }

        if (string.IsNullOrEmpty(subLanguage))
        {
            subLanguage = "und";
        }

        return ContainerHelper.ContainsContainer(Language, subLanguage);
    }
}