Note that there are some explanatory texts on larger screens.

plurals
  1. POJAudioTagger Deleting First Few Seconds of Track
    primarykey
    data
    text
    <p>I've written a simple Groovy script (below) to set the values of four of the ID3v1 and ID3v2 tag fields in mp3 files using the JAudioTagger library. The script successfully makes the changes but it also deletes the first 5 to 10 seconds of some of the files, other files are unaffected. It's not a big problem, but if anyone knows a simple fix, I would be grateful. All the files are from the same source, all have v1 and v2 tags, I can find no obvious difference in the source files to explain it.</p> <pre><code>import org.jaudiotagger.* java.util.logging.Logger.getLogger("org.jaudiotagger").setLevel(java.util.logging.Level.OFF) Integer trackNum = 0 Integer totalFiles = 0 Integer invalidFiles = 0 validMP3File = true def dir = new File(/D:\Users\Jeremy\Music\Speech Radio\Unlistened\Z Temp Files to MP3 Tagged/) dir.eachFile({curFile -&gt; totalFiles ++ try { mp3File = org.jaudiotagger.audio.AudioFileIO.read(curFile) } catch (org.jaudiotagger.audio.exceptions.CannotReadException e) { validMP3File = false invalidFiles ++ } // Get the file name excluding the extension baseFilename = org.jaudiotagger.audio.AudioFile.getBaseFilename(curFile) // Check that it is an MP3 file if (validMP3File) { if (mp3File.getAudioHeader().getEncodingType() != 'mp3') { validMP3File = false invalidFiles ++ } } if (validMP3File) { trackNum ++ if (mp3File.hasID3v1Tag()) { curTagv1 = mp3File.getID3v1Tag() } else { curTagv1 = new org.jaudiotagger.tag.id3.ID3v1Tag() } if (mp3File.hasID3v2Tag()) { curTagv2 = mp3File.getID3v2TagAsv24() } else { curTagv2 = new org.jaudiotagger.tag.id3.ID3v23Tag() } curTagv1.setField(org.jaudiotagger.tag.FieldKey.TITLE, baseFilename) curTagv2.setField(org.jaudiotagger.tag.FieldKey.TITLE, baseFilename) curTagv1.setField(org.jaudiotagger.tag.FieldKey.ARTIST, "BBC Radio") curTagv2.setField(org.jaudiotagger.tag.FieldKey.ARTIST, "BBC Radio") curTagv1.setField(org.jaudiotagger.tag.FieldKey.ALBUM, "BBC Radio - 20130205") curTagv2.setField(org.jaudiotagger.tag.FieldKey.ALBUM, "BBC Radio - 20130205") curTagv1.setField(org.jaudiotagger.tag.FieldKey.TRACK, trackNum.toString()) curTagv2.setField(org.jaudiotagger.tag.FieldKey.TRACK, trackNum.toString()) mp3File.setID3v1Tag(curTagv1) mp3File.setID3v2Tag(curTagv2) mp3File.save() } }) println """$trackNum tracks created from $totalFiles files with $invalidFiles invalid files""" </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload