- Version:
- 4.0 AZ - some modifications 2009
- Author:
- Emil A. Lefkof III
|
Constructor Summary |
MusicTag(File aFile)
Constructor that takes the music file. |
NO_TAG
public static final String NO_TAG
- See Also:
- Constant Field Values
CURRENT_YEAR
public static final String CURRENT_YEAR
- AZ - if no year is specified in tags then use year 9999 instead of current
year public static final String CURRENT_YEAR = currentYear();
- See Also:
- Constant Field Values
DEFAULT_FILE_FORMAT
public static final String DEFAULT_FILE_FORMAT
- See Also:
- Constant Field Values
file
protected File file
bitRate
protected Long bitRate
trackLength
protected long trackLength
header
protected Map header
artist
protected String artist
comment
protected String comment
disc
protected String disc
encodedBy
protected String encodedBy
genre
protected String genre
title
protected String title
track
protected String track
year
protected String year
settings
public static Settings settings
- EAL
MusicTag
public MusicTag(File aFile)
throws MusicTagException
- Constructor that takes the music file.
- Parameters:
aFile - the music file
- Throws:
MusicTagException - if any error occurs opening tag
setSettings
public static void setSettings(Settings aSettings)
- EAL
getArtist
public abstract String getArtist()
- Gets the artist.
- Specified by:
getArtist in interface ITag
- Returns:
- Returns the artist.
getBitRate
public abstract Long getBitRate()
- Gets the bitRate.
- Specified by:
getBitRate in interface ITag
- Returns:
- Returns the bitRate.
getComment
public abstract String getComment()
- Gets the comment.
- Specified by:
getComment in interface ITag
- Returns:
- Returns the comment.
getCopyrighted
public abstract String getCopyrighted()
- Specified by:
getCopyrighted in interface ITag
getDisc
public abstract String getDisc()
- Gets the disc.
- Specified by:
getDisc in interface ITag
- Returns:
- Returns the disc.
getEmphasis
public abstract String getEmphasis()
- Specified by:
getEmphasis in interface ITag
getEncodedBy
public abstract String getEncodedBy()
- Gets the encodedBy.
- Specified by:
getEncodedBy in interface ITag
- Returns:
- Returns the encodedBy.
getFrequency
public abstract String getFrequency()
- Specified by:
getFrequency in interface ITag
getGenre
public abstract String getGenre()
- Gets the genre.
- Specified by:
getGenre in interface ITag
- Returns:
- Returns the genre.
getHeader
public abstract Map getHeader()
- Gets the header.
- Specified by:
getHeader in interface ITag
- Returns:
- Returns the header.
getLayer
public abstract String getLayer()
- Specified by:
getLayer in interface ITag
getMode
public abstract String getMode()
- Specified by:
getMode in interface ITag
getTitle
public abstract String getTitle()
- Gets the title.
- Specified by:
getTitle in interface ITag
- Returns:
- Returns the title.
getTrack
public abstract String getTrack()
- Gets the track.
- Specified by:
getTrack in interface ITag
- Returns:
- Returns the track.
getTrackLength
public abstract long getTrackLength()
- Gets the trackLength.
- Specified by:
getTrackLength in interface ITag
- Returns:
- Returns the trackLength.
getVersion
public abstract String getVersion()
- Specified by:
getVersion in interface ITag
getYear
public abstract String getYear()
- Gets the year.
- Specified by:
getYear in interface ITag
- Returns:
- Returns the year.
setArtist
public abstract void setArtist(String aArtist)
- Sets the artist.
- Specified by:
setArtist in interface ITag
- Parameters:
aArtist - The artist to set.
setComment
public abstract void setComment(String aComment)
- Sets the comment.
- Specified by:
setComment in interface ITag
- Parameters:
aComment - The comment to set.
setDisc
public abstract void setDisc(String aDisc)
- Sets the disc.
- Specified by:
setDisc in interface ITag
- Parameters:
aDisc - The disc to set.
setEncodedBy
public abstract void setEncodedBy(String aEncodedBy)
- Sets the encodedBy.
- Specified by:
setEncodedBy in interface ITag
- Parameters:
aEncodedBy - The encodedBy to set.
setGenre
public abstract void setGenre(String aGenre)
- Sets the genre.
- Specified by:
setGenre in interface ITag
- Parameters:
aGenre - The genre to set.
setTitle
public abstract void setTitle(String aTitle)
- Sets the title.
- Specified by:
setTitle in interface ITag
- Parameters:
aTitle - The title to set.
setTrack
public abstract void setTrack(String aTrack)
- Sets the track.
- Specified by:
setTrack in interface ITag
- Parameters:
aTrack - The track to set.
setTrack
public abstract void setTrack(String track,
int padding)
- Sets the track.
- Specified by:
setTrack in interface ITag
- Parameters:
aTrack - The track to set.padding - the number of 0's to pad
setTrackLength
public abstract void setTrackLength(long aTrackLength)
- Sets the trackLength.
- Parameters:
aTrackLength - The trackLength to set.
setYear
public abstract void setYear(String aYear)
- Sets the year.
- Specified by:
setYear in interface ITag
- Parameters:
aYear - The year to set.
isVBR
public abstract boolean isVBR()
- Specified by:
isVBR in interface ITag
removeTags
public abstract void removeTags()
throws MusicTagException
- Removes tags from the audio file.
- Throws:
MusicTagException - if any error occurs removing the tag
renameFile
public abstract boolean renameFile(String aFormat)
- Renames this Music file based on a format from prefs. The format is in
aFormat and can have values %n for track number, %t for title, %a for
artist, and %d for disc. Replaces any invalid characters (\\, /, :, , *,
?, ", <, >, or |) with underscores _ to prevent any errors on file
systems. Examples: %n -%t = 01 - Track.mp3 %a - %d - %n - %t = Artist -
Album - 01 - Track.mp3
- Parameters:
aFormat - the string format like %n -%t to rename 01 - Track.mp3
- Returns:
- true if renamed, false if failure
save
public abstract void save()
throws MusicTagException
- Saves the tag back to the file.
- Throws:
MusicTagException - if any error occurs saving the file
getGenreTypes
public static List getGenreTypes()
- Gets the genre list.
- Returns:
- Returns the genre list
getStandardGenreType
public static String getStandardGenreType(int genreNumber)
- AZ Gets genre description from the standard genre list.
- Returns:
- Returns the genre string
getAbsolutePath
public String getAbsolutePath()
- Gets the absolute file path.
- Returns:
- Returns the absolute file path
getBitRateAsString
public String getBitRateAsString()
- Returns the bit rate as a string.
- Returns:
- the bitrate value as a string decoded with VBR
getFile
public File getFile()
- Gets the file.
- Specified by:
getFile in interface ITag
- Returns:
- Returns the file.
getHeaderInfo
public String getHeaderInfo()
- Returns the info about the audio file.
- Returns:
- string containing the info about the MP3 file
getHeaderValue
public String getHeaderValue(String aKey)
- Returns the info about the audio file.
- Returns:
- string containing the info about the MP3 file
getTrackLengthAsString
public String getTrackLengthAsString()
- Gets the track length in seconds.
- Returns:
- Returns the track length in seconds.
equals
public boolean equals(Object obj)
- Default Equals method.
- Overrides:
equals in class Object
extractTitleFromFilename
public String extractTitleFromFilename()
- Tries to extract the title of the song from the filename.
EXAMPLES: 06 - Opiate.mp3 = Opiate Tool - Aenima - 06 - Opiate.mp3 =
Opiate 02 - Positively 4th Street.mp3 = Positively 4th Street 11 - Nothing
Compares 2 U.mp3 = Nothing Compares 2 U
- Returns:
- the title extracted from the filename
fileExists
public boolean fileExists()
- If the file exists or not.
- Returns:
- Returns the file exists flag
hashCode
public int hashCode()
- Default hashcode method.
- Overrides:
hashCode in class Object
renameFile
public boolean renameFile()
- Renames this Music file based on the default format of %n - %t.mp3 so it
looks like 01 - Track.mp3.
- Returns:
- true if renamed, false if failure
synchronize
public void synchronize()
- Synchronizes the tag to have the same data in the V1 and V2 tag.
compareTo
public int compareTo(Object o)
- CompareTo method for sorting tracks.
- Specified by:
compareTo in interface Comparable
toString
public String toString()
- Default toString() method.
- Overrides:
toString in class Object
createFilenameFromFormat
protected String createFilenameFromFormat(String aFormat)
- Creates a new filename based on the format passed in.
- Parameters:
aFormat - the file format like %n -%t = 01 - Track.mp3
- Returns:
- the new file name
Copyright © 1999-2010 Melloware Inc. All Rights Reserved.