예제 #1
0
func loadMp3(t *T, filename string, bufferLength int) (*mp3agic.File, os.Error) {
	// TODO: buffer the file
	rawfile, err := os.Open(RES_DIR+filename, os.O_RDONLY, 0)
	if err != nil {
		t.Fatal(err)
		return nil, err
	}
	defer rawfile.Close()

	file, err := mp3agic.ParseFile(rawfile, bufferLength)
	return file, err
}
예제 #2
0
파일: mp3cat.go 프로젝트: akavel/splitsound
func main() {
	if len(os.Args) < 2 {
		//TODO: port original usage()
		fmt.Printf("Usage: %v <FILE.mp3>\n", os.Args[0])
		return
	}

	exitcode := int(0)
	defer func() {
		os.Exit(exitcode)
	}()
	error := func(code int, err os.Error) {
		fmt.Fprintf(os.Stderr, "error: %v\n", err)
		exitcode = code
	}

	// TODO: buffer the file
	file, err := os.Open(os.Args[1], os.O_RDONLY, 0)
	if err != nil {
		error(1, err)
		return
		//fmt.Fprintf(os.Stderr, "error: %v\n", err)
		//os.Exit(1)
	}
	defer file.Close()

	// TODO: iterate args with wildcards expansion
	mp3file, err = mp3agic.ParseFile(file, 0)
	if err != nil {
		error(2, err)
		return
	}
	dumpMp3Fields()
	dumpId3Fields()
	dumpCustomTag()
}