コード例 #1
0
// Get the new folder name
func getNewFolderName(m tag.Metadata) (string, error) {
	artist := m.AlbumArtist()

	if artist == "" {
		artist = m.Artist()
	}

	year := strconv.Itoa(m.Year())
	album := m.Album()

	if len(artist) == 0 {
		return "", errors.New("Artist not found")
	}

	if year == "0" {
		return "", errors.New("Year not found")
	}

	if len(album) == 0 {
		return "", errors.New("Album not found")
	}

	folder := artist + " - " + year + " - " + album

	return folder, nil
}
コード例 #2
0
ファイル: tag.go プロジェクト: herotl2005/tag
func printMetadata(m tag.Metadata) {
	fmt.Printf("Metadata Format: %v\n", m.Format())
	fmt.Printf("File Type: %v\n", m.FileType())

	fmt.Printf(" Title: %v\n", m.Title())
	fmt.Printf(" Album: %v\n", m.Album())
	fmt.Printf(" Artist: %v\n", m.Artist())
	fmt.Printf(" Composer: %v\n", m.Composer())
	fmt.Printf(" Genre: %v\n", m.Genre())
	fmt.Printf(" Year: %v\n", m.Year())

	track, trackCount := m.Track()
	fmt.Printf(" Track: %v of %v\n", track, trackCount)

	disc, discCount := m.Disc()
	fmt.Printf(" Disc: %v of %v\n", disc, discCount)

	fmt.Printf(" Picture: %v\n", m.Picture())
	fmt.Printf(" Lyrics: %v\n", m.Lyrics())
}