feat: migrate playback module to modular domain pattern
This commit is contained in:
18
internal/domain/playback.go
Normal file
18
internal/domain/playback.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"context"
|
||||
"mal/internal/db"
|
||||
)
|
||||
|
||||
type PlaybackService interface {
|
||||
BuildWatchData(ctx context.Context, animeID int, titleCandidates []string, episode string, mode string, userID string) (map[string]any, error)
|
||||
SaveProgress(ctx context.Context, userID string, animeID int64, episode int, timeSeconds float64) error
|
||||
}
|
||||
|
||||
type PlaybackRepository interface {
|
||||
GetWatchListEntry(ctx context.Context, params db.GetWatchListEntryParams) (db.WatchListEntry, error)
|
||||
GetContinueWatchingEntry(ctx context.Context, params db.GetContinueWatchingEntryParams) (db.GetContinueWatchingEntryRow, error)
|
||||
SaveWatchProgress(ctx context.Context, params db.SaveWatchProgressParams) error
|
||||
UpsertContinueWatchingEntry(ctx context.Context, params db.UpsertContinueWatchingEntryParams) (db.ContinueWatchingEntry, error)
|
||||
}
|
||||
27
internal/domain/provider.go
Normal file
27
internal/domain/provider.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
type StreamSource struct {
|
||||
URL string
|
||||
Quality string
|
||||
}
|
||||
|
||||
type StreamResult struct {
|
||||
URL string
|
||||
Referer string
|
||||
Subtitles []Subtitle
|
||||
Qualities []StreamSource
|
||||
}
|
||||
|
||||
type Subtitle struct {
|
||||
URL string
|
||||
Label string
|
||||
}
|
||||
|
||||
type Provider interface {
|
||||
Name() string
|
||||
GetStreams(ctx context.Context, animeID int, episode string, mode string) (*StreamResult, error)
|
||||
}
|
||||
Reference in New Issue
Block a user