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();
        }
    }
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();
               
                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();
        }
    }
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(); 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(); } }