Skip to content

Commit

Permalink
fix node select bug and type show bug nilaoda#496
Browse files Browse the repository at this point in the history
  • Loading branch information
nilaoda authored Aug 23, 2021
1 parent 59060bb commit 314f006
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions N_m3u8DL-CLI/MPDParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,16 @@ public static string Parse(string downDir, string mpdUrl, string mpdContent, str
XmlDocument mpdDoc = new XmlDocument();
mpdDoc.LoadXml(mpdContent);

XmlNode xn = mpdDoc.LastChild;
XmlNode xn = null;
//Select MPD node
foreach (XmlNode node in mpdDoc.ChildNodes)
{
if (node.NodeType == XmlNodeType.Element && node.Name == "MPD")
{
xn = node;
break;
}
}
var mediaPresentationDuration = ((XmlElement)xn).GetAttribute("mediaPresentationDuration");
var ns = ((XmlElement)xn).GetAttribute("xmlns");

Expand Down Expand Up @@ -510,7 +519,7 @@ void addSegmentUrl()
{
string Stringify(Dictionary<string, dynamic> f)
{
var type = f["ContentType"] == "aduio" ? "Audio" : "Video";
var type = f["ContentType"] == "audio" ? "Audio" : "Video";
var res = type == "Video" ? $"[{f["Width"]}x{f["Height"]}]" : "";
var id = $"[{f["FormatId"]}] ";
var tbr = $"[{((int)f["Tbr"]).ToString().PadLeft(4)} Kbps] ";
Expand Down

0 comments on commit 314f006

Please sign in to comment.