更新gomediay依赖

增加单线程下载模式
main
orestonce 2022-10-24 07:25:46 +08:00
parent 0b9b67986f
commit 0970e0e372
10 changed files with 285 additions and 263 deletions

View File

@ -113,6 +113,7 @@ func init() {
downloadCmd.Flags().IntVarP(&gRunReq.SkipTsCountFromHead, "SkipTsCountFromHead", "", 0, "跳过前面几个ts")
downloadCmd.Flags().StringVarP(&gRunReq.SetProxy, "SetProxy", "", "", "代理设置, http://127.0.0.1:8080 socks5://127.0.0.1:1089")
downloadCmd.Flags().BoolVarP(&gRunReq.SkipRemoveTs, "SkipRemoveTs", "", false, "不删除下载的ts文件")
downloadCmd.Flags().BoolVarP(&gRunReq.SingleThread, "SingleThread", "", false, "单线程下载")
rootCmd.AddCommand(downloadCmd)
curlCmd.DisableFlagParsing = true
rootCmd.AddCommand(curlCmd)

View File

@ -91,6 +91,7 @@ type RunDownload_Req struct {
HeaderMap map[string][]string
SkipRemoveTs bool
ProgressBarShow bool
SingleThread bool
}
type downloadEnv struct {
@ -200,7 +201,7 @@ func (this *downloadEnv) RunDownload(req RunDownload_Req) (resp RunDownload_Resp
// 下载ts
this.SetProgressBarTitle("[4/6]下载ts")
this.speedSetBegin()
err = this.downloader(tsList, downloadDir, tsKey)
err = this.downloader(tsList, downloadDir, tsKey, req.SingleThread)
this.speedClearBytes()
if err != nil {
resp.ErrMsg = "下载ts文件错误: " + err.Error()
@ -458,8 +459,12 @@ func (this *downloadEnv) SleepDur(d time.Duration) {
}
}
func (this *downloadEnv) downloader(tsList []TsInfo, downloadDir string, key string) (err error) {
task := gopool.NewThreadPool(8)
func (this *downloadEnv) downloader(tsList []TsInfo, downloadDir string, key string, singleThread bool) (err error) {
var threadCount = 8
if singleThread {
threadCount = 1
}
task := gopool.NewThreadPool(threadCount)
tsLen := len(tsList)
downloadCount := 0
var locker sync.Mutex

View File

@ -18,7 +18,7 @@ func main() {
BuildCliBinary() // 编译命令行版本
if os.Getenv("GITHUB_ACTIONS") == "" { // 本地编译
CreateLibForQtUi("amd64-static") // 创建Qt需要使用的.a库文件
WriteVersionDotRc("1.5.6")
WriteVersionDotRc("1.5.20")
} else { // github actions 编译
if runtime.GOOS == "darwin" { // 编译darwin版本的dmg
CreateLibForQtUi("amd64-shared")

3
go.mod
View File

@ -7,8 +7,7 @@ require (
github.com/orestonce/go2cpp v0.0.0-20220802140809-b2a921a62a07
github.com/orestonce/gopool v0.0.0-20220508090328-d7d56d45b171
github.com/spf13/cobra v1.4.0
github.com/yapingcat/gomedia v0.0.0-20220731053213-04782526c441
golang.org/x/net v0.0.0-20220617184016-355a448f1bc9
github.com/yapingcat/gomedia v0.0.0-20221023155149-c5f2f0f45ca5
golang.org/x/text v0.3.7
)

9
go.sum
View File

@ -12,13 +12,8 @@ github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q=
github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/yapingcat/gomedia v0.0.0-20220731053213-04782526c441 h1:SAohYbjWwtDtpjW9GmV6IFDou2CW4MvUXxJtz3FiuR0=
github.com/yapingcat/gomedia v0.0.0-20220731053213-04782526c441/go.mod h1:WSZ59bidJOO40JSJmLqlkBJrjZCtjbKKkygEMfzY/kc=
golang.org/x/net v0.0.0-20220617184016-355a448f1bc9 h1:Yqz/iviulwKwAREEeUd3nbBFn0XuyJqkoft2IlrvOhc=
golang.org/x/net v0.0.0-20220617184016-355a448f1bc9/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
github.com/yapingcat/gomedia v0.0.0-20221023155149-c5f2f0f45ca5 h1:dswmlgf8sSrjaQJCGDpmI14sIkHqyIZdP6Jwzl7gVDY=
github.com/yapingcat/gomedia v0.0.0-20221023155149-c5f2f0f45ca5/go.mod h1:WSZ59bidJOO40JSJmLqlkBJrjZCtjbKKkygEMfzY/kc=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

View File

@ -6,7 +6,7 @@
#line 1 "cgo-builtin-export-prolog"
#include <stddef.h> /* for ptrdiff_t below */
#include <stddef.h>
#ifndef GO_CGO_EXPORT_PROLOGUE_H
#define GO_CGO_EXPORT_PROLOGUE_H
@ -41,11 +41,17 @@ typedef long long GoInt64;
typedef unsigned long long GoUint64;
typedef GoInt64 GoInt;
typedef GoUint64 GoUint;
typedef __SIZE_TYPE__ GoUintptr;
typedef size_t GoUintptr;
typedef float GoFloat32;
typedef double GoFloat64;
#ifdef _MSC_VER
#include <complex.h>
typedef _Fcomplex GoComplex64;
typedef _Dcomplex GoComplex128;
#else
typedef float _Complex GoComplex64;
typedef double _Complex GoComplex128;
#endif
/*
static assertion to make sure the file is being used on architecture
@ -86,91 +92,91 @@ RunDownload_Resp RunDownload(RunDownload_Req in0){
std::string in;
{
{
uint32_t tmp35 = in0.M3u8Url.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.M3u8Url.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.M3u8Url);
}
in.append((char*)(&in0.Insecure), 1);
{
uint32_t tmp37 = in0.SaveDir.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.SaveDir.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.SaveDir);
}
{
uint32_t tmp39 = in0.FileName.length();
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);
uint32_t tmp40 = in0.FileName.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);
in.append(in0.FileName);
}
{
char tmp41[4];
tmp41[0] = (uint32_t(in0.SkipTsCountFromHead) >> 24) & 0xFF;
tmp41[1] = (uint32_t(in0.SkipTsCountFromHead) >> 16) & 0xFF;
tmp41[2] = (uint32_t(in0.SkipTsCountFromHead) >> 8) & 0xFF;
tmp41[3] = (uint32_t(in0.SkipTsCountFromHead) >> 0) & 0xFF;
in.append(tmp41, 4);
char tmp42[4];
tmp42[0] = (uint32_t(in0.SkipTsCountFromHead) >> 24) & 0xFF;
tmp42[1] = (uint32_t(in0.SkipTsCountFromHead) >> 16) & 0xFF;
tmp42[2] = (uint32_t(in0.SkipTsCountFromHead) >> 8) & 0xFF;
tmp42[3] = (uint32_t(in0.SkipTsCountFromHead) >> 0) & 0xFF;
in.append(tmp42, 4);
}
{
uint32_t tmp42 = in0.SetProxy.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);
uint32_t tmp43 = in0.SetProxy.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(in0.SetProxy);
}
{
uint32_t tmp44 = in0.HeaderMap.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(std::map<std::string, std::vector<std::string>>::iterator tmp46 = in0.HeaderMap.begin(); tmp46 != in0.HeaderMap.end(); ++tmp46) {
uint32_t tmp45 = in0.HeaderMap.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(std::map<std::string, std::vector<std::string>>::iterator tmp47 = in0.HeaderMap.begin(); tmp47 != in0.HeaderMap.end(); ++tmp47) {
{
uint32_t tmp47 = tmp46->first.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(tmp46->first);
uint32_t tmp48 = tmp47->first.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(tmp47->first);
}
{
uint32_t tmp49 = tmp46->second.size();
char tmp50[4];
tmp50[0] = (uint32_t(tmp49) >> 24) & 0xFF;
tmp50[1] = (uint32_t(tmp49) >> 16) & 0xFF;
tmp50[2] = (uint32_t(tmp49) >> 8) & 0xFF;
tmp50[3] = (uint32_t(tmp49) >> 0) & 0xFF;
in.append(tmp50, 4);
for (uint32_t tmp51=0; tmp51 < tmp49; ++tmp51) {
uint32_t tmp50 = tmp47->second.size();
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);
for (uint32_t tmp52=0; tmp52 < tmp50; ++tmp52) {
{
uint32_t tmp52 = tmp46->second[tmp51].length();
char tmp53[4];
tmp53[0] = (uint32_t(tmp52) >> 24) & 0xFF;
tmp53[1] = (uint32_t(tmp52) >> 16) & 0xFF;
tmp53[2] = (uint32_t(tmp52) >> 8) & 0xFF;
tmp53[3] = (uint32_t(tmp52) >> 0) & 0xFF;
in.append(tmp53, 4);
in.append(tmp46->second[tmp51]);
uint32_t tmp53 = tmp47->second[tmp52].length();
char tmp54[4];
tmp54[0] = (uint32_t(tmp53) >> 24) & 0xFF;
tmp54[1] = (uint32_t(tmp53) >> 16) & 0xFF;
tmp54[2] = (uint32_t(tmp53) >> 8) & 0xFF;
tmp54[3] = (uint32_t(tmp53) >> 0) & 0xFF;
in.append(tmp54, 4);
in.append(tmp47->second[tmp52]);
}
}
}
@ -178,6 +184,7 @@ RunDownload_Resp RunDownload(RunDownload_Req in0){
}
in.append((char*)(&in0.SkipRemoveTs), 1);
in.append((char*)(&in0.ProgressBarShow), 1);
in.append((char*)(&in0.SingleThread), 1);
}
char *out = NULL;
int outLen = 0;
@ -186,30 +193,30 @@ RunDownload_Resp RunDownload(RunDownload_Req in0){
int outIdx = 0;
{
{
uint32_t tmp54 = 0;
uint32_t tmp55 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp56 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp57 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp58 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp54 = tmp55 | tmp56 | tmp57 | tmp58;
uint32_t tmp55 = 0;
uint32_t tmp56 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp57 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp58 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp59 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp55 = tmp56 | tmp57 | tmp58 | tmp59;
outIdx+=4;
retValue.ErrMsg = std::string(out+outIdx, out+outIdx+tmp54);
outIdx+=tmp54;
retValue.ErrMsg = std::string(out+outIdx, out+outIdx+tmp55);
outIdx+=tmp55;
}
retValue.IsSkipped = (bool) out[outIdx];
outIdx++;
retValue.IsCancel = (bool) out[outIdx];
outIdx++;
{
uint32_t tmp59 = 0;
uint32_t tmp60 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp61 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp62 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp63 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp59 = tmp60 | tmp61 | tmp62 | tmp63;
uint32_t tmp60 = 0;
uint32_t tmp61 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp62 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp63 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp64 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp60 = tmp61 | tmp62 | tmp63 | tmp64;
outIdx+=4;
retValue.SaveFileTo = std::string(out+outIdx, out+outIdx+tmp59);
outIdx+=tmp59;
retValue.SaveFileTo = std::string(out+outIdx, out+outIdx+tmp60);
outIdx+=tmp60;
}
}
if (out != NULL) {
@ -300,13 +307,13 @@ std::string GetWd(){
ParseCurl_Resp ParseCurlStr(std::string in0){
std::string in;
{
uint32_t tmp20 = in0.length();
char tmp21[4];
tmp21[0] = (uint32_t(tmp20) >> 24) & 0xFF;
tmp21[1] = (uint32_t(tmp20) >> 16) & 0xFF;
tmp21[2] = (uint32_t(tmp20) >> 8) & 0xFF;
tmp21[3] = (uint32_t(tmp20) >> 0) & 0xFF;
in.append(tmp21, 4);
uint32_t tmp21 = in0.length();
char tmp22[4];
tmp22[0] = (uint32_t(tmp21) >> 24) & 0xFF;
tmp22[1] = (uint32_t(tmp21) >> 16) & 0xFF;
tmp22[2] = (uint32_t(tmp21) >> 8) & 0xFF;
tmp22[3] = (uint32_t(tmp21) >> 0) & 0xFF;
in.append(tmp22, 4);
in.append(in0);
}
char *out = NULL;
@ -316,124 +323,126 @@ ParseCurl_Resp ParseCurlStr(std::string in0){
int outIdx = 0;
{
{
uint32_t tmp22 = 0;
uint32_t tmp23 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp24 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp25 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp26 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp22 = tmp23 | tmp24 | tmp25 | tmp26;
uint32_t tmp23 = 0;
uint32_t tmp24 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp25 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp26 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp27 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp23 = tmp24 | tmp25 | tmp26 | tmp27;
outIdx+=4;
retValue.ErrMsg = std::string(out+outIdx, out+outIdx+tmp22);
outIdx+=tmp22;
retValue.ErrMsg = std::string(out+outIdx, out+outIdx+tmp23);
outIdx+=tmp23;
}
{
{
uint32_t tmp27 = 0;
uint32_t tmp28 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp29 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp30 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp31 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp27 = tmp28 | tmp29 | tmp30 | tmp31;
uint32_t tmp28 = 0;
uint32_t tmp29 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp30 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp31 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp32 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp28 = tmp29 | tmp30 | tmp31 | tmp32;
outIdx+=4;
retValue.DownloadReq.M3u8Url = std::string(out+outIdx, out+outIdx+tmp27);
outIdx+=tmp27;
retValue.DownloadReq.M3u8Url = std::string(out+outIdx, out+outIdx+tmp28);
outIdx+=tmp28;
}
retValue.DownloadReq.Insecure = (bool) out[outIdx];
outIdx++;
{
uint32_t tmp32 = 0;
uint32_t tmp33 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp34 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp35 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp36 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp32 = tmp33 | tmp34 | tmp35 | tmp36;
uint32_t tmp33 = 0;
uint32_t tmp34 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp35 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp36 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp37 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp33 = tmp34 | tmp35 | tmp36 | tmp37;
outIdx+=4;
retValue.DownloadReq.SaveDir = std::string(out+outIdx, out+outIdx+tmp32);
outIdx+=tmp32;
retValue.DownloadReq.SaveDir = std::string(out+outIdx, out+outIdx+tmp33);
outIdx+=tmp33;
}
{
uint32_t tmp37 = 0;
uint32_t tmp38 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp39 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp40 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp41 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp37 = tmp38 | tmp39 | tmp40 | tmp41;
uint32_t tmp38 = 0;
uint32_t tmp39 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp40 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp41 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp42 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp38 = tmp39 | tmp40 | tmp41 | tmp42;
outIdx+=4;
retValue.DownloadReq.FileName = std::string(out+outIdx, out+outIdx+tmp37);
outIdx+=tmp37;
retValue.DownloadReq.FileName = std::string(out+outIdx, out+outIdx+tmp38);
outIdx+=tmp38;
}
{
uint32_t tmp42 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp43 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp44 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp45 = uint32_t(uint8_t(out[outIdx+3]) << 0);
retValue.DownloadReq.SkipTsCountFromHead = tmp42 | tmp43 | tmp44 | tmp45;
uint32_t tmp43 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp44 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp45 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp46 = uint32_t(uint8_t(out[outIdx+3]) << 0);
retValue.DownloadReq.SkipTsCountFromHead = tmp43 | tmp44 | tmp45 | tmp46;
outIdx+=4;
}
{
uint32_t tmp46 = 0;
uint32_t tmp47 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp48 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp49 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp50 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp46 = tmp47 | tmp48 | tmp49 | tmp50;
uint32_t tmp47 = 0;
uint32_t tmp48 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp49 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp50 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp51 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp47 = tmp48 | tmp49 | tmp50 | tmp51;
outIdx+=4;
retValue.DownloadReq.SetProxy = std::string(out+outIdx, out+outIdx+tmp46);
outIdx+=tmp46;
retValue.DownloadReq.SetProxy = std::string(out+outIdx, out+outIdx+tmp47);
outIdx+=tmp47;
}
{
uint32_t tmp51 = 0;
uint32_t tmp52 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp53 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp54 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp55 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp51 = tmp52 | tmp53 | tmp54 | tmp55;
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;
outIdx+=4;
for (uint32_t tmp56 = 0; tmp56 < tmp51; tmp56++) {
std::string tmp57;
for (uint32_t tmp57 = 0; tmp57 < tmp52; tmp57++) {
std::string tmp58;
{
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;
uint32_t tmp59 = 0;
uint32_t tmp60 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp61 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp62 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp63 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp59 = tmp60 | tmp61 | tmp62 | tmp63;
outIdx+=4;
tmp57 = std::string(out+outIdx, out+outIdx+tmp58);
outIdx+=tmp58;
tmp58 = std::string(out+outIdx, out+outIdx+tmp59);
outIdx+=tmp59;
}
std::vector<std::string> tmp63;
std::vector<std::string> tmp64;
{
uint32_t tmp64 = 0;
uint32_t tmp65 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp66 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp67 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp68 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp64 = tmp65 | tmp66 | tmp67 | tmp68;
uint32_t tmp65 = 0;
uint32_t tmp66 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp67 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp68 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp69 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp65 = tmp66 | tmp67 | tmp68 | tmp69;
outIdx+=4;
for (uint32_t tmp69 = 0; tmp69 < tmp64; tmp69++) {
std::string tmp70;
for (uint32_t tmp70 = 0; tmp70 < tmp65; tmp70++) {
std::string tmp71;
{
uint32_t tmp71 = 0;
uint32_t tmp72 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp73 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp74 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp75 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp71 = tmp72 | tmp73 | tmp74 | tmp75;
uint32_t tmp72 = 0;
uint32_t tmp73 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp74 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp75 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp76 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp72 = tmp73 | tmp74 | tmp75 | tmp76;
outIdx+=4;
tmp70 = std::string(out+outIdx, out+outIdx+tmp71);
outIdx+=tmp71;
tmp71 = std::string(out+outIdx, out+outIdx+tmp72);
outIdx+=tmp72;
}
tmp63.push_back(tmp70);
tmp64.push_back(tmp71);
}
}
retValue.DownloadReq.HeaderMap[tmp57] = tmp63;
retValue.DownloadReq.HeaderMap[tmp58] = tmp64;
}
}
retValue.DownloadReq.SkipRemoveTs = (bool) out[outIdx];
outIdx++;
retValue.DownloadReq.ProgressBarShow = (bool) out[outIdx];
outIdx++;
retValue.DownloadReq.SingleThread = (bool) out[outIdx];
outIdx++;
}
}
if (out != NULL) {
@ -446,91 +455,91 @@ std::string RunDownload_Req_ToCurlStr(RunDownload_Req in0){
std::string in;
{
{
uint32_t tmp32 = in0.M3u8Url.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.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);
in.append(in0.M3u8Url);
}
in.append((char*)(&in0.Insecure), 1);
{
uint32_t tmp34 = in0.SaveDir.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.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);
in.append(in0.SaveDir);
}
{
uint32_t tmp36 = in0.FileName.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);
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);
in.append(in0.FileName);
}
{
char tmp38[4];
tmp38[0] = (uint32_t(in0.SkipTsCountFromHead) >> 24) & 0xFF;
tmp38[1] = (uint32_t(in0.SkipTsCountFromHead) >> 16) & 0xFF;
tmp38[2] = (uint32_t(in0.SkipTsCountFromHead) >> 8) & 0xFF;
tmp38[3] = (uint32_t(in0.SkipTsCountFromHead) >> 0) & 0xFF;
in.append(tmp38, 4);
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);
}
{
uint32_t tmp39 = in0.SetProxy.length();
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);
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);
in.append(in0.SetProxy);
}
{
uint32_t tmp41 = in0.HeaderMap.size();
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);
for(std::map<std::string, std::vector<std::string>>::iterator tmp43 = in0.HeaderMap.begin(); tmp43 != in0.HeaderMap.end(); ++tmp43) {
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<std::string, std::vector<std::string>>::iterator tmp44 = in0.HeaderMap.begin(); tmp44 != in0.HeaderMap.end(); ++tmp44) {
{
uint32_t tmp44 = tmp43->first.length();
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);
in.append(tmp43->first);
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 = tmp43->second.size();
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);
for (uint32_t tmp48=0; tmp48 < tmp46; ++tmp48) {
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 tmp49 = tmp43->second[tmp48].length();
char tmp50[4];
tmp50[0] = (uint32_t(tmp49) >> 24) & 0xFF;
tmp50[1] = (uint32_t(tmp49) >> 16) & 0xFF;
tmp50[2] = (uint32_t(tmp49) >> 8) & 0xFF;
tmp50[3] = (uint32_t(tmp49) >> 0) & 0xFF;
in.append(tmp50, 4);
in.append(tmp43->second[tmp48]);
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]);
}
}
}
@ -538,6 +547,7 @@ std::string RunDownload_Req_ToCurlStr(RunDownload_Req in0){
}
in.append((char*)(&in0.SkipRemoveTs), 1);
in.append((char*)(&in0.ProgressBarShow), 1);
in.append((char*)(&in0.SingleThread), 1);
}
char *out = NULL;
int outLen = 0;
@ -545,15 +555,15 @@ std::string RunDownload_Req_ToCurlStr(RunDownload_Req in0){
std::string retValue;
int outIdx = 0;
{
uint32_t tmp51 = 0;
uint32_t tmp52 = uint32_t(uint8_t(out[outIdx+0]) << 24);
uint32_t tmp53 = uint32_t(uint8_t(out[outIdx+1]) << 16);
uint32_t tmp54 = uint32_t(uint8_t(out[outIdx+2]) << 8);
uint32_t tmp55 = uint32_t(uint8_t(out[outIdx+3]) << 0);
tmp51 = tmp52 | tmp53 | tmp54 | tmp55;
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;
outIdx+=4;
retValue = std::string(out+outIdx, out+outIdx+tmp51);
outIdx+=tmp51;
retValue = std::string(out+outIdx, out+outIdx+tmp52);
outIdx+=tmp52;
}
if (out != NULL) {
free(out);

View File

@ -18,7 +18,8 @@ struct RunDownload_Req{
std::map<std::string, std::vector<std::string>> HeaderMap;
bool SkipRemoveTs;
bool ProgressBarShow;
RunDownload_Req(): Insecure(false),SkipTsCountFromHead(0),SkipRemoveTs(false),ProgressBarShow(false){}
bool SingleThread;
RunDownload_Req(): Insecure(false),SkipTsCountFromHead(0),SkipRemoveTs(false),ProgressBarShow(false),SingleThread(false){}
};
struct RunDownload_Resp{
std::string ErrMsg;

View File

@ -4,6 +4,7 @@
#include <atomic>
#include <QFileDialog>
#include <QIntValidator>
#include <QMessageBox>
#include "curldialog.h"
MainWindow::MainWindow(QWidget *parent) :
@ -57,6 +58,7 @@ void MainWindow::on_pushButton_RunDownload_clicked()
ui->lineEdit_SetProxy->setEnabled(false);
ui->pushButton_curlMode->setEnabled(false);
ui->checkBox_SkipRemoveTs->setEnabled(false);
ui->checkBox_SingleThread->setEnabled(false);
ui->pushButton_StopDownload->setEnabled(true);
RunDownload_Req req;
@ -68,6 +70,7 @@ void MainWindow::on_pushButton_RunDownload_clicked()
req.SetProxy = ui->lineEdit_SetProxy->text().toStdString();
req.HeaderMap = m_HeaderMap;
req.SkipRemoveTs = ui->checkBox_SkipRemoveTs->isChecked();
req.SingleThread = ui->checkBox_SingleThread->isChecked();
m_syncUi.AddRunFnOn_OtherThread([req, this](){
RunDownload_Resp resp = RunDownload(req);
@ -84,12 +87,13 @@ void MainWindow::on_pushButton_RunDownload_clicked()
ui->pushButton_StopDownload->setEnabled(false);
ui->pushButton_curlMode->setEnabled(true);
ui->checkBox_SkipRemoveTs->setEnabled(true);
ui->checkBox_SingleThread->setEnabled(true);
if (resp.IsCancel) {
return;
}
if (!resp.ErrMsg.empty()) {
Toast::Instance()->SetError(QString::fromStdString(resp.ErrMsg));
QMessageBox::warning(this, "下载错误", QString::fromStdString(resp.ErrMsg));
return;
}
if (resp.IsSkipped) {

View File

@ -130,6 +130,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_SingleThread">
<property name="text">
<string>单线程下载</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">

View File

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