feat(uploads): match release groups with MusicBrainz and AcoustID
ci / module boundaries / boundaries (push) Successful in 10s
ci / mobile / mobile (Metro-бандл Android) (push) Successful in 1m30s
ci / api / api (push) Successful in 58s
ci / contract / contract (сгенерированный код совпадает с openapi.yaml) (push) Successful in 1m1s
ci / db / db (push) Failing after 25s
ci / docker / docker (образы собираются — их сервер собирает сам при обновлении) (push) Successful in 1m36s
ci / ts / ts (packages + web) (push) Failing after 6m3s
ci / module boundaries / boundaries (push) Successful in 10s
ci / mobile / mobile (Metro-бандл Android) (push) Successful in 1m30s
ci / api / api (push) Successful in 58s
ci / contract / contract (сгенерированный код совпадает с openapi.yaml) (push) Successful in 1m1s
ci / db / db (push) Failing after 25s
ci / docker / docker (образы собираются — их сервер собирает сам при обновлении) (push) Successful in 1m36s
ci / ts / ts (packages + web) (push) Failing after 6m3s
This commit is contained in:
1 parent
1e3a149aef
commit
39bf7d4b70
45 files changed
+4792
-417
No files matched your search
@@ -13,9 +13,11 @@ import (
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"pipu/api/internal/acoustid"
|
||||
"pipu/api/internal/auth"
|
||||
"pipu/api/internal/library"
|
||||
"pipu/api/internal/library/meta"
|
||||
"pipu/api/internal/musicbrainz"
|
||||
"pipu/api/internal/platform/apperr"
|
||||
)
|
||||
|
||||
@@ -37,9 +39,28 @@ type Service struct {
|
||||
cfg Config
|
||||
log *slog.Logger
|
||||
|
||||
wakeProcess chan struct{}
|
||||
wakeImport chan struct{}
|
||||
now func() time.Time
|
||||
wakeProcess chan struct{}
|
||||
wakeImport chan struct{}
|
||||
now func() time.Time
|
||||
catalogue ReleaseCatalogue
|
||||
identifier AudioIdentifier
|
||||
encodedFingerprint func(context.Context, string) (string, error)
|
||||
}
|
||||
|
||||
type ReleaseCatalogue interface {
|
||||
Search(context.Context, musicbrainz.Query) ([]musicbrainz.Release, error)
|
||||
Cover(context.Context, musicbrainz.Release) (musicbrainz.Cover, error)
|
||||
}
|
||||
|
||||
func (s *Service) SetReleaseCatalogue(c ReleaseCatalogue) { s.catalogue = c }
|
||||
|
||||
type AudioIdentifier interface {
|
||||
Lookup(context.Context, string, int) ([]acoustid.Match, error)
|
||||
}
|
||||
|
||||
func (s *Service) SetAudioIdentifier(c AudioIdentifier) {
|
||||
s.identifier = c
|
||||
s.encodedFingerprint = s.fpcalc.EncodedFingerprint
|
||||
}
|
||||
|
||||
// NewService создаёт сервис очереди.
|
||||
@@ -578,7 +599,13 @@ func (s *Service) removeStaging(ctx context.Context, f File) {
|
||||
_ = os.Remove(m)
|
||||
}
|
||||
_ = os.Remove(filepath.Dir(p)) // каталог пачки, если опустел
|
||||
if f.CoverPath != nil {
|
||||
// A mixed batch can retain an unassigned original cover even when this file has none.
|
||||
if s.store != nil {
|
||||
if covers, err := s.store.UnusedReleaseCovers(ctx, f.BatchID); err == nil {
|
||||
for _, cover := range covers {
|
||||
_ = os.Remove(s.stagingAbs(cover))
|
||||
}
|
||||
}
|
||||
if cover, err := s.store.UnusedBatchCover(ctx, f.BatchID); err == nil && cover != nil {
|
||||
_ = os.Remove(s.stagingAbs(*cover))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user