//HACK: Need to have padding at the end of the tag, or Winamp won't see the last frame (at least 6 bytes seem to be required).
private void tag()
        throws Exception
    {
        String[] asFilename = (String[])m_oCmdLineMap.get("filenames");
        for (int i=0; i < asFilename.length; i++)
        {
            File oSourceFile = new File(asFilename[i]);
            MP3File oMP3File = new MP3File(oSourceFile);
            if (m_oCmdLineMap.containsKey("1"))
            {
                ID3V1_1Tag oID3V1_1Tag = new ID3V1_1Tag();
                if (m_oCmdLineMap.containsKey("album"))
                {
                    oID3V1_1Tag.setAlbum((String)m_oCmdLineMap.get("album"));
                }
                if (m_oCmdLineMap.containsKey("artist"))
                {
                    oID3V1_1Tag.setArtist((String)m_oCmdLineMap.get("artist"));
                }
                if (m_oCmdLineMap.containsKey("comment"))
                {
                    oID3V1_1Tag.setComment((String)m_oCmdLineMap.get("comment"));
                }
                if (m_oCmdLineMap.containsKey("genre"))
                {
                    String sGenre = (String)m_oCmdLineMap.get("genre");
                    oID3V1_1Tag.setGenre(ID3V1Tag.Genre.lookupGenre(sGenre));
                }
                if (m_oCmdLineMap.containsKey("title"))
                {
                    oID3V1_1Tag.setTitle((String)m_oCmdLineMap.get("title"));
                }
                if (m_oCmdLineMap.containsKey("year"))
                {
                    oID3V1_1Tag.setYear(((Integer)m_oCmdLineMap.get("year")).toString());
                }
                if (m_oCmdLineMap.containsKey("track"))
                {
                    oID3V1_1Tag.setAlbumTrack(((Integer)m_oCmdLineMap.get("track")).intValue());
                }
                oMP3File.setID3Tag(oID3V1_1Tag);
            }
            if (m_oCmdLineMap.containsKey("2"))
            {
                ID3V2_3_0Tag oID3V2_3_0Tag = new ID3V2_3_0Tag();
                //HACK: Need to have padding at the end of the tag, or Winamp won't see the last frame (at least 6 bytes seem to be required).
                oID3V2_3_0Tag.setPaddingLength(16);
                if (m_oCmdLineMap.containsKey("album"))
                {
                    oID3V2_3_0Tag.setAlbum((String)m_oCmdLineMap.get("album"));
                }
                if (m_oCmdLineMap.containsKey("artist"))
                {
                    oID3V2_3_0Tag.setArtist((String)m_oCmdLineMap.get("artist"));
                }
                if (m_oCmdLineMap.containsKey("comment"))
                {
                    oID3V2_3_0Tag.setComment((String)m_oCmdLineMap.get("comment"));
                }
                if (m_oCmdLineMap.containsKey("genre"))
                {
                    oID3V2_3_0Tag.setGenre((String)m_oCmdLineMap.get("genre"));
                }
                oMP3File.setID3Tag(oID3V2_3_0Tag);
                if (m_oCmdLineMap.containsKey("title"))
                {
                    oID3V2_3_0Tag.setTitle((String)m_oCmdLineMap.get("title"));
                }
                if (m_oCmdLineMap.containsKey("year"))
                {
                    oID3V2_3_0Tag.setYear(((Integer)m_oCmdLineMap.get("year")).intValue());
                }
                if (m_oCmdLineMap.containsKey("track"))
                {
                    if (m_oCmdLineMap.containsKey("total"))
                    {
                        oID3V2_3_0Tag.setTrackNumber(((Integer)m_oCmdLineMap.get("track")).intValue(),
                                                     ((Integer)m_oCmdLineMap.get("total")).intValue());
                    }
                    else
                    {
                        oID3V2_3_0Tag.setTrackNumber(((Integer)m_oCmdLineMap.get("track")).intValue());
                    }
                }
            }
            oMP3File.sync();
        }
    }
{
ID3V2_3_0Tag oID3V2_3_0Tag = new ID3V2_3_0Tag();
//HACK: Need to have padding at the end of the tag, or Winamp won't see the last frame (at least 6 bytes seem to be required).
oID3V2_3_0Tag.setPaddingLength(16);
if (m_oCmdLineMap.containsKey("album"))
}
if (m_oCmdLineMap.containsKey("track"))
{
oID3V1_1Tag.setAlbumTrack(((Integer)m_oCmdLineMap.get("track")).intValue());
}
oMP3File.setID3Tag(oID3V1_1Tag);
}
if (m_oCmdLineMap.containsKey("2"))
{
ID3V2_3_0Tag oID3V2_3_0Tag = new ID3V2_3_0Tag();
//HACK: Need to have padding at the end of the tag, or Winamp won't see the last frame (at least 6 bytes seem to be required).
oID3V2_3_0Tag.setPaddingLength(16);
if (m_oCmdLineMap.containsKey("album"))
{
oID3V2_3_0Tag.setAlbum((String)m_oCmdLineMap.get("album"));
}
if (m_oCmdLineMap.containsKey("artist"))
{
oID3V2_3_0Tag.setArtist((String)m_oCmdLineMap.get("artist"));
}
if (m_oCmdLineMap.containsKey("comment"))
String sGenre = (String)m_oCmdLineMap.get("genre");
oID3V1_1Tag.setGenre(ID3V1Tag.Genre.lookupGenre(sGenre));
}
if (m_oCmdLineMap.containsKey("title"))
{
oID3V1_1Tag.setTitle((String)m_oCmdLineMap.get("title"));
}
if (m_oCmdLineMap.containsKey("year"))
{
oID3V1_1Tag.setYear(((Integer)m_oCmdLineMap.get("year")).toString());
}
if (m_oCmdLineMap.containsKey("track"))
{
oID3V1_1Tag.setAlbumTrack(((Integer)m_oCmdLineMap.get("track")).intValue());
}
oMP3File.setID3Tag(oID3V1_1Tag);
}
if (m_oCmdLineMap.containsKey("2"))
{
ID3V2_3_0Tag oID3V2_3_0Tag = new ID3V2_3_0Tag();
//HACK: Need to have padding at the end of the tag, or Winamp won't see the last frame (at least 6 bytes seem to be required).
oID3V2_3_0Tag.setPaddingLength(16);
if (m_oCmdLineMap.containsKey("album"))
{
oID3V2_3_0Tag.setAlbum((String)m_oCmdLineMap.get("album"));
}
if (m_oCmdLineMap.containsKey("artist"))
{
oID3V2_3_0Tag.setArtist((String)m_oCmdLineMap.get("artist"));
}
if (m_oCmdLineMap.containsKey("comment"))
{
oID3V2_3_0Tag.setComment((String)m_oCmdLineMap.get("comment"));
}
if (m_oCmdLineMap.containsKey("genre"))
{
oID3V2_3_0Tag.setGenre((String)m_oCmdLineMap.get("genre"));
}
oMP3File.setID3Tag(oID3V2_3_0Tag);
if (m_oCmdLineMap.containsKey("title"))
{