From b362a35ac1c7564435161a9e5988db2b697fabbb Mon Sep 17 00:00:00 2001 From: orestonce Date: Wed, 15 Nov 2023 22:47:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0downloading.txt=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- download.go | 10 ++++++++++ m3u8d-qt/mainwindow.cpp | 5 +---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/download.go b/download.go index bf7af14..eb07902 100644 --- a/download.go +++ b/download.go @@ -182,6 +182,16 @@ func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp return resp } } + + downloadingFilePath := filepath.Join(downloadDir, "downloading.txt") + if !isFileExists(downloadingFilePath) { + err = ioutil.WriteFile(downloadingFilePath, []byte(req.M3u8Url), 0666) + if err != nil { + resp.ErrMsg = "os.WriteUrl error: " + err.Error() + return resp + } + } + beginSeq := parseBeginSeq(m3u8Body) // 获取m3u8地址的内容体 encInfo, err := this.getEncryptInfo(req.M3u8Url, string(m3u8Body)) diff --git a/m3u8d-qt/mainwindow.cpp b/m3u8d-qt/mainwindow.cpp index 3b32737..a10eda8 100644 --- a/m3u8d-qt/mainwindow.cpp +++ b/m3u8d-qt/mainwindow.cpp @@ -20,12 +20,9 @@ MainWindow::MainWindow(QWidget *parent) : ui->lineEdit_SkipTsCountFromHead->setPlaceholderText("[0,9999]"); ui->lineEdit_SaveDir->setPlaceholderText(QString::fromStdString(GetWd())); m_syncUi.AddRunFnOn_OtherThread([this](){ - while(true) + while(!this->m_syncUi.Get_Done()) { QThread::msleep(50); - if (this->m_syncUi.Get_Done()) { - break; - } m_syncUi.AddRunFnOn_UiThread([this](){ GetProgress_Resp resp = GetProgress(); ui->progressBar->setValue(resp.Percent);