initial Go port of streamrip

This commit is contained in:
2026-04-19 21:11:38 +02:00
commit 97e8b758b3
32 changed files with 7008 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
package media
import "context"
type Media interface {
Rip(ctx context.Context) error
}
type Pending interface {
Resolve(ctx context.Context) (Media, error)
}
type MediaFunc struct {
RipFn func(ctx context.Context) error
}
func (m MediaFunc) Rip(ctx context.Context) error {
if m.RipFn == nil {
return nil
}
return m.RipFn(ctx)
}
type PendingFunc struct {
ResolveFn func(ctx context.Context) (Media, error)
}
func (p PendingFunc) Resolve(ctx context.Context) (Media, error) {
if p.ResolveFn == nil {
return MediaFunc{}, nil
}
return p.ResolveFn(ctx)
}