diff --git a/download.go b/download.go index 2748094..9f4a004 100644 --- a/download.go +++ b/download.go @@ -30,10 +30,6 @@ type TsInfo struct { Url string } -var gProgressBarTitle string -var gProgressPercent int -var gProgressPercentLocker sync.Mutex - type GetProgress_Resp struct { Percent int Title string @@ -41,17 +37,17 @@ type GetProgress_Resp struct { } func GetProgress() (resp GetProgress_Resp) { - gProgressPercentLocker.Lock() - resp.Percent = gProgressPercent - resp.Title = gProgressBarTitle - gProgressPercentLocker.Unlock() - if resp.Title == "" { - resp.Title = "正在下载" - } var sleepTh int32 gOldEnvLocker.Lock() if gOldEnv != nil { sleepTh = atomic.LoadInt32(&gOldEnv.sleepTh) + gOldEnv.progressLocker.Lock() + resp.Percent = gOldEnv.progressPercent + resp.Title = gOldEnv.progressBarTitle + gOldEnv.progressLocker.Unlock() + if resp.Title == "" { + resp.Title = "正在下载" + } } gOldEnvLocker.Unlock() if sleepTh > 0 { @@ -60,10 +56,10 @@ func GetProgress() (resp GetProgress_Resp) { return resp } -func SetProgressBarTitle(title string) { - gProgressPercentLocker.Lock() - defer gProgressPercentLocker.Unlock() - gProgressBarTitle = title +func (this *downloadEnv) SetProgressBarTitle(title string) { + this.progressLocker.Lock() + this.progressBarTitle = title + this.progressLocker.Unlock() } type RunDownload_Resp struct { @@ -81,14 +77,19 @@ type RunDownload_Req struct { SkipTsCountFromHead int // 跳过前面几个ts SetProxy string HeaderMap map[string][]string + SkipRemoveTs bool } type downloadEnv struct { - cancelFn func() - ctx context.Context - client *http.Client - header http.Header - sleepTh int32 + cancelFn func() + ctx context.Context + client *http.Client + header http.Header + sleepTh int32 + progressLocker sync.Mutex + progressBarTitle string + progressPercent int + progressBarShow bool } func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp) { @@ -122,7 +123,7 @@ func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp for key, valueList := range req.HeaderMap { this.header[key] = valueList } - SetProgressBarTitle("[1/6]嗅探m3u8") + this.SetProgressBarTitle("[1/6]嗅探m3u8") var m3u8Body []byte var errMsg string req.M3u8Url, m3u8Body, errMsg = this.sniffM3u8(req.M3u8Url) @@ -142,7 +143,7 @@ func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp return resp } if info != nil { - SetProgressBarTitle("[2/6]检查是否已下载") + this.SetProgressBarTitle("[2/6]检查是否已下载") latestNameFullPath, found := info.SearchVideoInDir(req.SaveDir) if found { resp.IsSkipped = true @@ -169,7 +170,7 @@ func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp resp.IsCancel = this.GetIsCancel() return resp } - SetProgressBarTitle("[3/6]获取ts列表") + this.SetProgressBarTitle("[3/6]获取ts列表") tsList, errMsg := getTsList(req.M3u8Url, string(m3u8Body)) if errMsg != "" { resp.ErrMsg = "获取ts列表错误: " + errMsg @@ -181,14 +182,14 @@ func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp } tsList = tsList[req.SkipTsCountFromHead:] // 下载ts - SetProgressBarTitle("[4/6]下载ts") + this.SetProgressBarTitle("[4/6]下载ts") err = this.downloader(tsList, downloadDir, tsKey) if err != nil { resp.ErrMsg = "下载ts文件错误: " + err.Error() resp.IsCancel = this.GetIsCancel() return resp } - DrawProgressBar(1, 1) + this.DrawProgressBar(1, 1) var tsFileList []string for _, one := range tsList { tsFileList = append(tsFileList, filepath.Join(downloadDir, one.Name)) @@ -197,7 +198,7 @@ func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp var contentHash string tmpOutputName = filepath.Join(downloadDir, "all.merge.mp4") - SetProgressBarTitle("[5/6]合并ts为mp4") + this.SetProgressBarTitle("[5/6]合并ts为mp4") err = MergeTsFileListToSingleMp4(MergeTsFileListToSingleMp4_Req{ TsFileList: tsFileList, OutputMp4: tmpOutputName, @@ -207,7 +208,7 @@ func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp resp.ErrMsg = "合并错误: " + err.Error() return resp } - SetProgressBarTitle("[6/6]计算文件hash") + this.SetProgressBarTitle("[6/6]计算文件hash") contentHash = getFileSha256(tmpOutputName) if contentHash == "" { resp.ErrMsg = "无法计算摘要信息: " + tmpOutputName @@ -244,13 +245,15 @@ func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp resp.ErrMsg = "cacheWrite: " + err.Error() return resp } - err = os.RemoveAll(downloadDir) - if err != nil { - resp.ErrMsg = "删除下载目录失败: " + err.Error() - return resp + if req.SkipRemoveTs == false { + err = os.RemoveAll(downloadDir) + if err != nil { + resp.ErrMsg = "删除下载目录失败: " + err.Error() + return resp + } + // 如果downloading目录为空,就删除掉,否则忽略 + _ = os.Remove(filepath.Join(req.SaveDir, "downloading")) } - // 如果downloading目录为空,就删除掉,否则忽略 - _ = os.Remove(filepath.Join(req.SaveDir, "downloading")) return resp } @@ -279,11 +282,17 @@ func RunDownload(req RunDownload_Req) (resp RunDownload_Resp) { gOldEnv = env gOldEnvLocker.Unlock() resp = env.RunDownload(req) - SetProgressBarTitle("下载进度") - DrawProgressBar(1, 0) + env.SetProgressBarTitle("下载进度") + env.DrawProgressBar(1, 0) return resp } +func getOldEnv() *downloadEnv { + gOldEnvLocker.Lock() + defer gOldEnvLocker.Unlock() + return gOldEnv +} + func CloseOldEnv() { gOldEnvLocker.Lock() defer gOldEnvLocker.Unlock() @@ -451,7 +460,7 @@ func (this *downloadEnv) downloader(tsList []TsInfo, downloadDir string, key str } locker.Lock() downloadCount++ - DrawProgressBar(tsLen, downloadCount) + this.DrawProgressBar(tsLen, downloadCount) locker.Unlock() }) } @@ -460,33 +469,33 @@ func (this *downloadEnv) downloader(tsList []TsInfo, downloadDir string, key str return err } -var gShowProgressBar bool -var gShowProgressBarLocker sync.Mutex - func SetShowProgressBar() { - gShowProgressBarLocker.Lock() - gShowProgressBar = true - gShowProgressBarLocker.Unlock() + gOldEnvLocker.Lock() + tmp := gOldEnv + gOldEnvLocker.Unlock() + if tmp != nil { + tmp.progressLocker.Lock() + tmp.progressBarShow = true + tmp.progressLocker.Unlock() + } } // 进度条 -func DrawProgressBar(total int, current int) { +func (this *downloadEnv) DrawProgressBar(total int, current int) { if total == 0 { return } proportion := float32(current) / float32(total) - gProgressPercentLocker.Lock() - gProgressPercent = int(proportion * 100) - title := gProgressBarTitle - gProgressPercentLocker.Unlock() - gShowProgressBarLocker.Lock() - if gShowProgressBar { + this.progressLocker.Lock() + this.progressPercent = int(proportion * 100) + title := this.progressBarTitle + if this.progressBarShow { width := 50 pos := int(proportion * float32(width)) fmt.Printf(title+" %s%*s %6.2f%%\r", strings.Repeat("■", pos), width-pos, "", proportion*100) } - gShowProgressBarLocker.Unlock() + this.progressLocker.Unlock() } func isFileExists(path string) bool { diff --git a/export/main.go b/export/main.go index 5c0c07b..6e73e79 100644 --- a/export/main.go +++ b/export/main.go @@ -13,12 +13,15 @@ import ( "strings" ) -const version = "1.5.5" - func main() { - BuildCliBinary() // 编译二进制 - CreateLibForQtUi() // 创建Qt需要使用的.a库文件 - WriteVersionDotRc() + BuildCliBinary() // 编译二进制 + if os.Getenv("GITHUB_ACTIONS") == "" { // 正常编译 + CreateLibForQtUi(true) // 创建Qt需要使用的.a库文件 + WriteVersionDotRc("1.5.6") + } else { // github actions 编译 + version := strings.TrimPrefix(os.Getenv("GITHUB_REF_NAME"), "v") + WriteVersionDotRc(version) + } } func BuildCliBinary() { @@ -55,7 +58,7 @@ func BuildCliBinary() { }, } for _, cfg := range list { - name := "m3u8d_cli_v" + version + "_" + cfg.GOOS + "_" + cfg.GOARCH + cfg.Ext + name := "m3u8d_cli_" + cfg.GOOS + "_" + cfg.GOARCH + cfg.Ext cmd := exec.Command("go", "build", "-trimpath", "-ldflags", "-s -w", "-o", filepath.Join(wd, "bin", name)) cmd.Dir = filepath.Join(wd, "cmd") cmd.Env = append(os.Environ(), "GOOS="+cfg.GOOS) @@ -71,7 +74,7 @@ func BuildCliBinary() { } } -func CreateLibForQtUi() { +func CreateLibForQtUi(isAmd64 bool) { ctx := go2cpp.NewGo2cppContext(go2cpp.NewGo2cppContext_Req{ CppBaseName: "m3u8d", EnableQtClass_RunOnUiThread: true, @@ -83,10 +86,14 @@ func CreateLibForQtUi() { ctx.Generate1(m3u8d.GetWd) ctx.Generate1(m3u8d.ParseCurlStr) ctx.Generate1(m3u8d.RunDownload_Req_ToCurlStr) - ctx.MustCreateAmd64LibraryInDir("m3u8d-qt") + if isAmd64 { + ctx.MustCreateAmd64LibraryInDir("m3u8d-qt") + } else { + ctx.MustCreate386LibraryInDir("m3u8-qt") + } } -func WriteVersionDotRc() { +func WriteVersionDotRc(version string) { tmp := strings.Split(version, ".") ok := len(tmp) == 3 for _, v := range tmp { @@ -105,6 +112,7 @@ func WriteVersionDotRc() { } tmp = append(tmp, "0") v1 := strings.Join(tmp, ",") + // TODO: 这里写中文github action会乱码, 有空研究一下 data := []byte(`IDI_ICON1 ICON "favicon.ico" #if defined(UNDER_CE) @@ -131,9 +139,9 @@ VS_VERSION_INFO VERSIONINFO BLOCK "080404b0" BEGIN VALUE "ProductVersion", "` + version + `.0\0" - VALUE "ProductName", "m3u8视频下载工具\0" + VALUE "ProductName", "m3u8 downloader\0" VALUE "LegalCopyright", "https://github.com/orestonce/m3u8d\0" - VALUE "FileDescription", "m3u8视频下载工具\0" + VALUE "FileDescription", "m3u8 downloader\0" END END diff --git a/go.mod b/go.mod index 3db95a3..c6a230d 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.17 require ( github.com/orestonce/cdb v0.0.0-20220528005855-d187c22240e2 - github.com/orestonce/go2cpp v0.0.0-20220704224208-2d58769247a4 + github.com/orestonce/go2cpp v0.0.0-20220730064838-feb9dd043919 github.com/orestonce/gopool v0.0.0-20220508090328-d7d56d45b171 github.com/spf13/cobra v1.4.0 github.com/yapingcat/gomedia v0.0.0-20220721095559-a283c87d8a0b diff --git a/go.sum b/go.sum index ee7751c..1c2cce3 100644 --- a/go.sum +++ b/go.sum @@ -5,6 +5,8 @@ github.com/orestonce/cdb v0.0.0-20220528005855-d187c22240e2 h1:AmGkuxSIOW0gA/jet github.com/orestonce/cdb v0.0.0-20220528005855-d187c22240e2/go.mod h1:HMNNdA1LMQFJRwobtCzVevWcInFSo9rfs1fYeVYwU+c= github.com/orestonce/go2cpp v0.0.0-20220704224208-2d58769247a4 h1:v6Y0pkcMIJdRgow+X9smChnYkC2v9Zqae/QjB7zzMoo= github.com/orestonce/go2cpp v0.0.0-20220704224208-2d58769247a4/go.mod h1:1fsOAZftk08/dOTRqlp6f/MVwaEKOhrnPUg0RtWiSdY= +github.com/orestonce/go2cpp v0.0.0-20220730064838-feb9dd043919 h1:f8oUxbDjOgXrBhtDSaNWNAnZEPDTwrjpccdsrn4UCUs= +github.com/orestonce/go2cpp v0.0.0-20220730064838-feb9dd043919/go.mod h1:1fsOAZftk08/dOTRqlp6f/MVwaEKOhrnPUg0RtWiSdY= github.com/orestonce/gopool v0.0.0-20220508090328-d7d56d45b171 h1:NnOl6HTrhrlTT7aaAybVOtq+fEztGFMoQtegckgwLdk= github.com/orestonce/gopool v0.0.0-20220508090328-d7d56d45b171/go.mod h1:MCQUrAPiG9/PTjHJuGqWLasKbIaG6z62KO6kfp90byM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= diff --git a/m3u8d-qt/m3u8d.cpp b/m3u8d-qt/m3u8d.cpp index ebd4907..32a2a51 100644 --- a/m3u8d-qt/m3u8d.cpp +++ b/m3u8d-qt/m3u8d.cpp @@ -85,96 +85,97 @@ RunDownload_Resp RunDownload(RunDownload_Req in0){ std::string in; { { - uint32_t tmp33 = in0.M3u8Url.length(); - char tmp34[4]; - tmp34[0] = (uint32_t(tmp33) >> 24) & 0xFF; - tmp34[1] = (uint32_t(tmp33) >> 16) & 0xFF; - tmp34[2] = (uint32_t(tmp33) >> 8) & 0xFF; - tmp34[3] = (uint32_t(tmp33) >> 0) & 0xFF; - in.append(tmp34, 4); + uint32_t tmp34 = in0.M3u8Url.length(); + char tmp35[4]; + tmp35[0] = (uint32_t(tmp34) >> 24) & 0xFF; + tmp35[1] = (uint32_t(tmp34) >> 16) & 0xFF; + tmp35[2] = (uint32_t(tmp34) >> 8) & 0xFF; + tmp35[3] = (uint32_t(tmp34) >> 0) & 0xFF; + in.append(tmp35, 4); in.append(in0.M3u8Url); } in.append((char*)(&in0.Insecure), 1); { - uint32_t tmp35 = in0.SaveDir.length(); - char tmp36[4]; - tmp36[0] = (uint32_t(tmp35) >> 24) & 0xFF; - tmp36[1] = (uint32_t(tmp35) >> 16) & 0xFF; - tmp36[2] = (uint32_t(tmp35) >> 8) & 0xFF; - tmp36[3] = (uint32_t(tmp35) >> 0) & 0xFF; - in.append(tmp36, 4); + uint32_t tmp36 = in0.SaveDir.length(); + char tmp37[4]; + tmp37[0] = (uint32_t(tmp36) >> 24) & 0xFF; + tmp37[1] = (uint32_t(tmp36) >> 16) & 0xFF; + tmp37[2] = (uint32_t(tmp36) >> 8) & 0xFF; + tmp37[3] = (uint32_t(tmp36) >> 0) & 0xFF; + in.append(tmp37, 4); in.append(in0.SaveDir); } { - uint32_t tmp37 = in0.FileName.length(); - char tmp38[4]; - tmp38[0] = (uint32_t(tmp37) >> 24) & 0xFF; - tmp38[1] = (uint32_t(tmp37) >> 16) & 0xFF; - tmp38[2] = (uint32_t(tmp37) >> 8) & 0xFF; - tmp38[3] = (uint32_t(tmp37) >> 0) & 0xFF; - in.append(tmp38, 4); + uint32_t tmp38 = in0.FileName.length(); + char tmp39[4]; + tmp39[0] = (uint32_t(tmp38) >> 24) & 0xFF; + tmp39[1] = (uint32_t(tmp38) >> 16) & 0xFF; + tmp39[2] = (uint32_t(tmp38) >> 8) & 0xFF; + tmp39[3] = (uint32_t(tmp38) >> 0) & 0xFF; + in.append(tmp39, 4); in.append(in0.FileName); } { - char tmp39[4]; - tmp39[0] = (uint32_t(in0.SkipTsCountFromHead) >> 24) & 0xFF; - tmp39[1] = (uint32_t(in0.SkipTsCountFromHead) >> 16) & 0xFF; - tmp39[2] = (uint32_t(in0.SkipTsCountFromHead) >> 8) & 0xFF; - tmp39[3] = (uint32_t(in0.SkipTsCountFromHead) >> 0) & 0xFF; - in.append(tmp39, 4); + char tmp40[4]; + tmp40[0] = (uint32_t(in0.SkipTsCountFromHead) >> 24) & 0xFF; + tmp40[1] = (uint32_t(in0.SkipTsCountFromHead) >> 16) & 0xFF; + tmp40[2] = (uint32_t(in0.SkipTsCountFromHead) >> 8) & 0xFF; + tmp40[3] = (uint32_t(in0.SkipTsCountFromHead) >> 0) & 0xFF; + in.append(tmp40, 4); } { - uint32_t tmp40 = in0.SetProxy.length(); - char tmp41[4]; - tmp41[0] = (uint32_t(tmp40) >> 24) & 0xFF; - tmp41[1] = (uint32_t(tmp40) >> 16) & 0xFF; - tmp41[2] = (uint32_t(tmp40) >> 8) & 0xFF; - tmp41[3] = (uint32_t(tmp40) >> 0) & 0xFF; - in.append(tmp41, 4); + uint32_t tmp41 = in0.SetProxy.length(); + char tmp42[4]; + tmp42[0] = (uint32_t(tmp41) >> 24) & 0xFF; + tmp42[1] = (uint32_t(tmp41) >> 16) & 0xFF; + tmp42[2] = (uint32_t(tmp41) >> 8) & 0xFF; + tmp42[3] = (uint32_t(tmp41) >> 0) & 0xFF; + in.append(tmp42, 4); in.append(in0.SetProxy); } { - uint32_t tmp42 = in0.HeaderMap.size(); - char tmp43[4]; - tmp43[0] = (uint32_t(tmp42) >> 24) & 0xFF; - tmp43[1] = (uint32_t(tmp42) >> 16) & 0xFF; - tmp43[2] = (uint32_t(tmp42) >> 8) & 0xFF; - tmp43[3] = (uint32_t(tmp42) >> 0) & 0xFF; - in.append(tmp43, 4); - for(std::map>::iterator tmp44 = in0.HeaderMap.begin(); tmp44 != in0.HeaderMap.end(); ++tmp44) { + uint32_t tmp43 = in0.HeaderMap.size(); + char tmp44[4]; + tmp44[0] = (uint32_t(tmp43) >> 24) & 0xFF; + tmp44[1] = (uint32_t(tmp43) >> 16) & 0xFF; + tmp44[2] = (uint32_t(tmp43) >> 8) & 0xFF; + tmp44[3] = (uint32_t(tmp43) >> 0) & 0xFF; + in.append(tmp44, 4); + for(std::map>::iterator tmp45 = in0.HeaderMap.begin(); tmp45 != in0.HeaderMap.end(); ++tmp45) { { - uint32_t tmp45 = tmp44->first.length(); - char tmp46[4]; - tmp46[0] = (uint32_t(tmp45) >> 24) & 0xFF; - tmp46[1] = (uint32_t(tmp45) >> 16) & 0xFF; - tmp46[2] = (uint32_t(tmp45) >> 8) & 0xFF; - tmp46[3] = (uint32_t(tmp45) >> 0) & 0xFF; - in.append(tmp46, 4); - in.append(tmp44->first); + uint32_t tmp46 = tmp45->first.length(); + char tmp47[4]; + tmp47[0] = (uint32_t(tmp46) >> 24) & 0xFF; + tmp47[1] = (uint32_t(tmp46) >> 16) & 0xFF; + tmp47[2] = (uint32_t(tmp46) >> 8) & 0xFF; + tmp47[3] = (uint32_t(tmp46) >> 0) & 0xFF; + in.append(tmp47, 4); + in.append(tmp45->first); } { - uint32_t tmp47 = tmp44->second.size(); - char tmp48[4]; - tmp48[0] = (uint32_t(tmp47) >> 24) & 0xFF; - tmp48[1] = (uint32_t(tmp47) >> 16) & 0xFF; - tmp48[2] = (uint32_t(tmp47) >> 8) & 0xFF; - tmp48[3] = (uint32_t(tmp47) >> 0) & 0xFF; - in.append(tmp48, 4); - for (uint32_t tmp49=0; tmp49 < tmp47; ++tmp49) { + uint32_t tmp48 = tmp45->second.size(); + char tmp49[4]; + tmp49[0] = (uint32_t(tmp48) >> 24) & 0xFF; + tmp49[1] = (uint32_t(tmp48) >> 16) & 0xFF; + tmp49[2] = (uint32_t(tmp48) >> 8) & 0xFF; + tmp49[3] = (uint32_t(tmp48) >> 0) & 0xFF; + in.append(tmp49, 4); + for (uint32_t tmp50=0; tmp50 < tmp48; ++tmp50) { { - uint32_t tmp50 = tmp44->second[tmp49].length(); - char tmp51[4]; - tmp51[0] = (uint32_t(tmp50) >> 24) & 0xFF; - tmp51[1] = (uint32_t(tmp50) >> 16) & 0xFF; - tmp51[2] = (uint32_t(tmp50) >> 8) & 0xFF; - tmp51[3] = (uint32_t(tmp50) >> 0) & 0xFF; - in.append(tmp51, 4); - in.append(tmp44->second[tmp49]); + uint32_t tmp51 = tmp45->second[tmp50].length(); + char tmp52[4]; + tmp52[0] = (uint32_t(tmp51) >> 24) & 0xFF; + tmp52[1] = (uint32_t(tmp51) >> 16) & 0xFF; + tmp52[2] = (uint32_t(tmp51) >> 8) & 0xFF; + tmp52[3] = (uint32_t(tmp51) >> 0) & 0xFF; + in.append(tmp52, 4); + in.append(tmp45->second[tmp50]); } } } } } + in.append((char*)(&in0.SkipRemoveTs), 1); } char *out = NULL; int outLen = 0; @@ -183,30 +184,30 @@ RunDownload_Resp RunDownload(RunDownload_Req in0){ int outIdx = 0; { { - uint32_t tmp52 = 0; - uint32_t tmp53 = uint32_t(uint8_t(out[outIdx+0]) << 24); - uint32_t tmp54 = uint32_t(uint8_t(out[outIdx+1]) << 16); - uint32_t tmp55 = uint32_t(uint8_t(out[outIdx+2]) << 8); - uint32_t tmp56 = uint32_t(uint8_t(out[outIdx+3]) << 0); - tmp52 = tmp53 | tmp54 | tmp55 | tmp56; + uint32_t tmp53 = 0; + uint32_t tmp54 = uint32_t(uint8_t(out[outIdx+0]) << 24); + uint32_t tmp55 = uint32_t(uint8_t(out[outIdx+1]) << 16); + uint32_t tmp56 = uint32_t(uint8_t(out[outIdx+2]) << 8); + uint32_t tmp57 = uint32_t(uint8_t(out[outIdx+3]) << 0); + tmp53 = tmp54 | tmp55 | tmp56 | tmp57; outIdx+=4; - retValue.ErrMsg = std::string(out+outIdx, out+outIdx+tmp52); - outIdx+=tmp52; + retValue.ErrMsg = std::string(out+outIdx, out+outIdx+tmp53); + outIdx+=tmp53; } retValue.IsSkipped = (bool) out[outIdx]; outIdx++; retValue.IsCancel = (bool) out[outIdx]; outIdx++; { - uint32_t tmp57 = 0; - uint32_t tmp58 = uint32_t(uint8_t(out[outIdx+0]) << 24); - uint32_t tmp59 = uint32_t(uint8_t(out[outIdx+1]) << 16); - uint32_t tmp60 = uint32_t(uint8_t(out[outIdx+2]) << 8); - uint32_t tmp61 = uint32_t(uint8_t(out[outIdx+3]) << 0); - tmp57 = tmp58 | tmp59 | tmp60 | tmp61; + uint32_t tmp58 = 0; + uint32_t tmp59 = uint32_t(uint8_t(out[outIdx+0]) << 24); + uint32_t tmp60 = uint32_t(uint8_t(out[outIdx+1]) << 16); + uint32_t tmp61 = uint32_t(uint8_t(out[outIdx+2]) << 8); + uint32_t tmp62 = uint32_t(uint8_t(out[outIdx+3]) << 0); + tmp58 = tmp59 | tmp60 | tmp61 | tmp62; outIdx+=4; - retValue.SaveFileTo = std::string(out+outIdx, out+outIdx+tmp57); - outIdx+=tmp57; + retValue.SaveFileTo = std::string(out+outIdx, out+outIdx+tmp58); + outIdx+=tmp58; } } if (out != NULL) { @@ -297,13 +298,13 @@ std::string GetWd(){ ParseCurl_Resp ParseCurlStr(std::string in0){ std::string in; { - uint32_t tmp18 = in0.length(); - char tmp19[4]; - tmp19[0] = (uint32_t(tmp18) >> 24) & 0xFF; - tmp19[1] = (uint32_t(tmp18) >> 16) & 0xFF; - tmp19[2] = (uint32_t(tmp18) >> 8) & 0xFF; - tmp19[3] = (uint32_t(tmp18) >> 0) & 0xFF; - in.append(tmp19, 4); + uint32_t tmp19 = in0.length(); + char tmp20[4]; + tmp20[0] = (uint32_t(tmp19) >> 24) & 0xFF; + tmp20[1] = (uint32_t(tmp19) >> 16) & 0xFF; + tmp20[2] = (uint32_t(tmp19) >> 8) & 0xFF; + tmp20[3] = (uint32_t(tmp19) >> 0) & 0xFF; + in.append(tmp20, 4); in.append(in0); } char *out = NULL; @@ -313,120 +314,122 @@ ParseCurl_Resp ParseCurlStr(std::string in0){ int outIdx = 0; { { - uint32_t tmp20 = 0; - uint32_t tmp21 = uint32_t(uint8_t(out[outIdx+0]) << 24); - uint32_t tmp22 = uint32_t(uint8_t(out[outIdx+1]) << 16); - uint32_t tmp23 = uint32_t(uint8_t(out[outIdx+2]) << 8); - uint32_t tmp24 = uint32_t(uint8_t(out[outIdx+3]) << 0); - tmp20 = tmp21 | tmp22 | tmp23 | tmp24; + uint32_t tmp21 = 0; + uint32_t tmp22 = uint32_t(uint8_t(out[outIdx+0]) << 24); + uint32_t tmp23 = uint32_t(uint8_t(out[outIdx+1]) << 16); + uint32_t tmp24 = uint32_t(uint8_t(out[outIdx+2]) << 8); + uint32_t tmp25 = uint32_t(uint8_t(out[outIdx+3]) << 0); + tmp21 = tmp22 | tmp23 | tmp24 | tmp25; outIdx+=4; - retValue.ErrMsg = std::string(out+outIdx, out+outIdx+tmp20); - outIdx+=tmp20; + retValue.ErrMsg = std::string(out+outIdx, out+outIdx+tmp21); + outIdx+=tmp21; } { { - uint32_t tmp25 = 0; - uint32_t tmp26 = uint32_t(uint8_t(out[outIdx+0]) << 24); - uint32_t tmp27 = uint32_t(uint8_t(out[outIdx+1]) << 16); - uint32_t tmp28 = uint32_t(uint8_t(out[outIdx+2]) << 8); - uint32_t tmp29 = uint32_t(uint8_t(out[outIdx+3]) << 0); - tmp25 = tmp26 | tmp27 | tmp28 | tmp29; + uint32_t tmp26 = 0; + uint32_t tmp27 = uint32_t(uint8_t(out[outIdx+0]) << 24); + uint32_t tmp28 = uint32_t(uint8_t(out[outIdx+1]) << 16); + uint32_t tmp29 = uint32_t(uint8_t(out[outIdx+2]) << 8); + uint32_t tmp30 = uint32_t(uint8_t(out[outIdx+3]) << 0); + tmp26 = tmp27 | tmp28 | tmp29 | tmp30; outIdx+=4; - retValue.DownloadReq.M3u8Url = std::string(out+outIdx, out+outIdx+tmp25); - outIdx+=tmp25; + retValue.DownloadReq.M3u8Url = std::string(out+outIdx, out+outIdx+tmp26); + outIdx+=tmp26; } retValue.DownloadReq.Insecure = (bool) out[outIdx]; outIdx++; { - uint32_t tmp30 = 0; - uint32_t tmp31 = uint32_t(uint8_t(out[outIdx+0]) << 24); - uint32_t tmp32 = uint32_t(uint8_t(out[outIdx+1]) << 16); - uint32_t tmp33 = uint32_t(uint8_t(out[outIdx+2]) << 8); - uint32_t tmp34 = uint32_t(uint8_t(out[outIdx+3]) << 0); - tmp30 = tmp31 | tmp32 | tmp33 | tmp34; + uint32_t tmp31 = 0; + uint32_t tmp32 = uint32_t(uint8_t(out[outIdx+0]) << 24); + uint32_t tmp33 = uint32_t(uint8_t(out[outIdx+1]) << 16); + uint32_t tmp34 = uint32_t(uint8_t(out[outIdx+2]) << 8); + uint32_t tmp35 = uint32_t(uint8_t(out[outIdx+3]) << 0); + tmp31 = tmp32 | tmp33 | tmp34 | tmp35; outIdx+=4; - retValue.DownloadReq.SaveDir = std::string(out+outIdx, out+outIdx+tmp30); - outIdx+=tmp30; + retValue.DownloadReq.SaveDir = std::string(out+outIdx, out+outIdx+tmp31); + outIdx+=tmp31; } { - uint32_t tmp35 = 0; - uint32_t tmp36 = uint32_t(uint8_t(out[outIdx+0]) << 24); - uint32_t tmp37 = uint32_t(uint8_t(out[outIdx+1]) << 16); - uint32_t tmp38 = uint32_t(uint8_t(out[outIdx+2]) << 8); - uint32_t tmp39 = uint32_t(uint8_t(out[outIdx+3]) << 0); - tmp35 = tmp36 | tmp37 | tmp38 | tmp39; + uint32_t tmp36 = 0; + uint32_t tmp37 = uint32_t(uint8_t(out[outIdx+0]) << 24); + uint32_t tmp38 = uint32_t(uint8_t(out[outIdx+1]) << 16); + uint32_t tmp39 = uint32_t(uint8_t(out[outIdx+2]) << 8); + uint32_t tmp40 = uint32_t(uint8_t(out[outIdx+3]) << 0); + tmp36 = tmp37 | tmp38 | tmp39 | tmp40; outIdx+=4; - retValue.DownloadReq.FileName = std::string(out+outIdx, out+outIdx+tmp35); - outIdx+=tmp35; + retValue.DownloadReq.FileName = std::string(out+outIdx, out+outIdx+tmp36); + outIdx+=tmp36; } { - uint32_t tmp40 = uint32_t(uint8_t(out[outIdx+0]) << 24); - uint32_t tmp41 = uint32_t(uint8_t(out[outIdx+1]) << 16); - uint32_t tmp42 = uint32_t(uint8_t(out[outIdx+2]) << 8); - uint32_t tmp43 = uint32_t(uint8_t(out[outIdx+3]) << 0); - retValue.DownloadReq.SkipTsCountFromHead = tmp40 | tmp41 | tmp42 | tmp43; + uint32_t tmp41 = uint32_t(uint8_t(out[outIdx+0]) << 24); + uint32_t tmp42 = uint32_t(uint8_t(out[outIdx+1]) << 16); + uint32_t tmp43 = uint32_t(uint8_t(out[outIdx+2]) << 8); + uint32_t tmp44 = uint32_t(uint8_t(out[outIdx+3]) << 0); + retValue.DownloadReq.SkipTsCountFromHead = tmp41 | tmp42 | tmp43 | tmp44; outIdx+=4; } { - uint32_t tmp44 = 0; - uint32_t tmp45 = uint32_t(uint8_t(out[outIdx+0]) << 24); - uint32_t tmp46 = uint32_t(uint8_t(out[outIdx+1]) << 16); - uint32_t tmp47 = uint32_t(uint8_t(out[outIdx+2]) << 8); - uint32_t tmp48 = uint32_t(uint8_t(out[outIdx+3]) << 0); - tmp44 = tmp45 | tmp46 | tmp47 | tmp48; + uint32_t tmp45 = 0; + uint32_t tmp46 = uint32_t(uint8_t(out[outIdx+0]) << 24); + uint32_t tmp47 = uint32_t(uint8_t(out[outIdx+1]) << 16); + uint32_t tmp48 = uint32_t(uint8_t(out[outIdx+2]) << 8); + uint32_t tmp49 = uint32_t(uint8_t(out[outIdx+3]) << 0); + tmp45 = tmp46 | tmp47 | tmp48 | tmp49; outIdx+=4; - retValue.DownloadReq.SetProxy = std::string(out+outIdx, out+outIdx+tmp44); - outIdx+=tmp44; + retValue.DownloadReq.SetProxy = std::string(out+outIdx, out+outIdx+tmp45); + outIdx+=tmp45; } { - uint32_t tmp49 = 0; - uint32_t tmp50 = uint32_t(uint8_t(out[outIdx+0]) << 24); - uint32_t tmp51 = uint32_t(uint8_t(out[outIdx+1]) << 16); - uint32_t tmp52 = uint32_t(uint8_t(out[outIdx+2]) << 8); - uint32_t tmp53 = uint32_t(uint8_t(out[outIdx+3]) << 0); - tmp49 = tmp50 | tmp51 | tmp52 | tmp53; + uint32_t tmp50 = 0; + uint32_t tmp51 = uint32_t(uint8_t(out[outIdx+0]) << 24); + uint32_t tmp52 = uint32_t(uint8_t(out[outIdx+1]) << 16); + uint32_t tmp53 = uint32_t(uint8_t(out[outIdx+2]) << 8); + uint32_t tmp54 = uint32_t(uint8_t(out[outIdx+3]) << 0); + tmp50 = tmp51 | tmp52 | tmp53 | tmp54; outIdx+=4; - for (uint32_t tmp54 = 0; tmp54 < tmp49; tmp54++) { - std::string tmp55; + for (uint32_t tmp55 = 0; tmp55 < tmp50; tmp55++) { + std::string tmp56; { - uint32_t tmp56 = 0; - uint32_t tmp57 = uint32_t(uint8_t(out[outIdx+0]) << 24); - uint32_t tmp58 = uint32_t(uint8_t(out[outIdx+1]) << 16); - uint32_t tmp59 = uint32_t(uint8_t(out[outIdx+2]) << 8); - uint32_t tmp60 = uint32_t(uint8_t(out[outIdx+3]) << 0); - tmp56 = tmp57 | tmp58 | tmp59 | tmp60; + uint32_t tmp57 = 0; + uint32_t tmp58 = uint32_t(uint8_t(out[outIdx+0]) << 24); + uint32_t tmp59 = uint32_t(uint8_t(out[outIdx+1]) << 16); + uint32_t tmp60 = uint32_t(uint8_t(out[outIdx+2]) << 8); + uint32_t tmp61 = uint32_t(uint8_t(out[outIdx+3]) << 0); + tmp57 = tmp58 | tmp59 | tmp60 | tmp61; outIdx+=4; - tmp55 = std::string(out+outIdx, out+outIdx+tmp56); - outIdx+=tmp56; + tmp56 = std::string(out+outIdx, out+outIdx+tmp57); + outIdx+=tmp57; } - std::vector tmp61; + std::vector tmp62; { - uint32_t tmp62 = 0; - uint32_t tmp63 = uint32_t(uint8_t(out[outIdx+0]) << 24); - uint32_t tmp64 = uint32_t(uint8_t(out[outIdx+1]) << 16); - uint32_t tmp65 = uint32_t(uint8_t(out[outIdx+2]) << 8); - uint32_t tmp66 = uint32_t(uint8_t(out[outIdx+3]) << 0); - tmp62 = tmp63 | tmp64 | tmp65 | tmp66; + uint32_t tmp63 = 0; + uint32_t tmp64 = uint32_t(uint8_t(out[outIdx+0]) << 24); + uint32_t tmp65 = uint32_t(uint8_t(out[outIdx+1]) << 16); + uint32_t tmp66 = uint32_t(uint8_t(out[outIdx+2]) << 8); + uint32_t tmp67 = uint32_t(uint8_t(out[outIdx+3]) << 0); + tmp63 = tmp64 | tmp65 | tmp66 | tmp67; outIdx+=4; - for (uint32_t tmp67 = 0; tmp67 < tmp62; tmp67++) { - std::string tmp68; + for (uint32_t tmp68 = 0; tmp68 < tmp63; tmp68++) { + std::string tmp69; { - uint32_t tmp69 = 0; - uint32_t tmp70 = uint32_t(uint8_t(out[outIdx+0]) << 24); - uint32_t tmp71 = uint32_t(uint8_t(out[outIdx+1]) << 16); - uint32_t tmp72 = uint32_t(uint8_t(out[outIdx+2]) << 8); - uint32_t tmp73 = uint32_t(uint8_t(out[outIdx+3]) << 0); - tmp69 = tmp70 | tmp71 | tmp72 | tmp73; + uint32_t tmp70 = 0; + uint32_t tmp71 = uint32_t(uint8_t(out[outIdx+0]) << 24); + uint32_t tmp72 = uint32_t(uint8_t(out[outIdx+1]) << 16); + uint32_t tmp73 = uint32_t(uint8_t(out[outIdx+2]) << 8); + uint32_t tmp74 = uint32_t(uint8_t(out[outIdx+3]) << 0); + tmp70 = tmp71 | tmp72 | tmp73 | tmp74; outIdx+=4; - tmp68 = std::string(out+outIdx, out+outIdx+tmp69); - outIdx+=tmp69; + tmp69 = std::string(out+outIdx, out+outIdx+tmp70); + outIdx+=tmp70; } - tmp61.push_back(tmp68); + tmp62.push_back(tmp69); } } - retValue.DownloadReq.HeaderMap[tmp55] = tmp61; + retValue.DownloadReq.HeaderMap[tmp56] = tmp62; } } + retValue.DownloadReq.SkipRemoveTs = (bool) out[outIdx]; + outIdx++; } } if (out != NULL) { @@ -439,96 +442,97 @@ std::string RunDownload_Req_ToCurlStr(RunDownload_Req in0){ std::string in; { { - uint32_t tmp30 = in0.M3u8Url.length(); - char tmp31[4]; - tmp31[0] = (uint32_t(tmp30) >> 24) & 0xFF; - tmp31[1] = (uint32_t(tmp30) >> 16) & 0xFF; - tmp31[2] = (uint32_t(tmp30) >> 8) & 0xFF; - tmp31[3] = (uint32_t(tmp30) >> 0) & 0xFF; - in.append(tmp31, 4); + uint32_t tmp31 = in0.M3u8Url.length(); + char tmp32[4]; + tmp32[0] = (uint32_t(tmp31) >> 24) & 0xFF; + tmp32[1] = (uint32_t(tmp31) >> 16) & 0xFF; + tmp32[2] = (uint32_t(tmp31) >> 8) & 0xFF; + tmp32[3] = (uint32_t(tmp31) >> 0) & 0xFF; + in.append(tmp32, 4); in.append(in0.M3u8Url); } in.append((char*)(&in0.Insecure), 1); { - uint32_t tmp32 = in0.SaveDir.length(); - char tmp33[4]; - tmp33[0] = (uint32_t(tmp32) >> 24) & 0xFF; - tmp33[1] = (uint32_t(tmp32) >> 16) & 0xFF; - tmp33[2] = (uint32_t(tmp32) >> 8) & 0xFF; - tmp33[3] = (uint32_t(tmp32) >> 0) & 0xFF; - in.append(tmp33, 4); + uint32_t tmp33 = in0.SaveDir.length(); + char tmp34[4]; + tmp34[0] = (uint32_t(tmp33) >> 24) & 0xFF; + tmp34[1] = (uint32_t(tmp33) >> 16) & 0xFF; + tmp34[2] = (uint32_t(tmp33) >> 8) & 0xFF; + tmp34[3] = (uint32_t(tmp33) >> 0) & 0xFF; + in.append(tmp34, 4); in.append(in0.SaveDir); } { - uint32_t tmp34 = in0.FileName.length(); - char tmp35[4]; - tmp35[0] = (uint32_t(tmp34) >> 24) & 0xFF; - tmp35[1] = (uint32_t(tmp34) >> 16) & 0xFF; - tmp35[2] = (uint32_t(tmp34) >> 8) & 0xFF; - tmp35[3] = (uint32_t(tmp34) >> 0) & 0xFF; - in.append(tmp35, 4); + uint32_t tmp35 = in0.FileName.length(); + char tmp36[4]; + tmp36[0] = (uint32_t(tmp35) >> 24) & 0xFF; + tmp36[1] = (uint32_t(tmp35) >> 16) & 0xFF; + tmp36[2] = (uint32_t(tmp35) >> 8) & 0xFF; + tmp36[3] = (uint32_t(tmp35) >> 0) & 0xFF; + in.append(tmp36, 4); in.append(in0.FileName); } { - char tmp36[4]; - tmp36[0] = (uint32_t(in0.SkipTsCountFromHead) >> 24) & 0xFF; - tmp36[1] = (uint32_t(in0.SkipTsCountFromHead) >> 16) & 0xFF; - tmp36[2] = (uint32_t(in0.SkipTsCountFromHead) >> 8) & 0xFF; - tmp36[3] = (uint32_t(in0.SkipTsCountFromHead) >> 0) & 0xFF; - in.append(tmp36, 4); + char tmp37[4]; + tmp37[0] = (uint32_t(in0.SkipTsCountFromHead) >> 24) & 0xFF; + tmp37[1] = (uint32_t(in0.SkipTsCountFromHead) >> 16) & 0xFF; + tmp37[2] = (uint32_t(in0.SkipTsCountFromHead) >> 8) & 0xFF; + tmp37[3] = (uint32_t(in0.SkipTsCountFromHead) >> 0) & 0xFF; + in.append(tmp37, 4); } { - uint32_t tmp37 = in0.SetProxy.length(); - char tmp38[4]; - tmp38[0] = (uint32_t(tmp37) >> 24) & 0xFF; - tmp38[1] = (uint32_t(tmp37) >> 16) & 0xFF; - tmp38[2] = (uint32_t(tmp37) >> 8) & 0xFF; - tmp38[3] = (uint32_t(tmp37) >> 0) & 0xFF; - in.append(tmp38, 4); + uint32_t tmp38 = in0.SetProxy.length(); + char tmp39[4]; + tmp39[0] = (uint32_t(tmp38) >> 24) & 0xFF; + tmp39[1] = (uint32_t(tmp38) >> 16) & 0xFF; + tmp39[2] = (uint32_t(tmp38) >> 8) & 0xFF; + tmp39[3] = (uint32_t(tmp38) >> 0) & 0xFF; + in.append(tmp39, 4); in.append(in0.SetProxy); } { - uint32_t tmp39 = in0.HeaderMap.size(); - char tmp40[4]; - tmp40[0] = (uint32_t(tmp39) >> 24) & 0xFF; - tmp40[1] = (uint32_t(tmp39) >> 16) & 0xFF; - tmp40[2] = (uint32_t(tmp39) >> 8) & 0xFF; - tmp40[3] = (uint32_t(tmp39) >> 0) & 0xFF; - in.append(tmp40, 4); - for(std::map>::iterator tmp41 = in0.HeaderMap.begin(); tmp41 != in0.HeaderMap.end(); ++tmp41) { + uint32_t tmp40 = in0.HeaderMap.size(); + char tmp41[4]; + tmp41[0] = (uint32_t(tmp40) >> 24) & 0xFF; + tmp41[1] = (uint32_t(tmp40) >> 16) & 0xFF; + tmp41[2] = (uint32_t(tmp40) >> 8) & 0xFF; + tmp41[3] = (uint32_t(tmp40) >> 0) & 0xFF; + in.append(tmp41, 4); + for(std::map>::iterator tmp42 = in0.HeaderMap.begin(); tmp42 != in0.HeaderMap.end(); ++tmp42) { { - uint32_t tmp42 = tmp41->first.length(); - char tmp43[4]; - tmp43[0] = (uint32_t(tmp42) >> 24) & 0xFF; - tmp43[1] = (uint32_t(tmp42) >> 16) & 0xFF; - tmp43[2] = (uint32_t(tmp42) >> 8) & 0xFF; - tmp43[3] = (uint32_t(tmp42) >> 0) & 0xFF; - in.append(tmp43, 4); - in.append(tmp41->first); + uint32_t tmp43 = tmp42->first.length(); + char tmp44[4]; + tmp44[0] = (uint32_t(tmp43) >> 24) & 0xFF; + tmp44[1] = (uint32_t(tmp43) >> 16) & 0xFF; + tmp44[2] = (uint32_t(tmp43) >> 8) & 0xFF; + tmp44[3] = (uint32_t(tmp43) >> 0) & 0xFF; + in.append(tmp44, 4); + in.append(tmp42->first); } { - uint32_t tmp44 = tmp41->second.size(); - char tmp45[4]; - tmp45[0] = (uint32_t(tmp44) >> 24) & 0xFF; - tmp45[1] = (uint32_t(tmp44) >> 16) & 0xFF; - tmp45[2] = (uint32_t(tmp44) >> 8) & 0xFF; - tmp45[3] = (uint32_t(tmp44) >> 0) & 0xFF; - in.append(tmp45, 4); - for (uint32_t tmp46=0; tmp46 < tmp44; ++tmp46) { + uint32_t tmp45 = tmp42->second.size(); + char tmp46[4]; + tmp46[0] = (uint32_t(tmp45) >> 24) & 0xFF; + tmp46[1] = (uint32_t(tmp45) >> 16) & 0xFF; + tmp46[2] = (uint32_t(tmp45) >> 8) & 0xFF; + tmp46[3] = (uint32_t(tmp45) >> 0) & 0xFF; + in.append(tmp46, 4); + for (uint32_t tmp47=0; tmp47 < tmp45; ++tmp47) { { - uint32_t tmp47 = tmp41->second[tmp46].length(); - char tmp48[4]; - tmp48[0] = (uint32_t(tmp47) >> 24) & 0xFF; - tmp48[1] = (uint32_t(tmp47) >> 16) & 0xFF; - tmp48[2] = (uint32_t(tmp47) >> 8) & 0xFF; - tmp48[3] = (uint32_t(tmp47) >> 0) & 0xFF; - in.append(tmp48, 4); - in.append(tmp41->second[tmp46]); + uint32_t tmp48 = tmp42->second[tmp47].length(); + char tmp49[4]; + tmp49[0] = (uint32_t(tmp48) >> 24) & 0xFF; + tmp49[1] = (uint32_t(tmp48) >> 16) & 0xFF; + tmp49[2] = (uint32_t(tmp48) >> 8) & 0xFF; + tmp49[3] = (uint32_t(tmp48) >> 0) & 0xFF; + in.append(tmp49, 4); + in.append(tmp42->second[tmp47]); } } } } } + in.append((char*)(&in0.SkipRemoveTs), 1); } char *out = NULL; int outLen = 0; @@ -536,15 +540,15 @@ std::string RunDownload_Req_ToCurlStr(RunDownload_Req in0){ std::string retValue; int outIdx = 0; { - uint32_t tmp49 = 0; - uint32_t tmp50 = uint32_t(uint8_t(out[outIdx+0]) << 24); - uint32_t tmp51 = uint32_t(uint8_t(out[outIdx+1]) << 16); - uint32_t tmp52 = uint32_t(uint8_t(out[outIdx+2]) << 8); - uint32_t tmp53 = uint32_t(uint8_t(out[outIdx+3]) << 0); - tmp49 = tmp50 | tmp51 | tmp52 | tmp53; + uint32_t tmp50 = 0; + uint32_t tmp51 = uint32_t(uint8_t(out[outIdx+0]) << 24); + uint32_t tmp52 = uint32_t(uint8_t(out[outIdx+1]) << 16); + uint32_t tmp53 = uint32_t(uint8_t(out[outIdx+2]) << 8); + uint32_t tmp54 = uint32_t(uint8_t(out[outIdx+3]) << 0); + tmp50 = tmp51 | tmp52 | tmp53 | tmp54; outIdx+=4; - retValue = std::string(out+outIdx, out+outIdx+tmp49); - outIdx+=tmp49; + retValue = std::string(out+outIdx, out+outIdx+tmp50); + outIdx+=tmp50; } if (out != NULL) { free(out); diff --git a/m3u8d-qt/m3u8d.h b/m3u8d-qt/m3u8d.h index fde408c..a5dcafa 100644 --- a/m3u8d-qt/m3u8d.h +++ b/m3u8d-qt/m3u8d.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -15,7 +16,8 @@ struct RunDownload_Req{ int32_t SkipTsCountFromHead; std::string SetProxy; std::map> HeaderMap; - RunDownload_Req(): Insecure(false),SkipTsCountFromHead(0){} + bool SkipRemoveTs; + RunDownload_Req(): Insecure(false),SkipTsCountFromHead(0),SkipRemoveTs(false){} }; struct RunDownload_Resp{ std::string ErrMsg; diff --git a/m3u8d-qt/mainwindow.cpp b/m3u8d-qt/mainwindow.cpp index 3e0169d..4b32e82 100644 --- a/m3u8d-qt/mainwindow.cpp +++ b/m3u8d-qt/mainwindow.cpp @@ -56,6 +56,7 @@ void MainWindow::on_pushButton_RunDownload_clicked() ui->progressBar->setValue(0); ui->lineEdit_SetProxy->setEnabled(false); ui->pushButton_curlMode->setEnabled(false); + ui->checkBox_SkipRemoveTs->setEnabled(false); ui->pushButton_StopDownload->setEnabled(true); RunDownload_Req req; @@ -66,6 +67,7 @@ void MainWindow::on_pushButton_RunDownload_clicked() req.SkipTsCountFromHead = ui->lineEdit_SkipTsCountFromHead->text().toInt(); req.SetProxy = ui->lineEdit_SetProxy->text().toStdString(); req.HeaderMap = m_HeaderMap; + req.SkipRemoveTs = ui->checkBox_SkipRemoveTs->isChecked(); m_syncUi.AddRunFnOn_OtherThread([req, this](){ RunDownload_Resp resp = RunDownload(req); @@ -81,6 +83,7 @@ void MainWindow::on_pushButton_RunDownload_clicked() ui->lineEdit_SetProxy->setEnabled(true); ui->pushButton_StopDownload->setEnabled(false); ui->pushButton_curlMode->setEnabled(true); + ui->checkBox_SkipRemoveTs->setEnabled(true); if (resp.IsCancel) { return; } diff --git a/m3u8d-qt/mainwindow.ui b/m3u8d-qt/mainwindow.ui index afe931d..634368e 100644 --- a/m3u8d-qt/mainwindow.ui +++ b/m3u8d-qt/mainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 800 - 260 + 762 + 253 @@ -17,10 +17,17 @@ - - + + - m3u8的url + 代理设置 + + + + + + + 保存的文件名 @@ -31,13 +38,6 @@ - - - - curl模式 - - - @@ -73,13 +73,6 @@ - - - - 保存的文件名 - - - @@ -87,6 +80,13 @@ + + + + curl模式 + + + @@ -97,10 +97,10 @@ - - + + - 代理设置 + m3u8的url @@ -123,6 +123,13 @@ + + + + 不删除下载的ts文件 + + + diff --git a/m3u8d-qt/version.rc b/m3u8d-qt/version.rc index b8c687d..fdd5877 100644 --- a/m3u8d-qt/version.rc +++ b/m3u8d-qt/version.rc @@ -7,8 +7,8 @@ IDI_ICON1 ICON "favicon.ico" #endif VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,5,5,0 - PRODUCTVERSION 1,5,5,0 + FILEVERSION 1,5,6,0 + PRODUCTVERSION 1,5,6,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS VS_FF_DEBUG @@ -23,10 +23,10 @@ VS_VERSION_INFO VERSIONINFO BEGIN BLOCK "080404b0" BEGIN - VALUE "ProductVersion", "1.5.5.0\0" - VALUE "ProductName", "m3u8Ƶع\0" + VALUE "ProductVersion", "1.5.6.0\0" + VALUE "ProductName", "m3u8 downloader\0" VALUE "LegalCopyright", "https://github.com/orestonce/m3u8d\0" - VALUE "FileDescription", "m3u8Ƶع\0" + VALUE "FileDescription", "m3u8 downloader\0" END END diff --git a/merge.go b/merge.go index f5afaaa..e76e030 100644 --- a/merge.go +++ b/merge.go @@ -72,7 +72,10 @@ func MergeTsFileListToSingleMp4(req MergeTsFileListToSingleMp4_Req) (err error) return req.Ctx.Err() default: } - DrawProgressBar(len(req.TsFileList), idx) + tmp := getOldEnv() + if tmp != nil { + tmp.DrawProgressBar(len(req.TsFileList), idx) + } var buf []byte buf, err = ioutil.ReadFile(tsFile) if err != nil { @@ -95,6 +98,9 @@ func MergeTsFileListToSingleMp4(req MergeTsFileListToSingleMp4_Req) (err error) if err != nil { return err } - DrawProgressBar(1, 1) + tmp := getOldEnv() + if tmp != nil { + tmp.DrawProgressBar(1, 1) + } return nil }