From 70df8f16f32dacb8d15d3355ac1f4791631388ef Mon Sep 17 00:00:00 2001 From: nilaoda Date: Sun, 17 Jul 2022 18:25:46 +0800 Subject: [PATCH] Update SimpleDownloadManager.cs --- src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs b/src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs index b31d2bd..c9dcaf6 100644 --- a/src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs +++ b/src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs @@ -23,11 +23,13 @@ namespace N_m3u8DL_RE.DownloadManager { IDownloader Downloader; DownloaderConfig DownloaderConfig; + DateTime NowDateTime; public SimpleDownloadManager(DownloaderConfig downloaderConfig) { this.DownloaderConfig = downloaderConfig; Downloader = new SimpleDownloader(DownloaderConfig); + NowDateTime = DateTime.Now; } private async Task DownloadStreamAsync(StreamSpec streamSpec, ProgressTask task) @@ -37,7 +39,7 @@ namespace N_m3u8DL_RE.DownloadManager var segments = streamSpec.Playlist?.MediaParts.SelectMany(m => m.MediaSegments); if (segments == null) return false; - var dirName = $"{DateTime.Now:yyyy-MM-dd_HH-mm-ss}_{streamSpec.GroupId}_{streamSpec.Codecs}_{streamSpec.Language}"; + var dirName = $"{NowDateTime:yyyy-MM-dd_HH-mm-ss}_{streamSpec.GroupId}_{streamSpec.Codecs}_{streamSpec.Language}"; var tmpDir = DownloaderConfig.TmpDir ?? Path.Combine(Environment.CurrentDirectory, dirName); var saveDir = DownloaderConfig.SaveDir ?? Environment.CurrentDirectory; var saveName = DownloaderConfig.SaveName ?? dirName;