Add support for the dash role scheme
This commit is contained in:
parent
a7bba3d229
commit
d8f9fa7102
|
@ -31,6 +31,9 @@ namespace N_m3u8DL_RE.Common.Entity
|
||||||
public string? Channels { get; set; }
|
public string? Channels { get; set; }
|
||||||
public string? Extension { get; set; }
|
public string? Extension { get; set; }
|
||||||
|
|
||||||
|
//Dash
|
||||||
|
public RoleType? Role { get; set; }
|
||||||
|
|
||||||
//补充信息-色域
|
//补充信息-色域
|
||||||
public string? VideoRange { get; set; }
|
public string? VideoRange { get; set; }
|
||||||
//补充信息-特征
|
//补充信息-特征
|
||||||
|
@ -74,19 +77,19 @@ namespace N_m3u8DL_RE.Common.Entity
|
||||||
if (MediaType == Enum.MediaType.AUDIO)
|
if (MediaType == Enum.MediaType.AUDIO)
|
||||||
{
|
{
|
||||||
prefixStr = $"[deepskyblue3]Aud[/] {encStr}";
|
prefixStr = $"[deepskyblue3]Aud[/] {encStr}";
|
||||||
var d = $"{GroupId} | {(Bandwidth != null ? (Bandwidth / 1000) + " Kbps" : "")} | {Name} | {Codecs} | {Language} | {(Channels != null ? Channels + "CH" : "")}";
|
var d = $"{GroupId} | {(Bandwidth != null ? (Bandwidth / 1000) + " Kbps" : "")} | {Name} | {Codecs} | {Language} | {(Channels != null ? Channels + "CH" : "")} | {Role}";
|
||||||
returnStr = d.EscapeMarkup();
|
returnStr = d.EscapeMarkup();
|
||||||
}
|
}
|
||||||
else if (MediaType == Enum.MediaType.SUBTITLES)
|
else if (MediaType == Enum.MediaType.SUBTITLES)
|
||||||
{
|
{
|
||||||
prefixStr = $"[deepskyblue3_1]Sub[/] {encStr}";
|
prefixStr = $"[deepskyblue3_1]Sub[/] {encStr}";
|
||||||
var d = $"{GroupId} | {Language} | {Name} | {Codecs}";
|
var d = $"{GroupId} | {Language} | {Name} | {Codecs} | {Role}";
|
||||||
returnStr = d.EscapeMarkup();
|
returnStr = d.EscapeMarkup();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
prefixStr = $"[aqua]Vid[/] {encStr}";
|
prefixStr = $"[aqua]Vid[/] {encStr}";
|
||||||
var d = $"{Resolution} | {Bandwidth / 1000} Kbps | {GroupId} | {FrameRate} | {Codecs} | {VideoRange}";
|
var d = $"{Resolution} | {Bandwidth / 1000} Kbps | {GroupId} | {FrameRate} | {Codecs} | {VideoRange} | {Role}";
|
||||||
returnStr = d.EscapeMarkup();
|
returnStr = d.EscapeMarkup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,19 +111,19 @@ namespace N_m3u8DL_RE.Common.Entity
|
||||||
if (MediaType == Enum.MediaType.AUDIO)
|
if (MediaType == Enum.MediaType.AUDIO)
|
||||||
{
|
{
|
||||||
prefixStr = $"[deepskyblue3]Aud[/] {encStr}";
|
prefixStr = $"[deepskyblue3]Aud[/] {encStr}";
|
||||||
var d = $"{(Bandwidth != null ? (Bandwidth / 1000) + " Kbps" : "")} | {Name} | {Language} | {(Channels != null ? Channels + "CH" : "")}";
|
var d = $"{(Bandwidth != null ? (Bandwidth / 1000) + " Kbps" : "")} | {Name} | {Language} | {(Channels != null ? Channels + "CH" : "")} | {Role}";
|
||||||
returnStr = d.EscapeMarkup();
|
returnStr = d.EscapeMarkup();
|
||||||
}
|
}
|
||||||
else if (MediaType == Enum.MediaType.SUBTITLES)
|
else if (MediaType == Enum.MediaType.SUBTITLES)
|
||||||
{
|
{
|
||||||
prefixStr = $"[deepskyblue3_1]Sub[/] {encStr}";
|
prefixStr = $"[deepskyblue3_1]Sub[/] {encStr}";
|
||||||
var d = $"{Language} | {Name} | {Codecs}";
|
var d = $"{Language} | {Name} | {Codecs} | {Role}";
|
||||||
returnStr = d.EscapeMarkup();
|
returnStr = d.EscapeMarkup();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
prefixStr = $"[aqua]Vid[/] {encStr}";
|
prefixStr = $"[aqua]Vid[/] {encStr}";
|
||||||
var d = $"{Resolution} | {Bandwidth / 1000} Kbps | {FrameRate} | {VideoRange}";
|
var d = $"{Resolution} | {Bandwidth / 1000} Kbps | {FrameRate} | {VideoRange} | {Role}";
|
||||||
returnStr = d.EscapeMarkup();
|
returnStr = d.EscapeMarkup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,19 +153,19 @@ namespace N_m3u8DL_RE.Common.Entity
|
||||||
if (MediaType == Enum.MediaType.AUDIO)
|
if (MediaType == Enum.MediaType.AUDIO)
|
||||||
{
|
{
|
||||||
prefixStr = $"[deepskyblue3]Aud[/] {encStr}";
|
prefixStr = $"[deepskyblue3]Aud[/] {encStr}";
|
||||||
var d = $"{GroupId} | {(Bandwidth != null ? (Bandwidth / 1000) + " Kbps" : "")} | {Name} | {Codecs} | {Language} | {(Channels != null ? Channels + "CH" : "")} | {segmentsCountStr}";
|
var d = $"{GroupId} | {(Bandwidth != null ? (Bandwidth / 1000) + " Kbps" : "")} | {Name} | {Codecs} | {Language} | {(Channels != null ? Channels + "CH" : "")} | {segmentsCountStr} | {Role}";
|
||||||
returnStr = d.EscapeMarkup();
|
returnStr = d.EscapeMarkup();
|
||||||
}
|
}
|
||||||
else if (MediaType == Enum.MediaType.SUBTITLES)
|
else if (MediaType == Enum.MediaType.SUBTITLES)
|
||||||
{
|
{
|
||||||
prefixStr = $"[deepskyblue3_1]Sub[/] {encStr}";
|
prefixStr = $"[deepskyblue3_1]Sub[/] {encStr}";
|
||||||
var d = $"{GroupId} | {Language} | {Name} | {Codecs} | {Characteristics} | {segmentsCountStr}";
|
var d = $"{GroupId} | {Language} | {Name} | {Codecs} | {Characteristics} | {segmentsCountStr} | {Role}";
|
||||||
returnStr = d.EscapeMarkup();
|
returnStr = d.EscapeMarkup();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
prefixStr = $"[aqua]Vid[/] {encStr}";
|
prefixStr = $"[aqua]Vid[/] {encStr}";
|
||||||
var d = $"{Resolution} | {Bandwidth / 1000} Kbps | {GroupId} | {FrameRate} | {Codecs} | {VideoRange} | {segmentsCountStr}";
|
var d = $"{Resolution} | {Bandwidth / 1000} Kbps | {GroupId} | {FrameRate} | {Codecs} | {VideoRange} | {segmentsCountStr} | {Role}";
|
||||||
returnStr = d.EscapeMarkup();
|
returnStr = d.EscapeMarkup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
namespace N_m3u8DL_RE.Common.Enum
|
||||||
|
{
|
||||||
|
public enum RoleType
|
||||||
|
{
|
||||||
|
Subtitle = 0,
|
||||||
|
Main = 1,
|
||||||
|
Alternate = 2,
|
||||||
|
Supplementary = 3,
|
||||||
|
Commentary = 4,
|
||||||
|
Dub = 5,
|
||||||
|
Description = 6,
|
||||||
|
Sign = 7,
|
||||||
|
Metadata = 8,
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
using N_m3u8DL_RE.Common.Entity;
|
using N_m3u8DL_RE.Common.Entity;
|
||||||
using N_m3u8DL_RE.Common.Enum;
|
using N_m3u8DL_RE.Common.Enum;
|
||||||
using N_m3u8DL_RE.Common.Util;
|
using N_m3u8DL_RE.Common.Util;
|
||||||
using N_m3u8DL_RE.Parser.Config;
|
using N_m3u8DL_RE.Parser.Config;
|
||||||
|
@ -189,11 +189,18 @@ namespace N_m3u8DL_RE.Parser.Extractor
|
||||||
if (role != null)
|
if (role != null)
|
||||||
{
|
{
|
||||||
var v = role.Attribute("value")?.Value;
|
var v = role.Attribute("value")?.Value;
|
||||||
if (v == "subtitle")
|
if (Enum.TryParse(v, true, out RoleType roleType))
|
||||||
|
{
|
||||||
|
streamSpec.Role = roleType;
|
||||||
|
|
||||||
|
if (roleType == RoleType.Subtitle)
|
||||||
|
{
|
||||||
streamSpec.MediaType = MediaType.SUBTITLES;
|
streamSpec.MediaType = MediaType.SUBTITLES;
|
||||||
if (mType != null && mType.Contains("ttml"))
|
if (mType != null && mType.Contains("ttml"))
|
||||||
streamSpec.Extension = "ttml";
|
streamSpec.Extension = "ttml";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
streamSpec.Playlist.IsLive = isLive;
|
streamSpec.Playlist.IsLive = isLive;
|
||||||
//设置刷新间隔 timeShiftBufferDepth / 2
|
//设置刷新间隔 timeShiftBufferDepth / 2
|
||||||
if (timeShiftBufferDepth != null)
|
if (timeShiftBufferDepth != null)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using N_m3u8DL_RE.Common.Enum;
|
using N_m3u8DL_RE.Common.Enum;
|
||||||
using N_m3u8DL_RE.Common.Log;
|
using N_m3u8DL_RE.Common.Log;
|
||||||
using N_m3u8DL_RE.Common.Resource;
|
using N_m3u8DL_RE.Common.Resource;
|
||||||
using N_m3u8DL_RE.Common.Util;
|
using N_m3u8DL_RE.Common.Util;
|
||||||
|
@ -367,6 +367,10 @@ namespace N_m3u8DL_RE.CommandLine
|
||||||
if (!string.IsNullOrEmpty(plistDurMax))
|
if (!string.IsNullOrEmpty(plistDurMax))
|
||||||
streamFilter.PlaylistMaxDur = OtherUtil.ParseSeconds(plistDurMax);
|
streamFilter.PlaylistMaxDur = OtherUtil.ParseSeconds(plistDurMax);
|
||||||
|
|
||||||
|
var role = p.GetValue("role");
|
||||||
|
if (System.Enum.TryParse(role, true, out RoleType roleType))
|
||||||
|
streamFilter.Role = roleType;
|
||||||
|
|
||||||
return streamFilter;
|
return streamFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ namespace N_m3u8DL_RE.Entity
|
||||||
public long? SegmentsMaxCount { get; set; }
|
public long? SegmentsMaxCount { get; set; }
|
||||||
public double? PlaylistMinDur { get; set; }
|
public double? PlaylistMinDur { get; set; }
|
||||||
public double? PlaylistMaxDur { get; set; }
|
public double? PlaylistMaxDur { get; set; }
|
||||||
|
public RoleType? Role { get; set; }
|
||||||
|
|
||||||
public string For { get; set; } = "best";
|
public string For { get; set; } = "best";
|
||||||
|
|
||||||
|
@ -43,6 +44,7 @@ namespace N_m3u8DL_RE.Entity
|
||||||
if (SegmentsMaxCount != null) sb.Append($"SegmentsMaxCount: {SegmentsMaxCount} ");
|
if (SegmentsMaxCount != null) sb.Append($"SegmentsMaxCount: {SegmentsMaxCount} ");
|
||||||
if (PlaylistMinDur != null) sb.Append($"PlaylistMinDur: {PlaylistMinDur} ");
|
if (PlaylistMinDur != null) sb.Append($"PlaylistMinDur: {PlaylistMinDur} ");
|
||||||
if (PlaylistMaxDur != null) sb.Append($"PlaylistMaxDur: {PlaylistMaxDur} ");
|
if (PlaylistMaxDur != null) sb.Append($"PlaylistMaxDur: {PlaylistMaxDur} ");
|
||||||
|
if (Role.HasValue) sb.Append($"Role: {Role} ");
|
||||||
|
|
||||||
return sb.ToString() + $"For: {For}";
|
return sb.ToString() + $"For: {For}";
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,8 @@ namespace N_m3u8DL_RE.Util
|
||||||
inputs = inputs.Where(i => i.Playlist?.TotalDuration > filter.PlaylistMinDur);
|
inputs = inputs.Where(i => i.Playlist?.TotalDuration > filter.PlaylistMinDur);
|
||||||
if (filter.PlaylistMaxDur != null)
|
if (filter.PlaylistMaxDur != null)
|
||||||
inputs = inputs.Where(i => i.Playlist?.TotalDuration < filter.PlaylistMaxDur);
|
inputs = inputs.Where(i => i.Playlist?.TotalDuration < filter.PlaylistMaxDur);
|
||||||
|
if (filter.Role.HasValue)
|
||||||
|
inputs = inputs.Where(i => i.Role == filter.Role);
|
||||||
|
|
||||||
var bestNumberStr = filter.For.Replace("best", "");
|
var bestNumberStr = filter.For.Replace("best", "");
|
||||||
var worstNumberStr = filter.For.Replace("worst", "");
|
var worstNumberStr = filter.For.Replace("worst", "");
|
||||||
|
|
Loading…
Reference in New Issue