MP3FileInfo.cpp
void MP3FileInfo::m_parseGenre(void)
{
	if(bHasV2Tag) // Use V2 if present
	{
		szGenre = m_getNewString(ID3FID_CONTENTTYPE);
		return;
	}

	char buf[12];
	if(!m_getString(ID3FID_CONTENTTYPE, buf))
	{
		szGenre = 0;
		return;
	}

	CString temp = "";
	
	try	{ temp = buf; }
	catch(int e) {	}
	
	if(temp.Compare("[Not Found]") != 0)
	{
		int gid;
		sscanf(buf, "(%i)", &gid); // filter Genre ID

		if(gid >= ID3_NR_OF_V1_GENRES) // genre ID too large
		{
			szGenre = new char[strlen(buf)+1];
			sprintf(szGenre, buf);
			return;
		}

		szGenre = new char[strlen(ID3_V1GENRE2DESCRIPTION(gid))+1];
		sprintf(szGenre, ID3_V1GENRE2DESCRIPTION(gid));
	}
	else
		szGenre = 0;
}
/**
\brief   parses the genre of the file

In ID3V1 Tags, the genre is a simple byte and needs to be
converted to a string first, but ID3V2 allows arbitrary
genre descriptions.
**/
\brief   parses the genre of the file
In ID3V1 Tags, the genre is a simple byte and needs to be
converted to a string first, but ID3V2 allows arbitrary
genre descriptions.
\ brief parses the genre of the file In ID3V1 Tags the genre is a simple byte and needs to be converted to a string first but ID3V2 allows arbitrary genre descriptions .
void MP3FileInfo::m_parseGenre(void)
{
	if(bHasV2Tag) 
	{
		szGenre = m_getNewString(ID3FID_CONTENTTYPE);
		return;
	}
	char buf[12];
	if(!m_getString(ID3FID_CONTENTTYPE, buf))
	{
		szGenre = 0;
		return;
	}
	CString temp = "";
	try	{ temp = buf; }
	catch(int e) {	}
	if(temp.Compare("[Not Found]") != 0)
	{
		int gid;
		sscanf(buf, "(%i)", &gid); 
		if(gid >= ID3_NR_OF_V1_GENRES) 
		{
			szGenre = new char[strlen(buf)+1];
			sprintf(szGenre, buf);
			return;
		}
		szGenre = new char[strlen(ID3_V1GENRE2DESCRIPTION(gid))+1];
		sprintf(szGenre, ID3_V1GENRE2DESCRIPTION(gid));
	}
	else
		szGenre = 0;
}
void MP3FileInfo :: m_parseGenre ( void ) { if ( bHasV2Tag ) { szGenre = m_getNewString ( ID3FID_CONTENTTYPE ) ; return ; } char buf [ 12 ] ; if ( ! m_getString ( ID3FID_CONTENTTYPE , buf ) ) { szGenre = 0 ; return ; } CString temp = " " ; try { temp = buf ; } catch ( int e ) { } if ( temp . Compare ( " " ) != 0 ) { int gid ; sscanf ( buf , " " , & gid ) ; if ( gid >= ID3_NR_OF_V1_GENRES ) { szGenre = new char [ strlen ( buf ) + 1 ] ; sprintf ( szGenre , buf ) ; return ; } szGenre = new char [ strlen ( ID3_V1GENRE2DESCRIPTION ( gid ) ) + 1 ] ; sprintf ( szGenre , ID3_V1GENRE2DESCRIPTION ( gid ) ) ; } else szGenre = 0 ; }
\brief   parses the genre of the file
In ID3V1 Tags, the genre is a simple byte and needs to be
converted to a string first, but ID3V2 allows arbitrary
genre descriptions.
\ brief parses the genre of the file In ID3V1 Tags the genre is a simple byte and needs to be converted to a string first but ID3V2 allows arbitrary genre descriptions .
// Use V2 if present // filter Genre ID // genre ID too large