This commit is contained in:
nilaoda 2022-12-02 11:52:39 +08:00
parent 183319feba
commit b2f611e632
2 changed files with 12 additions and 4 deletions

View File

@ -23,7 +23,7 @@ namespace N_m3u8DL_RE.Parser.Extractor
private string BaseUrl = string.Empty; private string BaseUrl = string.Empty;
private string M3u8Content = string.Empty; private string M3u8Content = string.Empty;
private bool MasterM3u8Flag = false; private bool MasterM3u8Flag = false;
private bool FirstRefreshFlag = true; private bool FirstFetchFlag = true;
public ParserConfig ParserConfig { get; set; } public ParserConfig ParserConfig { get; set; }
@ -525,7 +525,8 @@ namespace N_m3u8DL_RE.Parser.Extractor
public async Task FetchPlayListAsync(List<StreamSpec> lists) public async Task FetchPlayListAsync(List<StreamSpec> lists)
{ {
if (MasterM3u8Flag) //首次加载不需要刷新URL
if (!FirstFetchFlag && MasterM3u8Flag)
{ {
//重新加载master m3u8, 刷新选中流的URL //重新加载master m3u8, 刷新选中流的URL
await LoadM3u8FromUrlAsync(ParserConfig.Url); await LoadM3u8FromUrlAsync(ParserConfig.Url);
@ -546,7 +547,13 @@ namespace N_m3u8DL_RE.Parser.Extractor
{ {
//重新加载m3u8 //重新加载m3u8
await LoadM3u8FromUrlAsync(lists[i].Url!); await LoadM3u8FromUrlAsync(lists[i].Url!);
lists[i].Playlist!.MediaParts = (await ParseListAsync()).MediaParts; //不更新init
var newPlaylist = await ParseListAsync();
if (lists[i].Playlist?.MediaInit != null)
lists[i].Playlist!.MediaParts = newPlaylist.MediaParts; //不更新init
else
lists[i].Playlist = newPlaylist;
if (lists[i].MediaType == MediaType.SUBTITLES) if (lists[i].MediaType == MediaType.SUBTITLES)
{ {
var a = lists[i].Playlist!.MediaParts.Any(p => p.MediaSegments.Any(m => m.Url.Contains(".ttml"))); var a = lists[i].Playlist!.MediaParts.Any(p => p.MediaSegments.Any(m => m.Url.Contains(".ttml")));
@ -563,6 +570,7 @@ namespace N_m3u8DL_RE.Parser.Extractor
public async Task RefreshPlayListAsync(List<StreamSpec> streamSpecs) public async Task RefreshPlayListAsync(List<StreamSpec> streamSpecs)
{ {
FirstFetchFlag = false;
await FetchPlayListAsync(streamSpecs); await FetchPlayListAsync(streamSpecs);
} }
} }

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) 20221129"; public const string VERSION_INFO = "N_m3u8DL-RE (Beta version) 20221202";
[GeneratedRegex("((best|worst)\\d*|all)")] [GeneratedRegex("((best|worst)\\d*|all)")]
private static partial Regex ForStrRegex(); private static partial Regex ForStrRegex();