Remove probe start callback as goutubedl is now quicker
This commit is contained in:
parent
0d9d2295c1
commit
199017a0a3
7
dl.go
7
dl.go
@ -11,12 +11,10 @@ import (
|
|||||||
|
|
||||||
const downloadAndConvertTimeout = 5 * time.Minute
|
const downloadAndConvertTimeout = 5 * time.Minute
|
||||||
|
|
||||||
type ProbeStartCallbackFunc func(ctx context.Context)
|
|
||||||
type ConvertStartCallbackFunc func(ctx context.Context, videoCodecs, audioCodecs, convertActionsNeeded string)
|
type ConvertStartCallbackFunc func(ctx context.Context, videoCodecs, audioCodecs, convertActionsNeeded string)
|
||||||
type UpdateProgressPercentCallbackFunc func(progressStr string, progressPercent int)
|
type UpdateProgressPercentCallbackFunc func(progressStr string, progressPercent int)
|
||||||
|
|
||||||
type Downloader struct {
|
type Downloader struct {
|
||||||
ProbeStartFunc ProbeStartCallbackFunc
|
|
||||||
ConvertStartFunc ConvertStartCallbackFunc
|
ConvertStartFunc ConvertStartCallbackFunc
|
||||||
UpdateProgressPercentFunc UpdateProgressPercentCallbackFunc
|
UpdateProgressPercentFunc UpdateProgressPercentCallbackFunc
|
||||||
}
|
}
|
||||||
@ -33,6 +31,7 @@ func (d *Downloader) downloadURL(dlCtx context.Context, url string) (rr *ReReadC
|
|||||||
Type: goutubedl.TypeSingle,
|
Type: goutubedl.TypeSingle,
|
||||||
DebugLog: goYouTubeDLLogger{},
|
DebugLog: goYouTubeDLLogger{},
|
||||||
// StderrFn: func(cmd *exec.Cmd) io.Writer { return io.Writer(os.Stdout) },
|
// StderrFn: func(cmd *exec.Cmd) io.Writer { return io.Writer(os.Stdout) },
|
||||||
|
NoInfoDownload: true,
|
||||||
MergeOutputFormat: "mkv", // This handles VP9 properly. yt-dlp uses mp4 by default, which doesn't.
|
MergeOutputFormat: "mkv", // This handles VP9 properly. yt-dlp uses mp4 by default, which doesn't.
|
||||||
SortingFormat: "res:720", // Prefer videos no larger than 720p to keep their size small.
|
SortingFormat: "res:720", // Prefer videos no larger than 720p to keep their size small.
|
||||||
})
|
})
|
||||||
@ -58,10 +57,6 @@ func (d *Downloader) DownloadAndConvertURL(ctx context.Context, url string) (r i
|
|||||||
UpdateProgressPercentCallback: d.UpdateProgressPercentFunc,
|
UpdateProgressPercentCallback: d.UpdateProgressPercentFunc,
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.ProbeStartFunc != nil {
|
|
||||||
d.ProbeStartFunc(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := conv.Probe(rr); err != nil {
|
if err := conv.Probe(rr); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
3
queue.go
3
queue.go
@ -195,9 +195,6 @@ func (q *DownloadQueue) processQueueEntry(ctx context.Context, qEntry *DownloadQ
|
|||||||
qEntry.editReply(ctx, processStartStr)
|
qEntry.editReply(ctx, processStartStr)
|
||||||
|
|
||||||
downloader := Downloader{
|
downloader := Downloader{
|
||||||
ProbeStartFunc: func(ctx context.Context) {
|
|
||||||
qEntry.editReply(ctx, "🎬 Getting video format...")
|
|
||||||
},
|
|
||||||
ConvertStartFunc: func(ctx context.Context, videoCodecs, audioCodecs, convertActionsNeeded string) {
|
ConvertStartFunc: func(ctx context.Context, videoCodecs, audioCodecs, convertActionsNeeded string) {
|
||||||
q.currentlyDownloadedEntry.sourceCodecInfo = "🎬 Source: " + videoCodecs
|
q.currentlyDownloadedEntry.sourceCodecInfo = "🎬 Source: " + videoCodecs
|
||||||
if audioCodecs == "" {
|
if audioCodecs == "" {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user