* Initial plan * Implement parameter support for /ytdlp command Co-authored-by: krau <71133316+krau@users.noreply.github.com> * Add comprehensive tests for ytdlp parameter parsing Co-authored-by: krau <71133316+krau@users.noreply.github.com> * Improve flag parsing logic and clarify argument order Co-authored-by: krau <71133316+krau@users.noreply.github.com> * Preserve critical defaults and improve comments Co-authored-by: krau <71133316+krau@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: krau <71133316+krau@users.noreply.github.com>
52 lines
773 B
Go
52 lines
773 B
Go
package ioutil
|
|
|
|
import (
|
|
"io"
|
|
)
|
|
|
|
type ProgressWriterAt struct {
|
|
wrAt io.WriterAt
|
|
onWrite func(n int)
|
|
}
|
|
|
|
func (p *ProgressWriterAt) WriteAt(buf []byte, off int64) (n int, err error) {
|
|
n, err = p.wrAt.WriteAt(buf, off)
|
|
if n > 0 {
|
|
p.onWrite(n)
|
|
}
|
|
return
|
|
}
|
|
|
|
func NewProgressWriterAt(
|
|
wrAt io.WriterAt,
|
|
onWrite func(n int),
|
|
) *ProgressWriterAt {
|
|
return &ProgressWriterAt{
|
|
wrAt: wrAt,
|
|
onWrite: onWrite,
|
|
}
|
|
}
|
|
|
|
type ProgressWriter struct {
|
|
wr io.Writer
|
|
onWrite func(n int)
|
|
}
|
|
|
|
func (p *ProgressWriter) Write(buf []byte) (n int, err error) {
|
|
n, err = p.wr.Write(buf)
|
|
if n > 0 {
|
|
p.onWrite(n)
|
|
}
|
|
return
|
|
}
|
|
|
|
func NewProgressWriter(
|
|
wr io.Writer,
|
|
onWrite func(n int),
|
|
) *ProgressWriter {
|
|
return &ProgressWriter{
|
|
wr: wr,
|
|
onWrite: onWrite,
|
|
}
|
|
}
|