当流类型被更改时,字典中的键也应当同步更新

This commit is contained in:
nilaoda 2022-10-23 21:12:53 +08:00
parent 9ad3b9edb1
commit 2bff0132d0
2 changed files with 18 additions and 1 deletions

View File

@ -433,7 +433,7 @@ namespace N_m3u8DL_RE.CommandLine
Environment.Exit(0);
}
var rootCommand = new RootCommand("N_m3u8DL-RE (Beta version) 20221017")
var rootCommand = new RootCommand("N_m3u8DL-RE (Beta version) 20221023")
{
Input, TmpDir, SaveDir, SaveName, BaseUrl, ThreadCount, DownloadRetryCount, AutoSelect, SkipMerge, SkipDownload, CheckSegmentsCount,
BinaryMerge, DelAfterDone, WriteMetaJson, AppendUrlParams, ConcurrentDownload, Headers, /**SavePattern,**/ SubOnly, SubtitleFormat, AutoSubtitleFix,

View File

@ -129,11 +129,28 @@ namespace N_m3u8DL_RE.DownloadManager
if (mediainfos.All(m => m.Type == "Audio"))
{
var lastKey = streamSpec.ToShortString();
streamSpec.MediaType = MediaType.AUDIO;
var newKey = streamSpec.ToShortString();
//需要同步修改Dictionary中的Key
if (LastFileNameDic.Remove(lastKey, out var lastValue1))
LastFileNameDic[newKey] = lastValue1!;
if (DateTimeDic.Remove(lastKey, out var lastValue2))
DateTimeDic[newKey] = lastValue2;
}
else if (mediainfos.All(m => m.Type == "Subtitle"))
{
var lastKey = streamSpec.ToShortString();
streamSpec.MediaType = MediaType.SUBTITLES;
var newKey = streamSpec.ToShortString();
//需要同步修改Dictionary中的Key
if (LastFileNameDic.Remove(lastKey, out var lastValue1))
LastFileNameDic[newKey] = lastValue1!;
if (DateTimeDic.Remove(lastKey, out var lastValue2))
DateTimeDic[newKey] = lastValue2;
if (streamSpec.Extension == null || streamSpec.Extension == "ts")
streamSpec.Extension = "vtt";
}