main.go 342 B

123456789101112131415161718
  1. package duration
  2. import (
  3. "os"
  4. "fmt"
  5. tag "github.com/dhowden/tag"
  6. )
  7. func GetSongDuration(file *os.File, tags tag.Metadata) (duration int, ok bool) {
  8. switch tags.Format() {
  9. case "VORBIS":
  10. return GetSongDurationVorbis(file.Name())
  11. default:
  12. fmt.Printf("Unrecognised format: %s\n", tags.Format())
  13. return 0, false
  14. }
  15. }