resource-scraper/pkg/handler/info.go

37 lines
863 B
Go

package handler
import (
"fmt"
"log"
"github.com/logrusorgru/aurora/v4"
"github.com/spf13/viper"
"github.com/mewkiz/flac"
"git.amok.space/yevhen/resource-scraper/types/constant"
)
func (h *Handler) Info() string {
md5()
fmt.Printf("%s: %s; %s: %s\n",
aurora.Cyan("ENV"),
viper.GetString(constant.FlagEnv), aurora.Cyan("SCOPE"), viper.GetString(constant.FlagScopeEnable))
return "info"
}
func md5() {
stream, err := flac.ParseFile("C:\\arm.amok.space\\.incoming\\Ancient Storm\\Forever and Never (2024)\\06 Old Mountain.flac")
if err != nil {
log.Fatal(err)
}
defer stream.Close()
fmt.Printf("unencoded audio md5sum: %032x\n", stream.Info.MD5sum[:])
fmt.Printf("Total number of inter-channel samples in the stream: %+v\n", stream.Info.NSamples)
for i, block := range stream.Blocks {
fmt.Printf("block %d: %v\n", i, block.Type)
}
}