展示广告过滤效果 #237

This commit is contained in:
nilaoda 2023-07-28 23:08:27 +08:00
parent 5144f387df
commit 9ab8f3cf72
2 changed files with 11 additions and 1 deletions

View File

@ -18,7 +18,7 @@ namespace N_m3u8DL_RE.CommandLine
{ {
internal partial class CommandInvoker internal partial class CommandInvoker
{ {
public const string VERSION_INFO = "N_m3u8DL-RE (Beta version) 20230721"; public const string VERSION_INFO = "N_m3u8DL-RE (Beta version) 20230728";
[GeneratedRegex("((best|worst)\\d*|all)")] [GeneratedRegex("((best|worst)\\d*|all)")]
private static partial Regex ForStrRegex(); private static partial Regex ForStrRegex();

View File

@ -246,6 +246,9 @@ namespace N_m3u8DL_RE.Util
foreach (var stream in selectedSteams) foreach (var stream in selectedSteams)
{ {
if (stream.Playlist == null) continue; if (stream.Playlist == null) continue;
var countBefore = stream.SegmentsCount;
foreach (var part in stream.Playlist.MediaParts) foreach (var part in stream.Playlist.MediaParts)
{ {
//没有找到广告分片 //没有找到广告分片
@ -262,6 +265,13 @@ namespace N_m3u8DL_RE.Util
//清理已经为空的 part //清理已经为空的 part
stream.Playlist.MediaParts = stream.Playlist.MediaParts.Where(x => x.MediaSegments.Count > 0).ToList(); stream.Playlist.MediaParts = stream.Playlist.MediaParts.Where(x => x.MediaSegments.Count > 0).ToList();
var countAfter = stream.SegmentsCount;
if (countBefore != countAfter)
{
Logger.WarnMarkUp("[grey]{} segments => {} segments[/]", countBefore, countAfter);
}
} }
} }
} }