package org.farng.mp3.id3; import java.io.IOException; import java.io.RandomAccessFile; import org.farng.mp3.InvalidTagException; import org.farng.mp3.object.ObjectNumberFixedLength; import org.farng.mp3.object.ObjectNumberVariableLength; import org.farng.mp3.object.ObjectStringNullTerminated; /** * <h3>4.17.   Popularimeter</h3> * <p/> * <p>   The purpose of this frame is to specify how good an audio file is.<br>    Many interesting * applications could be found to this frame such as a<br>    playlist that features better audio files more * often than others or<br> * <p/> *    it could be used to profile a person's taste and find other 'good'<br>    files by comparing * people's profiles. The frame contains the email<br>    address to the user, one rating byte and a four byte * play counter,<br>    intended to be increased with one for every time the file is played.<br>    * The email is a terminated string. The rating is 1-255 where 1 is<br> * <p/> *    worst and 255 is best. 0 is unknown. If no personal counter is wanted<br>    it may be * omitted. When the counter reaches all one's, one byte is<br>    inserted in front of the counter thus * making the counter eight bits<br>    bigger in the same away as the play counter ("PCNT"). There * may be<br> * <p/> *    more than one "POPM" frame in each tag, but only one with the same<br>    email * address.</p> * <p/> * <p>     <Header for 'Popularimeter', ID: "POPM"><br>      * Email to user   <text string> $00<br> * <p/> *      Rating          $xx<br> *      Counter         $xx xx xx xx (xx ...)<br> </p> * * @author Eric Farng * @version $Revision: 2374 $ */ public class FrameBodyPOPM extends AbstractID3v2FrameBody { /** * Creates a new FrameBodyPOPM object. */ public FrameBodyPOPM() { super(); } /** * Creates a new FrameBodyPOPM object. */ public FrameBodyPOPM(final FrameBodyPOPM body) { super(body); } /** * Creates a new FrameBodyPOPM object. */ public FrameBodyPOPM(final String emailToUser, final byte rating, final long counter) { setObject("Email to User", emailToUser); setObject("Rating", new Byte(rating)); setObject("Counter", new Long(counter)); } /** * Creates a new FrameBodyPOPM object. */ public FrameBodyPOPM(final RandomAccessFile file) throws IOException, InvalidTagException { this.read(file); } public void setEmailToUser(final String description) { setObject("Email to User", description); } public String getEmailToUser() { return (String) getObject("Email to User"); } public String getIdentifier() { return "POPM" + ((char) 0) + getEmailToUser(); } protected void setupObjectList() { appendToObjectList(new ObjectStringNullTerminated("Email to User")); appendToObjectList(new ObjectNumberFixedLength("Rating", 1)); appendToObjectList(new ObjectNumberVariableLength("Counter", 1)); } }