76e426c5d3
- 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
21 lines
433 B
Go
21 lines
433 B
Go
package musicfs
|
|
|
|
import (
|
|
"path/filepath"
|
|
"strings"
|
|
|
|
"github.com/rs/zerolog/log"
|
|
)
|
|
|
|
func DeriveSubdir(originRoot, contentPath string) string {
|
|
rel, err := filepath.Rel(originRoot, contentPath)
|
|
if err != nil || strings.HasPrefix(rel, "..") {
|
|
log.Warn().
|
|
Str("origin_root", originRoot).
|
|
Str("content_path", contentPath).
|
|
Msg("content path outside origin root, falling back to full rescan")
|
|
return ""
|
|
}
|
|
return rel
|
|
}
|