Add album/track releases with audio analysis, AnalyzeAlbumRelease RPC, Docker path auto-resolution, release parsing decision tree
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package audio
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/mewkiz/flac"
|
||||
)
|
||||
|
||||
func analyzeFLAC(filePath string) (*TrackInfo, error) {
|
||||
stream, err := flac.ParseFile(filePath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("parsing FLAC: %w", err)
|
||||
}
|
||||
defer stream.Close()
|
||||
|
||||
info := stream.Info
|
||||
durationMs := int(info.NSamples * 1000 / uint64(info.SampleRate))
|
||||
|
||||
return &TrackInfo{
|
||||
Format: "FLAC",
|
||||
BitDepth: int(info.BitsPerSample),
|
||||
SampleRate: int(info.SampleRate),
|
||||
Channels: int(info.NChannels),
|
||||
DurationMs: durationMs,
|
||||
IsLossless: true,
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user