Add album/track releases with audio analysis, AnalyzeAlbumRelease RPC, Docker path auto-resolution, release parsing decision tree

This commit is contained in:
Alexander
2026-05-09 23:16:59 +02:00
parent 1e8506f146
commit 2740585261
25 changed files with 1841 additions and 125 deletions
+17 -9
View File
@@ -81,11 +81,12 @@ func (m *mockMetadataClient) SyncArtist(ctx context.Context, in *metadataPb.Sync
}
type mockTorrentClient struct {
LoginFunc func(username, password string) (string, error)
ListFunc func() ([]torrent.TorrentInfo, error)
FindFunc func(opts torrent.FindOptions) ([]torrent.TorrentInfo, error)
AddTorrentFunc func(file torrent.TorrentFile) error
AddMagnetFunc func(magnetURI string) error
LoginFunc func(username, password string) (string, error)
ListFunc func() ([]torrent.TorrentInfo, error)
FindFunc func(opts torrent.FindOptions) ([]torrent.TorrentInfo, error)
AddTorrentFunc func(file torrent.TorrentFile, savePath string) error
AddMagnetFunc func(magnetURI string, savePath string) error
DefaultSavePathFunc func() (string, error)
}
func (m *mockTorrentClient) Login(username, password string) (string, error) {
@@ -109,20 +110,27 @@ func (m *mockTorrentClient) Find(opts torrent.FindOptions) ([]torrent.TorrentInf
return nil, fmt.Errorf("not mocked")
}
func (m *mockTorrentClient) AddTorrent(file torrent.TorrentFile) error {
func (m *mockTorrentClient) AddTorrent(file torrent.TorrentFile, savePath string) error {
if m.AddTorrentFunc != nil {
return m.AddTorrentFunc(file)
return m.AddTorrentFunc(file, savePath)
}
return fmt.Errorf("not mocked")
}
func (m *mockTorrentClient) AddMagnet(magnetURI string) error {
func (m *mockTorrentClient) AddMagnet(magnetURI string, savePath string) error {
if m.AddMagnetFunc != nil {
return m.AddMagnetFunc(magnetURI)
return m.AddMagnetFunc(magnetURI, savePath)
}
return fmt.Errorf("not mocked")
}
func (m *mockTorrentClient) DefaultSavePath() (string, error) {
if m.DefaultSavePathFunc != nil {
return m.DefaultSavePathFunc()
}
return "/downloads", nil
}
type mockSearcher struct {
SearchFunc func(query string, limit int32, indexer string) (*indexer.SearchResponse, error)
}
+4 -4
View File
@@ -46,7 +46,7 @@ func TestMonitorAlbum_HappyPath(t *testing.T) {
return []torrent.TorrentInfo{}, nil
}
suite.mocks.torrent.AddMagnetFunc = func(magnetURI string) error {
suite.mocks.torrent.AddMagnetFunc = func(magnetURI string, savePath string) error {
return nil
}
@@ -181,7 +181,7 @@ func TestMonitorAlbum_ArtistPersistFails(t *testing.T) {
return []torrent.TorrentInfo{}, nil
}
suite.mocks.torrent.AddMagnetFunc = func(magnetURI string) error {
suite.mocks.torrent.AddMagnetFunc = func(magnetURI string, savePath string) error {
return nil
}
@@ -460,7 +460,7 @@ func TestMonitorAlbum_QBitDown(t *testing.T) {
return nil, assert.AnError
}
suite.mocks.torrent.AddMagnetFunc = func(magnetURI string) error {
suite.mocks.torrent.AddMagnetFunc = func(magnetURI string, savePath string) error {
return assert.AnError
}
@@ -589,7 +589,7 @@ func TestMonitorAlbum_AddMagnetFails(t *testing.T) {
return []torrent.TorrentInfo{}, nil
}
suite.mocks.torrent.AddMagnetFunc = func(magnetURI string) error {
suite.mocks.torrent.AddMagnetFunc = func(magnetURI string, savePath string) error {
return assert.AnError
}
+1
View File
@@ -98,6 +98,7 @@ func setupSuite(t *testing.T) *testSuite {
mocks.torrent,
mocks.magnet,
nil,
nil,
db,
)