Logo Search packages:      
Sourcecode: jampal version File versions  Download package

String pgbennett::id3::MP3File::getGenre (  ) throws ID3v2FormatException [inline]

Returns the genre of this mp3 if set and the empty string if not.

the genre of this mp3
ID3v2FormatExceptionif the data of this field is incorrect

Definition at line 905 of file MP3File.java.

References allow(), pgbennett::id3::ID3v2Frames::CONTENT_TYPE, pgbennett::id3::ID3v2Tag::getFrameDataString(), pgbennett::id3::NullsoftID3GenreTable::getGenre(), pgbennett::id3::ID3v1Tag::getGenreString(), id3v1, ID3V1, id3v2, and ID3V2.

        String str = new String();
        if (allow(ID3V2)) {
            str = id3v2.getFrameDataString(ID3v2Frames.CONTENT_TYPE);
            // Feb 2004 Peter Bennett
            // Cater for genre of the form (nnn)
            // where nnn is an id3 genre number
            if (str.startsWith("(") && str.endsWith(")") && str.length() <=5) {
                try {
                    int i=Integer.parseInt(str.substring(1,str.length()-1));
                    if (i<=255)
                catch (NumberFormatException ex) {
        if (allow(ID3V1) && str.length()==0) {
            str = id3v1.getGenreString();
        return str;

Here is the call graph for this function:

Generated by  Doxygen 1.6.0   Back to index