61 lines
1.3 KiB
Go
61 lines
1.3 KiB
Go
package main
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/lrstanley/go-ytdlp"
|
|
)
|
|
|
|
type DownloadOptions struct {
|
|
EmbedThumbnail bool
|
|
IncludeSubtitles bool
|
|
VideoFormatID string
|
|
AudioFormatID string
|
|
}
|
|
|
|
type VideoOption struct {
|
|
Height *int `json:"height,omitempty"`
|
|
Resolution string `json:"resolution,omitempty"`
|
|
FormatID string `json:"format_id"`
|
|
Ext string `json:"ext"`
|
|
TBR *float64 `json:"tbr,omitempty"`
|
|
}
|
|
|
|
type AudioOption struct {
|
|
Format string `json:"format"`
|
|
FormatID string `json:"format_id"`
|
|
Ext string `json:"ext"`
|
|
TBR *float64 `json:"tbr,omitempty"`
|
|
Language *string `json:"language,omitempty"`
|
|
}
|
|
|
|
type FormatOptions struct {
|
|
VideoOptions []VideoOption `json:"video_options"`
|
|
AudioOptions []AudioOption `json:"audio_options"`
|
|
}
|
|
|
|
type ProgressUpdate struct {
|
|
Status ytdlp.ProgressStatus
|
|
Percent string
|
|
ETA time.Duration
|
|
Filename string
|
|
Phase string
|
|
}
|
|
|
|
// InteractionState holds the state for a specific interaction
|
|
type InteractionState struct {
|
|
URL string
|
|
FormatOptions *FormatOptions
|
|
VideoFormatID string
|
|
AudioFormatID string
|
|
}
|
|
|
|
// DownloadResult represents the result of an async download operation
|
|
type DownloadResult struct {
|
|
Success bool
|
|
Message string
|
|
URL string
|
|
Format string
|
|
Error error
|
|
}
|