Files
music-agregator/internal/musicfs/client.go
T
Alexander 76e426c5d3 feat: integrate musicfs for post-download metadata enrichment
- Add internal/musicfs package: gRPC client, TriggerRescan (stream consumer), EnrichFiles (BatchUpdateMetadata), DeriveSubdir helper
- Add MusicFS config section (enabled, endpoint, origin_id, origin_root, timeout)
- Wire MusicFSClient into PollDownloadWorker: on download completion, trigger scoped rescan then push enriched metadata
- Fix album auto-persist in monitor workflow: persist artist+album from metadata-agregator before saving torrent/download
- Add filterByActiveSeeders: skip torrents where magnet resolution found 0 real active seeders
- Add musicfs proto to buf.gen.yaml inputs
- Enricher only sends non-empty fields to avoid overwriting existing file tag data with empty values
2026-05-17 23:32:44 +02:00

33 lines
778 B
Go

package musicfs
import (
"fmt"
"github.com/rs/zerolog/log"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
pb "homelab.lan/music-agregator/gen/musicfs/v1"
)
type Client struct {
MusicFS pb.MusicFSClient
Metadata pb.MetadataServiceClient
}
func NewClient(endpoint string) (*Client, *grpc.ClientConn, error) {
log.Trace().Str("endpoint", endpoint).Msg("connecting to musicfs")
conn, err := grpc.NewClient(endpoint, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
return nil, nil, fmt.Errorf("connecting to musicfs: %w", err)
}
log.Info().Str("endpoint", endpoint).Msg("musicfs connected")
return &Client{
MusicFS: pb.NewMusicFSClient(conn),
Metadata: pb.NewMetadataServiceClient(conn),
}, conn, nil
}