main
orestonce 2022-08-03 07:37:54 +08:00
parent 922ca4cbdd
commit a6c6645820
10 changed files with 376 additions and 335 deletions

View File

@ -30,10 +30,6 @@ type TsInfo struct {
Url string Url string
} }
var gProgressBarTitle string
var gProgressPercent int
var gProgressPercentLocker sync.Mutex
type GetProgress_Resp struct { type GetProgress_Resp struct {
Percent int Percent int
Title string Title string
@ -41,17 +37,17 @@ type GetProgress_Resp struct {
} }
func GetProgress() (resp GetProgress_Resp) { func GetProgress() (resp GetProgress_Resp) {
gProgressPercentLocker.Lock()
resp.Percent = gProgressPercent
resp.Title = gProgressBarTitle
gProgressPercentLocker.Unlock()
if resp.Title == "" {
resp.Title = "正在下载"
}
var sleepTh int32 var sleepTh int32
gOldEnvLocker.Lock() gOldEnvLocker.Lock()
if gOldEnv != nil { if gOldEnv != nil {
sleepTh = atomic.LoadInt32(&gOldEnv.sleepTh) 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() gOldEnvLocker.Unlock()
if sleepTh > 0 { if sleepTh > 0 {
@ -60,10 +56,10 @@ func GetProgress() (resp GetProgress_Resp) {
return resp return resp
} }
func SetProgressBarTitle(title string) { func (this *downloadEnv) SetProgressBarTitle(title string) {
gProgressPercentLocker.Lock() this.progressLocker.Lock()
defer gProgressPercentLocker.Unlock() this.progressBarTitle = title
gProgressBarTitle = title this.progressLocker.Unlock()
} }
type RunDownload_Resp struct { type RunDownload_Resp struct {
@ -81,6 +77,7 @@ type RunDownload_Req struct {
SkipTsCountFromHead int // 跳过前面几个ts SkipTsCountFromHead int // 跳过前面几个ts
SetProxy string SetProxy string
HeaderMap map[string][]string HeaderMap map[string][]string
SkipRemoveTs bool
} }
type downloadEnv struct { type downloadEnv struct {
@ -89,6 +86,10 @@ type downloadEnv struct {
client *http.Client client *http.Client
header http.Header header http.Header
sleepTh int32 sleepTh int32
progressLocker sync.Mutex
progressBarTitle string
progressPercent int
progressBarShow bool
} }
func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp) { 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 { for key, valueList := range req.HeaderMap {
this.header[key] = valueList this.header[key] = valueList
} }
SetProgressBarTitle("[1/6]嗅探m3u8") this.SetProgressBarTitle("[1/6]嗅探m3u8")
var m3u8Body []byte var m3u8Body []byte
var errMsg string var errMsg string
req.M3u8Url, m3u8Body, errMsg = this.sniffM3u8(req.M3u8Url) req.M3u8Url, m3u8Body, errMsg = this.sniffM3u8(req.M3u8Url)
@ -142,7 +143,7 @@ func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp
return resp return resp
} }
if info != nil { if info != nil {
SetProgressBarTitle("[2/6]检查是否已下载") this.SetProgressBarTitle("[2/6]检查是否已下载")
latestNameFullPath, found := info.SearchVideoInDir(req.SaveDir) latestNameFullPath, found := info.SearchVideoInDir(req.SaveDir)
if found { if found {
resp.IsSkipped = true resp.IsSkipped = true
@ -169,7 +170,7 @@ func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp
resp.IsCancel = this.GetIsCancel() resp.IsCancel = this.GetIsCancel()
return resp return resp
} }
SetProgressBarTitle("[3/6]获取ts列表") this.SetProgressBarTitle("[3/6]获取ts列表")
tsList, errMsg := getTsList(req.M3u8Url, string(m3u8Body)) tsList, errMsg := getTsList(req.M3u8Url, string(m3u8Body))
if errMsg != "" { if errMsg != "" {
resp.ErrMsg = "获取ts列表错误: " + errMsg resp.ErrMsg = "获取ts列表错误: " + errMsg
@ -181,14 +182,14 @@ func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp
} }
tsList = tsList[req.SkipTsCountFromHead:] tsList = tsList[req.SkipTsCountFromHead:]
// 下载ts // 下载ts
SetProgressBarTitle("[4/6]下载ts") this.SetProgressBarTitle("[4/6]下载ts")
err = this.downloader(tsList, downloadDir, tsKey) err = this.downloader(tsList, downloadDir, tsKey)
if err != nil { if err != nil {
resp.ErrMsg = "下载ts文件错误: " + err.Error() resp.ErrMsg = "下载ts文件错误: " + err.Error()
resp.IsCancel = this.GetIsCancel() resp.IsCancel = this.GetIsCancel()
return resp return resp
} }
DrawProgressBar(1, 1) this.DrawProgressBar(1, 1)
var tsFileList []string var tsFileList []string
for _, one := range tsList { for _, one := range tsList {
tsFileList = append(tsFileList, filepath.Join(downloadDir, one.Name)) 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 var contentHash string
tmpOutputName = filepath.Join(downloadDir, "all.merge.mp4") tmpOutputName = filepath.Join(downloadDir, "all.merge.mp4")
SetProgressBarTitle("[5/6]合并ts为mp4") this.SetProgressBarTitle("[5/6]合并ts为mp4")
err = MergeTsFileListToSingleMp4(MergeTsFileListToSingleMp4_Req{ err = MergeTsFileListToSingleMp4(MergeTsFileListToSingleMp4_Req{
TsFileList: tsFileList, TsFileList: tsFileList,
OutputMp4: tmpOutputName, OutputMp4: tmpOutputName,
@ -207,7 +208,7 @@ func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp
resp.ErrMsg = "合并错误: " + err.Error() resp.ErrMsg = "合并错误: " + err.Error()
return resp return resp
} }
SetProgressBarTitle("[6/6]计算文件hash") this.SetProgressBarTitle("[6/6]计算文件hash")
contentHash = getFileSha256(tmpOutputName) contentHash = getFileSha256(tmpOutputName)
if contentHash == "" { if contentHash == "" {
resp.ErrMsg = "无法计算摘要信息: " + tmpOutputName resp.ErrMsg = "无法计算摘要信息: " + tmpOutputName
@ -244,6 +245,7 @@ func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp
resp.ErrMsg = "cacheWrite: " + err.Error() resp.ErrMsg = "cacheWrite: " + err.Error()
return resp return resp
} }
if req.SkipRemoveTs == false {
err = os.RemoveAll(downloadDir) err = os.RemoveAll(downloadDir)
if err != nil { if err != nil {
resp.ErrMsg = "删除下载目录失败: " + err.Error() resp.ErrMsg = "删除下载目录失败: " + err.Error()
@ -251,6 +253,7 @@ func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp
} }
// 如果downloading目录为空,就删除掉,否则忽略 // 如果downloading目录为空,就删除掉,否则忽略
_ = os.Remove(filepath.Join(req.SaveDir, "downloading")) _ = os.Remove(filepath.Join(req.SaveDir, "downloading"))
}
return resp return resp
} }
@ -279,11 +282,17 @@ func RunDownload(req RunDownload_Req) (resp RunDownload_Resp) {
gOldEnv = env gOldEnv = env
gOldEnvLocker.Unlock() gOldEnvLocker.Unlock()
resp = env.RunDownload(req) resp = env.RunDownload(req)
SetProgressBarTitle("下载进度") env.SetProgressBarTitle("下载进度")
DrawProgressBar(1, 0) env.DrawProgressBar(1, 0)
return resp return resp
} }
func getOldEnv() *downloadEnv {
gOldEnvLocker.Lock()
defer gOldEnvLocker.Unlock()
return gOldEnv
}
func CloseOldEnv() { func CloseOldEnv() {
gOldEnvLocker.Lock() gOldEnvLocker.Lock()
defer gOldEnvLocker.Unlock() defer gOldEnvLocker.Unlock()
@ -451,7 +460,7 @@ func (this *downloadEnv) downloader(tsList []TsInfo, downloadDir string, key str
} }
locker.Lock() locker.Lock()
downloadCount++ downloadCount++
DrawProgressBar(tsLen, downloadCount) this.DrawProgressBar(tsLen, downloadCount)
locker.Unlock() locker.Unlock()
}) })
} }
@ -460,33 +469,33 @@ func (this *downloadEnv) downloader(tsList []TsInfo, downloadDir string, key str
return err return err
} }
var gShowProgressBar bool
var gShowProgressBarLocker sync.Mutex
func SetShowProgressBar() { func SetShowProgressBar() {
gShowProgressBarLocker.Lock() gOldEnvLocker.Lock()
gShowProgressBar = true tmp := gOldEnv
gShowProgressBarLocker.Unlock() 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 { if total == 0 {
return return
} }
proportion := float32(current) / float32(total) proportion := float32(current) / float32(total)
gProgressPercentLocker.Lock()
gProgressPercent = int(proportion * 100)
title := gProgressBarTitle
gProgressPercentLocker.Unlock()
gShowProgressBarLocker.Lock() this.progressLocker.Lock()
if gShowProgressBar { this.progressPercent = int(proportion * 100)
title := this.progressBarTitle
if this.progressBarShow {
width := 50 width := 50
pos := int(proportion * float32(width)) pos := int(proportion * float32(width))
fmt.Printf(title+" %s%*s %6.2f%%\r", strings.Repeat("■", pos), width-pos, "", proportion*100) 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 { func isFileExists(path string) bool {

View File

@ -13,12 +13,15 @@ import (
"strings" "strings"
) )
const version = "1.5.5"
func main() { func main() {
BuildCliBinary() // 编译二进制 BuildCliBinary() // 编译二进制
CreateLibForQtUi() // 创建Qt需要使用的.a库文件 if os.Getenv("GITHUB_ACTIONS") == "" { // 正常编译
WriteVersionDotRc() CreateLibForQtUi(true) // 创建Qt需要使用的.a库文件
WriteVersionDotRc("1.5.6")
} else { // github actions 编译
version := strings.TrimPrefix(os.Getenv("GITHUB_REF_NAME"), "v")
WriteVersionDotRc(version)
}
} }
func BuildCliBinary() { func BuildCliBinary() {
@ -55,7 +58,7 @@ func BuildCliBinary() {
}, },
} }
for _, cfg := range list { 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 := exec.Command("go", "build", "-trimpath", "-ldflags", "-s -w", "-o", filepath.Join(wd, "bin", name))
cmd.Dir = filepath.Join(wd, "cmd") cmd.Dir = filepath.Join(wd, "cmd")
cmd.Env = append(os.Environ(), "GOOS="+cfg.GOOS) 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{ ctx := go2cpp.NewGo2cppContext(go2cpp.NewGo2cppContext_Req{
CppBaseName: "m3u8d", CppBaseName: "m3u8d",
EnableQtClass_RunOnUiThread: true, EnableQtClass_RunOnUiThread: true,
@ -83,10 +86,14 @@ func CreateLibForQtUi() {
ctx.Generate1(m3u8d.GetWd) ctx.Generate1(m3u8d.GetWd)
ctx.Generate1(m3u8d.ParseCurlStr) ctx.Generate1(m3u8d.ParseCurlStr)
ctx.Generate1(m3u8d.RunDownload_Req_ToCurlStr) ctx.Generate1(m3u8d.RunDownload_Req_ToCurlStr)
if isAmd64 {
ctx.MustCreateAmd64LibraryInDir("m3u8d-qt") ctx.MustCreateAmd64LibraryInDir("m3u8d-qt")
} else {
ctx.MustCreate386LibraryInDir("m3u8-qt")
}
} }
func WriteVersionDotRc() { func WriteVersionDotRc(version string) {
tmp := strings.Split(version, ".") tmp := strings.Split(version, ".")
ok := len(tmp) == 3 ok := len(tmp) == 3
for _, v := range tmp { for _, v := range tmp {
@ -105,6 +112,7 @@ func WriteVersionDotRc() {
} }
tmp = append(tmp, "0") tmp = append(tmp, "0")
v1 := strings.Join(tmp, ",") v1 := strings.Join(tmp, ",")
// TODO: 这里写中文github action会乱码, 有空研究一下
data := []byte(`IDI_ICON1 ICON "favicon.ico" data := []byte(`IDI_ICON1 ICON "favicon.ico"
#if defined(UNDER_CE) #if defined(UNDER_CE)
@ -131,9 +139,9 @@ VS_VERSION_INFO VERSIONINFO
BLOCK "080404b0" BLOCK "080404b0"
BEGIN BEGIN
VALUE "ProductVersion", "` + version + `.0\0" VALUE "ProductVersion", "` + version + `.0\0"
VALUE "ProductName", "m3u8视频下载工具\0" VALUE "ProductName", "m3u8 downloader\0"
VALUE "LegalCopyright", "https://github.com/orestonce/m3u8d\0" VALUE "LegalCopyright", "https://github.com/orestonce/m3u8d\0"
VALUE "FileDescription", "m3u8视频下载工具\0" VALUE "FileDescription", "m3u8 downloader\0"
END END
END END

2
go.mod
View File

@ -4,7 +4,7 @@ go 1.17
require ( require (
github.com/orestonce/cdb v0.0.0-20220528005855-d187c22240e2 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/orestonce/gopool v0.0.0-20220508090328-d7d56d45b171
github.com/spf13/cobra v1.4.0 github.com/spf13/cobra v1.4.0
github.com/yapingcat/gomedia v0.0.0-20220721095559-a283c87d8a0b github.com/yapingcat/gomedia v0.0.0-20220721095559-a283c87d8a0b

2
go.sum
View File

@ -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/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 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-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 h1:NnOl6HTrhrlTT7aaAybVOtq+fEztGFMoQtegckgwLdk=
github.com/orestonce/gopool v0.0.0-20220508090328-d7d56d45b171/go.mod h1:MCQUrAPiG9/PTjHJuGqWLasKbIaG6z62KO6kfp90byM= 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= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=

View File

@ -85,96 +85,97 @@ RunDownload_Resp RunDownload(RunDownload_Req in0){
std::string in; std::string in;
{ {
{ {
uint32_t tmp33 = in0.M3u8Url.length(); uint32_t tmp34 = in0.M3u8Url.length();
char tmp34[4]; char tmp35[4];
tmp34[0] = (uint32_t(tmp33) >> 24) & 0xFF; tmp35[0] = (uint32_t(tmp34) >> 24) & 0xFF;
tmp34[1] = (uint32_t(tmp33) >> 16) & 0xFF; tmp35[1] = (uint32_t(tmp34) >> 16) & 0xFF;
tmp34[2] = (uint32_t(tmp33) >> 8) & 0xFF; tmp35[2] = (uint32_t(tmp34) >> 8) & 0xFF;
tmp34[3] = (uint32_t(tmp33) >> 0) & 0xFF; tmp35[3] = (uint32_t(tmp34) >> 0) & 0xFF;
in.append(tmp34, 4); in.append(tmp35, 4);
in.append(in0.M3u8Url); in.append(in0.M3u8Url);
} }
in.append((char*)(&in0.Insecure), 1); in.append((char*)(&in0.Insecure), 1);
{ {
uint32_t tmp35 = in0.SaveDir.length(); uint32_t tmp36 = in0.SaveDir.length();
char tmp36[4]; char tmp37[4];
tmp36[0] = (uint32_t(tmp35) >> 24) & 0xFF; tmp37[0] = (uint32_t(tmp36) >> 24) & 0xFF;
tmp36[1] = (uint32_t(tmp35) >> 16) & 0xFF; tmp37[1] = (uint32_t(tmp36) >> 16) & 0xFF;
tmp36[2] = (uint32_t(tmp35) >> 8) & 0xFF; tmp37[2] = (uint32_t(tmp36) >> 8) & 0xFF;
tmp36[3] = (uint32_t(tmp35) >> 0) & 0xFF; tmp37[3] = (uint32_t(tmp36) >> 0) & 0xFF;
in.append(tmp36, 4); in.append(tmp37, 4);
in.append(in0.SaveDir); in.append(in0.SaveDir);
} }
{ {
uint32_t tmp37 = in0.FileName.length(); uint32_t tmp38 = in0.FileName.length();
char tmp38[4]; char tmp39[4];
tmp38[0] = (uint32_t(tmp37) >> 24) & 0xFF; tmp39[0] = (uint32_t(tmp38) >> 24) & 0xFF;
tmp38[1] = (uint32_t(tmp37) >> 16) & 0xFF; tmp39[1] = (uint32_t(tmp38) >> 16) & 0xFF;
tmp38[2] = (uint32_t(tmp37) >> 8) & 0xFF; tmp39[2] = (uint32_t(tmp38) >> 8) & 0xFF;
tmp38[3] = (uint32_t(tmp37) >> 0) & 0xFF; tmp39[3] = (uint32_t(tmp38) >> 0) & 0xFF;
in.append(tmp38, 4); in.append(tmp39, 4);
in.append(in0.FileName); in.append(in0.FileName);
} }
{ {
char tmp39[4]; char tmp40[4];
tmp39[0] = (uint32_t(in0.SkipTsCountFromHead) >> 24) & 0xFF; tmp40[0] = (uint32_t(in0.SkipTsCountFromHead) >> 24) & 0xFF;
tmp39[1] = (uint32_t(in0.SkipTsCountFromHead) >> 16) & 0xFF; tmp40[1] = (uint32_t(in0.SkipTsCountFromHead) >> 16) & 0xFF;
tmp39[2] = (uint32_t(in0.SkipTsCountFromHead) >> 8) & 0xFF; tmp40[2] = (uint32_t(in0.SkipTsCountFromHead) >> 8) & 0xFF;
tmp39[3] = (uint32_t(in0.SkipTsCountFromHead) >> 0) & 0xFF; tmp40[3] = (uint32_t(in0.SkipTsCountFromHead) >> 0) & 0xFF;
in.append(tmp39, 4); in.append(tmp40, 4);
} }
{ {
uint32_t tmp40 = in0.SetProxy.length(); uint32_t tmp41 = in0.SetProxy.length();
char tmp41[4]; char tmp42[4];
tmp41[0] = (uint32_t(tmp40) >> 24) & 0xFF; tmp42[0] = (uint32_t(tmp41) >> 24) & 0xFF;
tmp41[1] = (uint32_t(tmp40) >> 16) & 0xFF; tmp42[1] = (uint32_t(tmp41) >> 16) & 0xFF;
tmp41[2] = (uint32_t(tmp40) >> 8) & 0xFF; tmp42[2] = (uint32_t(tmp41) >> 8) & 0xFF;
tmp41[3] = (uint32_t(tmp40) >> 0) & 0xFF; tmp42[3] = (uint32_t(tmp41) >> 0) & 0xFF;
in.append(tmp41, 4); in.append(tmp42, 4);
in.append(in0.SetProxy); in.append(in0.SetProxy);
} }
{ {
uint32_t tmp42 = in0.HeaderMap.size(); uint32_t tmp43 = in0.HeaderMap.size();
char tmp43[4]; char tmp44[4];
tmp43[0] = (uint32_t(tmp42) >> 24) & 0xFF; tmp44[0] = (uint32_t(tmp43) >> 24) & 0xFF;
tmp43[1] = (uint32_t(tmp42) >> 16) & 0xFF; tmp44[1] = (uint32_t(tmp43) >> 16) & 0xFF;
tmp43[2] = (uint32_t(tmp42) >> 8) & 0xFF; tmp44[2] = (uint32_t(tmp43) >> 8) & 0xFF;
tmp43[3] = (uint32_t(tmp42) >> 0) & 0xFF; tmp44[3] = (uint32_t(tmp43) >> 0) & 0xFF;
in.append(tmp43, 4); in.append(tmp44, 4);
for(std::map<std::string, std::vector<std::string>>::iterator tmp44 = in0.HeaderMap.begin(); tmp44 != in0.HeaderMap.end(); ++tmp44) { for(std::map<std::string, std::vector<std::string>>::iterator tmp45 = in0.HeaderMap.begin(); tmp45 != in0.HeaderMap.end(); ++tmp45) {
{ {
uint32_t tmp45 = tmp44->first.length(); uint32_t tmp46 = tmp45->first.length();
char tmp46[4]; char tmp47[4];
tmp46[0] = (uint32_t(tmp45) >> 24) & 0xFF; tmp47[0] = (uint32_t(tmp46) >> 24) & 0xFF;
tmp46[1] = (uint32_t(tmp45) >> 16) & 0xFF; tmp47[1] = (uint32_t(tmp46) >> 16) & 0xFF;
tmp46[2] = (uint32_t(tmp45) >> 8) & 0xFF; tmp47[2] = (uint32_t(tmp46) >> 8) & 0xFF;
tmp46[3] = (uint32_t(tmp45) >> 0) & 0xFF; tmp47[3] = (uint32_t(tmp46) >> 0) & 0xFF;
in.append(tmp46, 4); in.append(tmp47, 4);
in.append(tmp44->first); in.append(tmp45->first);
} }
{ {
uint32_t tmp47 = tmp44->second.size(); uint32_t tmp48 = tmp45->second.size();
char tmp48[4]; char tmp49[4];
tmp48[0] = (uint32_t(tmp47) >> 24) & 0xFF; tmp49[0] = (uint32_t(tmp48) >> 24) & 0xFF;
tmp48[1] = (uint32_t(tmp47) >> 16) & 0xFF; tmp49[1] = (uint32_t(tmp48) >> 16) & 0xFF;
tmp48[2] = (uint32_t(tmp47) >> 8) & 0xFF; tmp49[2] = (uint32_t(tmp48) >> 8) & 0xFF;
tmp48[3] = (uint32_t(tmp47) >> 0) & 0xFF; tmp49[3] = (uint32_t(tmp48) >> 0) & 0xFF;
in.append(tmp48, 4); in.append(tmp49, 4);
for (uint32_t tmp49=0; tmp49 < tmp47; ++tmp49) { for (uint32_t tmp50=0; tmp50 < tmp48; ++tmp50) {
{ {
uint32_t tmp50 = tmp44->second[tmp49].length(); uint32_t tmp51 = tmp45->second[tmp50].length();
char tmp51[4]; char tmp52[4];
tmp51[0] = (uint32_t(tmp50) >> 24) & 0xFF; tmp52[0] = (uint32_t(tmp51) >> 24) & 0xFF;
tmp51[1] = (uint32_t(tmp50) >> 16) & 0xFF; tmp52[1] = (uint32_t(tmp51) >> 16) & 0xFF;
tmp51[2] = (uint32_t(tmp50) >> 8) & 0xFF; tmp52[2] = (uint32_t(tmp51) >> 8) & 0xFF;
tmp51[3] = (uint32_t(tmp50) >> 0) & 0xFF; tmp52[3] = (uint32_t(tmp51) >> 0) & 0xFF;
in.append(tmp51, 4); in.append(tmp52, 4);
in.append(tmp44->second[tmp49]); in.append(tmp45->second[tmp50]);
} }
} }
} }
} }
} }
in.append((char*)(&in0.SkipRemoveTs), 1);
} }
char *out = NULL; char *out = NULL;
int outLen = 0; int outLen = 0;
@ -183,30 +184,30 @@ RunDownload_Resp RunDownload(RunDownload_Req in0){
int outIdx = 0; int outIdx = 0;
{ {
{ {
uint32_t tmp52 = 0; uint32_t tmp53 = 0;
uint32_t tmp53 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp54 = 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+1]) << 16);
uint32_t tmp55 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp56 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp56 = uint32_t(uint8_t(out[outIdx+3]) << 0); uint32_t tmp57 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp52 = tmp53 | tmp54 | tmp55 | tmp56; tmp53 = tmp54 | tmp55 | tmp56 | tmp57;
outIdx+=4; outIdx+=4;
retValue.ErrMsg = std::string(out+outIdx, out+outIdx+tmp52); retValue.ErrMsg = std::string(out+outIdx, out+outIdx+tmp53);
outIdx+=tmp52; outIdx+=tmp53;
} }
retValue.IsSkipped = (bool) out[outIdx]; retValue.IsSkipped = (bool) out[outIdx];
outIdx++; outIdx++;
retValue.IsCancel = (bool) out[outIdx]; retValue.IsCancel = (bool) out[outIdx];
outIdx++; outIdx++;
{ {
uint32_t tmp57 = 0; uint32_t tmp58 = 0;
uint32_t tmp58 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp59 = 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+1]) << 16);
uint32_t tmp60 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp61 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp61 = uint32_t(uint8_t(out[outIdx+3]) << 0); uint32_t tmp62 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp57 = tmp58 | tmp59 | tmp60 | tmp61; tmp58 = tmp59 | tmp60 | tmp61 | tmp62;
outIdx+=4; outIdx+=4;
retValue.SaveFileTo = std::string(out+outIdx, out+outIdx+tmp57); retValue.SaveFileTo = std::string(out+outIdx, out+outIdx+tmp58);
outIdx+=tmp57; outIdx+=tmp58;
} }
} }
if (out != NULL) { if (out != NULL) {
@ -297,13 +298,13 @@ std::string GetWd(){
ParseCurl_Resp ParseCurlStr(std::string in0){ ParseCurl_Resp ParseCurlStr(std::string in0){
std::string in; std::string in;
{ {
uint32_t tmp18 = in0.length(); uint32_t tmp19 = in0.length();
char tmp19[4]; char tmp20[4];
tmp19[0] = (uint32_t(tmp18) >> 24) & 0xFF; tmp20[0] = (uint32_t(tmp19) >> 24) & 0xFF;
tmp19[1] = (uint32_t(tmp18) >> 16) & 0xFF; tmp20[1] = (uint32_t(tmp19) >> 16) & 0xFF;
tmp19[2] = (uint32_t(tmp18) >> 8) & 0xFF; tmp20[2] = (uint32_t(tmp19) >> 8) & 0xFF;
tmp19[3] = (uint32_t(tmp18) >> 0) & 0xFF; tmp20[3] = (uint32_t(tmp19) >> 0) & 0xFF;
in.append(tmp19, 4); in.append(tmp20, 4);
in.append(in0); in.append(in0);
} }
char *out = NULL; char *out = NULL;
@ -313,120 +314,122 @@ ParseCurl_Resp ParseCurlStr(std::string in0){
int outIdx = 0; int outIdx = 0;
{ {
{ {
uint32_t tmp20 = 0; uint32_t tmp21 = 0;
uint32_t tmp21 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp22 = 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+1]) << 16);
uint32_t tmp23 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp24 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp24 = uint32_t(uint8_t(out[outIdx+3]) << 0); uint32_t tmp25 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp20 = tmp21 | tmp22 | tmp23 | tmp24; tmp21 = tmp22 | tmp23 | tmp24 | tmp25;
outIdx+=4; outIdx+=4;
retValue.ErrMsg = std::string(out+outIdx, out+outIdx+tmp20); retValue.ErrMsg = std::string(out+outIdx, out+outIdx+tmp21);
outIdx+=tmp20; outIdx+=tmp21;
} }
{ {
{ {
uint32_t tmp25 = 0; uint32_t tmp26 = 0;
uint32_t tmp26 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp27 = 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+1]) << 16);
uint32_t tmp28 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp29 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp29 = uint32_t(uint8_t(out[outIdx+3]) << 0); uint32_t tmp30 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp25 = tmp26 | tmp27 | tmp28 | tmp29; tmp26 = tmp27 | tmp28 | tmp29 | tmp30;
outIdx+=4; outIdx+=4;
retValue.DownloadReq.M3u8Url = std::string(out+outIdx, out+outIdx+tmp25); retValue.DownloadReq.M3u8Url = std::string(out+outIdx, out+outIdx+tmp26);
outIdx+=tmp25; outIdx+=tmp26;
} }
retValue.DownloadReq.Insecure = (bool) out[outIdx]; retValue.DownloadReq.Insecure = (bool) out[outIdx];
outIdx++; outIdx++;
{ {
uint32_t tmp30 = 0; uint32_t tmp31 = 0;
uint32_t tmp31 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp32 = 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+1]) << 16);
uint32_t tmp33 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp34 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp34 = uint32_t(uint8_t(out[outIdx+3]) << 0); uint32_t tmp35 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp30 = tmp31 | tmp32 | tmp33 | tmp34; tmp31 = tmp32 | tmp33 | tmp34 | tmp35;
outIdx+=4; outIdx+=4;
retValue.DownloadReq.SaveDir = std::string(out+outIdx, out+outIdx+tmp30); retValue.DownloadReq.SaveDir = std::string(out+outIdx, out+outIdx+tmp31);
outIdx+=tmp30; outIdx+=tmp31;
} }
{ {
uint32_t tmp35 = 0; uint32_t tmp36 = 0;
uint32_t tmp36 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp37 = 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+1]) << 16);
uint32_t tmp38 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp39 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp39 = uint32_t(uint8_t(out[outIdx+3]) << 0); uint32_t tmp40 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp35 = tmp36 | tmp37 | tmp38 | tmp39; tmp36 = tmp37 | tmp38 | tmp39 | tmp40;
outIdx+=4; outIdx+=4;
retValue.DownloadReq.FileName = std::string(out+outIdx, out+outIdx+tmp35); retValue.DownloadReq.FileName = std::string(out+outIdx, out+outIdx+tmp36);
outIdx+=tmp35; outIdx+=tmp36;
} }
{ {
uint32_t tmp40 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp41 = 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+1]) << 16);
uint32_t tmp42 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp43 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp43 = uint32_t(uint8_t(out[outIdx+3]) << 0); uint32_t tmp44 = uint32_t(uint8_t(out[outIdx+3]) << 0);
retValue.DownloadReq.SkipTsCountFromHead = tmp40 | tmp41 | tmp42 | tmp43; retValue.DownloadReq.SkipTsCountFromHead = tmp41 | tmp42 | tmp43 | tmp44;
outIdx+=4; outIdx+=4;
} }
{ {
uint32_t tmp44 = 0; uint32_t tmp45 = 0;
uint32_t tmp45 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp46 = 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+1]) << 16);
uint32_t tmp47 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp48 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp48 = uint32_t(uint8_t(out[outIdx+3]) << 0); uint32_t tmp49 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp44 = tmp45 | tmp46 | tmp47 | tmp48; tmp45 = tmp46 | tmp47 | tmp48 | tmp49;
outIdx+=4; outIdx+=4;
retValue.DownloadReq.SetProxy = std::string(out+outIdx, out+outIdx+tmp44); retValue.DownloadReq.SetProxy = std::string(out+outIdx, out+outIdx+tmp45);
outIdx+=tmp44; outIdx+=tmp45;
} }
{ {
uint32_t tmp49 = 0; uint32_t tmp50 = 0;
uint32_t tmp50 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp51 = 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+1]) << 16);
uint32_t tmp52 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp53 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp53 = uint32_t(uint8_t(out[outIdx+3]) << 0); uint32_t tmp54 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp49 = tmp50 | tmp51 | tmp52 | tmp53; tmp50 = tmp51 | tmp52 | tmp53 | tmp54;
outIdx+=4; outIdx+=4;
for (uint32_t tmp54 = 0; tmp54 < tmp49; tmp54++) { for (uint32_t tmp55 = 0; tmp55 < tmp50; tmp55++) {
std::string tmp55; std::string tmp56;
{ {
uint32_t tmp56 = 0; uint32_t tmp57 = 0;
uint32_t tmp57 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp58 = 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+1]) << 16);
uint32_t tmp59 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp60 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp60 = uint32_t(uint8_t(out[outIdx+3]) << 0); uint32_t tmp61 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp56 = tmp57 | tmp58 | tmp59 | tmp60; tmp57 = tmp58 | tmp59 | tmp60 | tmp61;
outIdx+=4; outIdx+=4;
tmp55 = std::string(out+outIdx, out+outIdx+tmp56); tmp56 = std::string(out+outIdx, out+outIdx+tmp57);
outIdx+=tmp56; outIdx+=tmp57;
} }
std::vector<std::string> tmp61; std::vector<std::string> tmp62;
{ {
uint32_t tmp62 = 0; uint32_t tmp63 = 0;
uint32_t tmp63 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp64 = 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+1]) << 16);
uint32_t tmp65 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp66 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp66 = uint32_t(uint8_t(out[outIdx+3]) << 0); uint32_t tmp67 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp62 = tmp63 | tmp64 | tmp65 | tmp66; tmp63 = tmp64 | tmp65 | tmp66 | tmp67;
outIdx+=4; outIdx+=4;
for (uint32_t tmp67 = 0; tmp67 < tmp62; tmp67++) { for (uint32_t tmp68 = 0; tmp68 < tmp63; tmp68++) {
std::string tmp68; std::string tmp69;
{ {
uint32_t tmp69 = 0; uint32_t tmp70 = 0;
uint32_t tmp70 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp71 = 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+1]) << 16);
uint32_t tmp72 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp73 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp73 = uint32_t(uint8_t(out[outIdx+3]) << 0); uint32_t tmp74 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp69 = tmp70 | tmp71 | tmp72 | tmp73; tmp70 = tmp71 | tmp72 | tmp73 | tmp74;
outIdx+=4; outIdx+=4;
tmp68 = std::string(out+outIdx, out+outIdx+tmp69); tmp69 = std::string(out+outIdx, out+outIdx+tmp70);
outIdx+=tmp69; 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) { if (out != NULL) {
@ -439,96 +442,97 @@ std::string RunDownload_Req_ToCurlStr(RunDownload_Req in0){
std::string in; std::string in;
{ {
{ {
uint32_t tmp30 = in0.M3u8Url.length(); uint32_t tmp31 = in0.M3u8Url.length();
char tmp31[4]; char tmp32[4];
tmp31[0] = (uint32_t(tmp30) >> 24) & 0xFF; tmp32[0] = (uint32_t(tmp31) >> 24) & 0xFF;
tmp31[1] = (uint32_t(tmp30) >> 16) & 0xFF; tmp32[1] = (uint32_t(tmp31) >> 16) & 0xFF;
tmp31[2] = (uint32_t(tmp30) >> 8) & 0xFF; tmp32[2] = (uint32_t(tmp31) >> 8) & 0xFF;
tmp31[3] = (uint32_t(tmp30) >> 0) & 0xFF; tmp32[3] = (uint32_t(tmp31) >> 0) & 0xFF;
in.append(tmp31, 4); in.append(tmp32, 4);
in.append(in0.M3u8Url); in.append(in0.M3u8Url);
} }
in.append((char*)(&in0.Insecure), 1); in.append((char*)(&in0.Insecure), 1);
{ {
uint32_t tmp32 = in0.SaveDir.length(); uint32_t tmp33 = in0.SaveDir.length();
char tmp33[4]; char tmp34[4];
tmp33[0] = (uint32_t(tmp32) >> 24) & 0xFF; tmp34[0] = (uint32_t(tmp33) >> 24) & 0xFF;
tmp33[1] = (uint32_t(tmp32) >> 16) & 0xFF; tmp34[1] = (uint32_t(tmp33) >> 16) & 0xFF;
tmp33[2] = (uint32_t(tmp32) >> 8) & 0xFF; tmp34[2] = (uint32_t(tmp33) >> 8) & 0xFF;
tmp33[3] = (uint32_t(tmp32) >> 0) & 0xFF; tmp34[3] = (uint32_t(tmp33) >> 0) & 0xFF;
in.append(tmp33, 4); in.append(tmp34, 4);
in.append(in0.SaveDir); in.append(in0.SaveDir);
} }
{ {
uint32_t tmp34 = in0.FileName.length(); uint32_t tmp35 = in0.FileName.length();
char tmp35[4]; char tmp36[4];
tmp35[0] = (uint32_t(tmp34) >> 24) & 0xFF; tmp36[0] = (uint32_t(tmp35) >> 24) & 0xFF;
tmp35[1] = (uint32_t(tmp34) >> 16) & 0xFF; tmp36[1] = (uint32_t(tmp35) >> 16) & 0xFF;
tmp35[2] = (uint32_t(tmp34) >> 8) & 0xFF; tmp36[2] = (uint32_t(tmp35) >> 8) & 0xFF;
tmp35[3] = (uint32_t(tmp34) >> 0) & 0xFF; tmp36[3] = (uint32_t(tmp35) >> 0) & 0xFF;
in.append(tmp35, 4); in.append(tmp36, 4);
in.append(in0.FileName); in.append(in0.FileName);
} }
{ {
char tmp36[4]; char tmp37[4];
tmp36[0] = (uint32_t(in0.SkipTsCountFromHead) >> 24) & 0xFF; tmp37[0] = (uint32_t(in0.SkipTsCountFromHead) >> 24) & 0xFF;
tmp36[1] = (uint32_t(in0.SkipTsCountFromHead) >> 16) & 0xFF; tmp37[1] = (uint32_t(in0.SkipTsCountFromHead) >> 16) & 0xFF;
tmp36[2] = (uint32_t(in0.SkipTsCountFromHead) >> 8) & 0xFF; tmp37[2] = (uint32_t(in0.SkipTsCountFromHead) >> 8) & 0xFF;
tmp36[3] = (uint32_t(in0.SkipTsCountFromHead) >> 0) & 0xFF; tmp37[3] = (uint32_t(in0.SkipTsCountFromHead) >> 0) & 0xFF;
in.append(tmp36, 4); in.append(tmp37, 4);
} }
{ {
uint32_t tmp37 = in0.SetProxy.length(); uint32_t tmp38 = in0.SetProxy.length();
char tmp38[4]; char tmp39[4];
tmp38[0] = (uint32_t(tmp37) >> 24) & 0xFF; tmp39[0] = (uint32_t(tmp38) >> 24) & 0xFF;
tmp38[1] = (uint32_t(tmp37) >> 16) & 0xFF; tmp39[1] = (uint32_t(tmp38) >> 16) & 0xFF;
tmp38[2] = (uint32_t(tmp37) >> 8) & 0xFF; tmp39[2] = (uint32_t(tmp38) >> 8) & 0xFF;
tmp38[3] = (uint32_t(tmp37) >> 0) & 0xFF; tmp39[3] = (uint32_t(tmp38) >> 0) & 0xFF;
in.append(tmp38, 4); in.append(tmp39, 4);
in.append(in0.SetProxy); in.append(in0.SetProxy);
} }
{ {
uint32_t tmp39 = in0.HeaderMap.size(); uint32_t tmp40 = in0.HeaderMap.size();
char tmp40[4]; char tmp41[4];
tmp40[0] = (uint32_t(tmp39) >> 24) & 0xFF; tmp41[0] = (uint32_t(tmp40) >> 24) & 0xFF;
tmp40[1] = (uint32_t(tmp39) >> 16) & 0xFF; tmp41[1] = (uint32_t(tmp40) >> 16) & 0xFF;
tmp40[2] = (uint32_t(tmp39) >> 8) & 0xFF; tmp41[2] = (uint32_t(tmp40) >> 8) & 0xFF;
tmp40[3] = (uint32_t(tmp39) >> 0) & 0xFF; tmp41[3] = (uint32_t(tmp40) >> 0) & 0xFF;
in.append(tmp40, 4); in.append(tmp41, 4);
for(std::map<std::string, std::vector<std::string>>::iterator tmp41 = in0.HeaderMap.begin(); tmp41 != in0.HeaderMap.end(); ++tmp41) { for(std::map<std::string, std::vector<std::string>>::iterator tmp42 = in0.HeaderMap.begin(); tmp42 != in0.HeaderMap.end(); ++tmp42) {
{ {
uint32_t tmp42 = tmp41->first.length(); uint32_t tmp43 = tmp42->first.length();
char tmp43[4]; char tmp44[4];
tmp43[0] = (uint32_t(tmp42) >> 24) & 0xFF; tmp44[0] = (uint32_t(tmp43) >> 24) & 0xFF;
tmp43[1] = (uint32_t(tmp42) >> 16) & 0xFF; tmp44[1] = (uint32_t(tmp43) >> 16) & 0xFF;
tmp43[2] = (uint32_t(tmp42) >> 8) & 0xFF; tmp44[2] = (uint32_t(tmp43) >> 8) & 0xFF;
tmp43[3] = (uint32_t(tmp42) >> 0) & 0xFF; tmp44[3] = (uint32_t(tmp43) >> 0) & 0xFF;
in.append(tmp43, 4); in.append(tmp44, 4);
in.append(tmp41->first); in.append(tmp42->first);
} }
{ {
uint32_t tmp44 = tmp41->second.size(); uint32_t tmp45 = tmp42->second.size();
char tmp45[4]; char tmp46[4];
tmp45[0] = (uint32_t(tmp44) >> 24) & 0xFF; tmp46[0] = (uint32_t(tmp45) >> 24) & 0xFF;
tmp45[1] = (uint32_t(tmp44) >> 16) & 0xFF; tmp46[1] = (uint32_t(tmp45) >> 16) & 0xFF;
tmp45[2] = (uint32_t(tmp44) >> 8) & 0xFF; tmp46[2] = (uint32_t(tmp45) >> 8) & 0xFF;
tmp45[3] = (uint32_t(tmp44) >> 0) & 0xFF; tmp46[3] = (uint32_t(tmp45) >> 0) & 0xFF;
in.append(tmp45, 4); in.append(tmp46, 4);
for (uint32_t tmp46=0; tmp46 < tmp44; ++tmp46) { for (uint32_t tmp47=0; tmp47 < tmp45; ++tmp47) {
{ {
uint32_t tmp47 = tmp41->second[tmp46].length(); uint32_t tmp48 = tmp42->second[tmp47].length();
char tmp48[4]; char tmp49[4];
tmp48[0] = (uint32_t(tmp47) >> 24) & 0xFF; tmp49[0] = (uint32_t(tmp48) >> 24) & 0xFF;
tmp48[1] = (uint32_t(tmp47) >> 16) & 0xFF; tmp49[1] = (uint32_t(tmp48) >> 16) & 0xFF;
tmp48[2] = (uint32_t(tmp47) >> 8) & 0xFF; tmp49[2] = (uint32_t(tmp48) >> 8) & 0xFF;
tmp48[3] = (uint32_t(tmp47) >> 0) & 0xFF; tmp49[3] = (uint32_t(tmp48) >> 0) & 0xFF;
in.append(tmp48, 4); in.append(tmp49, 4);
in.append(tmp41->second[tmp46]); in.append(tmp42->second[tmp47]);
} }
} }
} }
} }
} }
in.append((char*)(&in0.SkipRemoveTs), 1);
} }
char *out = NULL; char *out = NULL;
int outLen = 0; int outLen = 0;
@ -536,15 +540,15 @@ std::string RunDownload_Req_ToCurlStr(RunDownload_Req in0){
std::string retValue; std::string retValue;
int outIdx = 0; int outIdx = 0;
{ {
uint32_t tmp49 = 0; uint32_t tmp50 = 0;
uint32_t tmp50 = uint32_t(uint8_t(out[outIdx+0]) << 24); uint32_t tmp51 = 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+1]) << 16);
uint32_t tmp52 = uint32_t(uint8_t(out[outIdx+2]) << 8); uint32_t tmp53 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp53 = uint32_t(uint8_t(out[outIdx+3]) << 0); uint32_t tmp54 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp49 = tmp50 | tmp51 | tmp52 | tmp53; tmp50 = tmp51 | tmp52 | tmp53 | tmp54;
outIdx+=4; outIdx+=4;
retValue = std::string(out+outIdx, out+outIdx+tmp49); retValue = std::string(out+outIdx, out+outIdx+tmp50);
outIdx+=tmp49; outIdx+=tmp50;
} }
if (out != NULL) { if (out != NULL) {
free(out); free(out);

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <cstdlib>
#include <string> #include <string>
#include <vector> #include <vector>
#include <cstdint> #include <cstdint>
@ -15,7 +16,8 @@ struct RunDownload_Req{
int32_t SkipTsCountFromHead; int32_t SkipTsCountFromHead;
std::string SetProxy; std::string SetProxy;
std::map<std::string, std::vector<std::string>> HeaderMap; std::map<std::string, std::vector<std::string>> HeaderMap;
RunDownload_Req(): Insecure(false),SkipTsCountFromHead(0){} bool SkipRemoveTs;
RunDownload_Req(): Insecure(false),SkipTsCountFromHead(0),SkipRemoveTs(false){}
}; };
struct RunDownload_Resp{ struct RunDownload_Resp{
std::string ErrMsg; std::string ErrMsg;

View File

@ -56,6 +56,7 @@ void MainWindow::on_pushButton_RunDownload_clicked()
ui->progressBar->setValue(0); ui->progressBar->setValue(0);
ui->lineEdit_SetProxy->setEnabled(false); ui->lineEdit_SetProxy->setEnabled(false);
ui->pushButton_curlMode->setEnabled(false); ui->pushButton_curlMode->setEnabled(false);
ui->checkBox_SkipRemoveTs->setEnabled(false);
ui->pushButton_StopDownload->setEnabled(true); ui->pushButton_StopDownload->setEnabled(true);
RunDownload_Req req; RunDownload_Req req;
@ -66,6 +67,7 @@ void MainWindow::on_pushButton_RunDownload_clicked()
req.SkipTsCountFromHead = ui->lineEdit_SkipTsCountFromHead->text().toInt(); req.SkipTsCountFromHead = ui->lineEdit_SkipTsCountFromHead->text().toInt();
req.SetProxy = ui->lineEdit_SetProxy->text().toStdString(); req.SetProxy = ui->lineEdit_SetProxy->text().toStdString();
req.HeaderMap = m_HeaderMap; req.HeaderMap = m_HeaderMap;
req.SkipRemoveTs = ui->checkBox_SkipRemoveTs->isChecked();
m_syncUi.AddRunFnOn_OtherThread([req, this](){ m_syncUi.AddRunFnOn_OtherThread([req, this](){
RunDownload_Resp resp = RunDownload(req); RunDownload_Resp resp = RunDownload(req);
@ -81,6 +83,7 @@ void MainWindow::on_pushButton_RunDownload_clicked()
ui->lineEdit_SetProxy->setEnabled(true); ui->lineEdit_SetProxy->setEnabled(true);
ui->pushButton_StopDownload->setEnabled(false); ui->pushButton_StopDownload->setEnabled(false);
ui->pushButton_curlMode->setEnabled(true); ui->pushButton_curlMode->setEnabled(true);
ui->checkBox_SkipRemoveTs->setEnabled(true);
if (resp.IsCancel) { if (resp.IsCancel) {
return; return;
} }

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>762</width>
<height>260</height> <height>253</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -17,10 +17,17 @@
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="4" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>m3u8的url</string> <string>代理设置</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>保存的文件名</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -31,13 +38,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButton_curlMode">
<property name="text">
<string>curl模式</string>
</property>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
@ -73,13 +73,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>保存的文件名</string>
</property>
</widget>
</item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_FileName"> <widget class="QLineEdit" name="lineEdit_FileName">
<property name="placeholderText"> <property name="placeholderText">
@ -87,6 +80,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButton_curlMode">
<property name="text">
<string>curl模式</string>
</property>
</widget>
</item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="text"> <property name="text">
@ -97,10 +97,10 @@
<item row="3" column="1"> <item row="3" column="1">
<widget class="QLineEdit" name="lineEdit_SkipTsCountFromHead"/> <widget class="QLineEdit" name="lineEdit_SkipTsCountFromHead"/>
</item> </item>
<item row="4" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>代理设置</string> <string>m3u8的url</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -123,6 +123,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="checkBox_SkipRemoveTs">
<property name="text">
<string>不删除下载的ts文件</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">

View File

@ -7,8 +7,8 @@ IDI_ICON1 ICON "favicon.ico"
#endif #endif
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,5,5,0 FILEVERSION 1,5,6,0
PRODUCTVERSION 1,5,5,0 PRODUCTVERSION 1,5,6,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG FILEFLAGS VS_FF_DEBUG
@ -23,10 +23,10 @@ VS_VERSION_INFO VERSIONINFO
BEGIN BEGIN
BLOCK "080404b0" BLOCK "080404b0"
BEGIN BEGIN
VALUE "ProductVersion", "1.5.5.0\0" VALUE "ProductVersion", "1.5.6.0\0"
VALUE "ProductName", "m3u8视频下载工具\0" VALUE "ProductName", "m3u8 downloader\0"
VALUE "LegalCopyright", "https://github.com/orestonce/m3u8d\0" VALUE "LegalCopyright", "https://github.com/orestonce/m3u8d\0"
VALUE "FileDescription", "m3u8视频下载工具\0" VALUE "FileDescription", "m3u8 downloader\0"
END END
END END

View File

@ -72,7 +72,10 @@ func MergeTsFileListToSingleMp4(req MergeTsFileListToSingleMp4_Req) (err error)
return req.Ctx.Err() return req.Ctx.Err()
default: default:
} }
DrawProgressBar(len(req.TsFileList), idx) tmp := getOldEnv()
if tmp != nil {
tmp.DrawProgressBar(len(req.TsFileList), idx)
}
var buf []byte var buf []byte
buf, err = ioutil.ReadFile(tsFile) buf, err = ioutil.ReadFile(tsFile)
if err != nil { if err != nil {
@ -95,6 +98,9 @@ func MergeTsFileListToSingleMp4(req MergeTsFileListToSingleMp4_Req) (err error)
if err != nil { if err != nil {
return err return err
} }
DrawProgressBar(1, 1) tmp := getOldEnv()
if tmp != nil {
tmp.DrawProgressBar(1, 1)
}
return nil return nil
} }