com.lightdev.lib.audio
Class MP3PlaylistItem


java.lang.Object

  extended by com.lightdev.lib.audio.PlaylistItem

      extended by com.lightdev.lib.audio.MP3PlaylistItem

All Implemented Interfaces:
Serializable

public class MP3PlaylistItem
extends PlaylistItem
implements Serializable

Class MP3PlaylistItem models a playlist item built from an MP3 audio file

Version:
1, May 15, 2004
Author:
Ulrich Hilger, Light Development, http://www.lightdev.com, info@lightdev.com, published under the terms and conditions of the GNU General Public License, for details see file 'license.txt' in the distribution package of this software as well as any licensing notes inside this documentation
See Also:
Serialized Form

Field Summary
static char BLANK
          constant used to assemble string representation of item
static char BRACKET_CLOSE
          constant used to assemble string representation of item
static char BRACKET_OPEN
          constant used to assemble string representation of item
static char DASH
          constant used to assemble string representation of item
 
Fields inherited from class com.lightdev.lib.audio.PlaylistItem
audioFile, playing
 
Constructor Summary
MP3PlaylistItem(File audioFile)
          constructor
MP3PlaylistItem(String pathname)
          constructor
 
Method Summary
 String getAlbum()
          get the album name
 String getArtist()
          get the artist of this item
 Map getAudioProperties(File file)
          get the properties of a given audio file Example
properties: {mp3.frequency.hz=44100, title=All Cried Out, mp3.length.bytes=6301706, comment=, mp3.channels=2, date=1984, mp3.version.layer=3, mp3.framesize.bytes=414, mp3.id3tag.track=6, mp3.version.mpeg=1, mp3.bitrate.nominal.bps=128000, mp3.vbr.scale=0, bitrate=128000, mp3.length.frames=15112, mp3.crc=false, mp3.vbr=false, album=Alf, mp3.framerate.fps=38.28125, mp3.copyright=false, mp3.id3tag.v2=java.io.ByteArrayInputStream@7efa96, mp3.version.encoding=MPEG1L3, year=1984, mp3.id3tag.genre=Rock, mp3.header.pos=136, mp3.mode=0, mp3.original=true, vbr=false, mp3.padding=true, duration=394762000, author=Alison Moyet}
 long getByteSize()
          get the size of this item in bytes
 long getDuration()
          get the duration of this item
 String getTitle()
          get the title of this item
 String toString()
          build a string representation of this MP3PlaylistItem This method preferably takes the information from the id3 tag typically contained in an mp3 file.
 
Methods inherited from class com.lightdev.lib.audio.PlaylistItem
getAudioFile, getPlayingIndicator, setPlayingIndicator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BLANK


public static final char BLANK
constant used to assemble string representation of item

See Also:
Constant Field Values

DASH


public static final char DASH
constant used to assemble string representation of item

See Also:
Constant Field Values

BRACKET_OPEN


public static final char BRACKET_OPEN
constant used to assemble string representation of item

See Also:
Constant Field Values

BRACKET_CLOSE


public static final char BRACKET_CLOSE
constant used to assemble string representation of item

See Also:
Constant Field Values
Constructor Detail

MP3PlaylistItem


public MP3PlaylistItem(File audioFile)

                throws UnsupportedAudioFileException,

                       IOException
constructor

Parameters:
audioFile - File the audio file this MP3PlaylistItem represents
Throws:
UnsupportedAudioFileException
IOException

MP3PlaylistItem


public MP3PlaylistItem(String pathname)

                throws UnsupportedAudioFileException,

                       IOException
constructor

Parameters:
pathname - String the path and name of the audio file this MP3PlaylistItem represents
Throws:
UnsupportedAudioFileException
IOException
Method Detail

toString


public String toString()
build a string representation of this MP3PlaylistItem

This method preferably takes the information from the id3 tag typically contained in an mp3 file. If id3 tag information can not be found, the name of the mp3 file is used

Overrides:
toString in class Object
Returns:
String the String representation of this MP3PlaylistItem

getDuration


public long getDuration()
get the duration of this item

Returns:
long the duration in milliseconds

getTitle


public String getTitle()
get the title of this item

Returns:
String the title

getAlbum


public String getAlbum()
get the album name

Returns:
String the album name

getArtist


public String getArtist()
get the artist of this item

Returns:
String the artist

getByteSize


public long getByteSize()
get the size of this item in bytes

Returns:
long the byte size

getAudioProperties


public Map getAudioProperties(File file)

                       throws UnsupportedAudioFileException,

                              IOException
get the properties of a given audio file

Example

 properties: {mp3.frequency.hz=44100, title=All Cried Out, mp3.length.bytes=6301706,
 comment=, mp3.channels=2, date=1984, mp3.version.layer=3, mp3.framesize.bytes=414,
 mp3.id3tag.track=6, mp3.version.mpeg=1, mp3.bitrate.nominal.bps=128000,
 mp3.vbr.scale=0, bitrate=128000, mp3.length.frames=15112, mp3.crc=false,
 mp3.vbr=false, album=Alf, mp3.framerate.fps=38.28125, mp3.copyright=false,
 mp3.id3tag.v2=java.io.ByteArrayInputStream@7efa96, mp3.version.encoding=MPEG1L3,
 year=1984, mp3.id3tag.genre=Rock, mp3.header.pos=136, mp3.mode=0,
 mp3.original=true, vbr=false, mp3.padding=true, duration=394762000, author=Alison Moyet}
 

Parameters:
file - File the file to get the parameters for
Returns:
Map the paramter map
Throws:
UnsupportedAudioFileException
IOException

Copyright (c) 2004, 2005 Ulrich Hilger