feat: add preview sprite backend

This commit is contained in:
2026-04-18 07:38:48 +02:00
parent db8140a266
commit 54ba5eda2d
5 changed files with 531 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ import (
"sort"
"strconv"
"strings"
"sync"
"time"
"mal/internal/jikan"
@@ -24,6 +25,9 @@ type Service struct {
jikanClient *jikan.Client
httpClient *http.Client
db database.Querier
previewRoot string
previewMu sync.Mutex
previewLocks map[string]*sync.Mutex
}
type sourceScore struct {
@@ -41,6 +45,8 @@ func NewService(jikanClient *jikan.Client, db database.Querier) *Service {
jikanClient: jikanClient,
httpClient: &http.Client{Timeout: 12 * time.Second},
db: db,
previewRoot: newPreviewRootDir(),
previewLocks: make(map[string]*sync.Mutex),
}
}