Exemplo n.º 1
0
func GetMp3Data(filename string) (Mp3Song, error) {
	mp3File, err := tagg.Read(filename)
	if err != nil {
		fmt.Println("Open: unable to open file: ", err)
		return Mp3Song{}, err
	}
	defer mp3File.Close()

	return Mp3Song{
		Filename: filename,
		Artist:   mp3File.Artist(),
		Title:    mp3File.Title(),
		Genre:    mp3File.Genre(),
		Size:     0,
	}, nil
}
Exemplo n.º 2
0
func GetMp3Data(filename string) (Mp3Song, error) {
	mp3File, err := tag.Read(filename)
	if err != nil {
		fmt.Println("Open: unable to open file: ", err)
		return Mp3Song{}, err
	}
	defer mp3File.Close()

	//fmt.Printf("f: %s, artist: %s, title: %s\n",
	//	filename, mp3File.Artist(), mp3File.Title())
	//  fmt.Printf("file: %s, bitrate: %v\n",
	//			 filename, mp3File.Bitrate())

	return Mp3Song{
		Filename: filename,
		Artist:   mp3File.Artist(),
		Title:    mp3File.Title(),
		Genre:    mp3File.Genre(),
		Bitrate:  mp3File.Bitrate(),
		Size:     0,
	}, nil
}