|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.cddb.CDDBXmcdParser
public class CDDBXmcdParser
CDDBXmcdParser provides methods to parse the file content from a CDDB/FreeDB raw file in xmcd format.
CDInfo,
Serialized Form| Field Summary | |
|---|---|
static String |
DEFAULT_COMMENT
used for generated Contribution comments or Artist descriptions |
| Constructor Summary | |
|---|---|
CDDBXmcdParser(CDInfo cdinfo)
|
|
CDDBXmcdParser(File file)
file must be in the CDDB/FreeDB file format |
|
CDDBXmcdParser(String fileContent)
fileContent must be derived from CDDB/FreeDB file format |
|
| Method Summary | |
|---|---|
String[] |
checkWarnings()
checks the xmcd file for completeness (this should return an empty array before the underlying content would be subject to a CDDB submission). |
static String |
createXmcdTemplate(CDID cd)
this static method provides a blank string template for an xmcd format entry based on the given cd |
static String |
createXmcdTemplateWithReplacer(CDID cd)
this static method provides a string template for an xmcd format entry based on the given cd containing easily replaceable entries |
Artist |
extractCDArtist()
returns the artist defined for the CD or null if none was found |
Composition |
extractComposition(boolean includeTracks)
creates a default Composition object from the embedded CDInfo that regards the entire CD as one composition and will contain certain Composition objects as far as applicable. |
Artist |
extractTrackArtist(int track)
returns the artist defined for the track or null if none was found |
Track[] |
extractTracks(boolean addArtist)
generates default Track objects that - if addArtist is true - contain applicable contributions |
String |
getContent()
return the content in xcmd format (used during construction) |
Properties |
getProperties()
returns a list of properties. |
protected String |
getTagText(String tag)
returns the text for the tag that could be found in multiple lines |
boolean |
isConsistenWith(CDID cd)
checks whether the given CD is consistent with the content |
protected String |
parseTag(String btag,
String etag,
int index)
returns the text between btag and etag after index; leading and tailing white space is removed |
String |
readArtist()
parses the title for the part before ' / ' which refers to the artist specified as <firstName lastName> by convention; null is returned if no artist separator could be found |
CDID |
readCDID()
parses for the offsets and returns a CDID object using the first discID found in the DISCID field |
String |
readCDTitle()
parses the title for the part after ' / ' which by convention refers to the CD title; if no title separator is found, the full title (same as readTitle()) is returned |
String[] |
readDiscIDs()
parses for possibly multiple discIDs to support searching for discIDs that link to the same file |
String |
readExtension()
parses for extended CD information |
String |
readGenre()
parses for the genre |
int |
readLength()
parses for the disc length and returns the seconds |
int |
readNumberOfTracks()
|
int[] |
readOffsets()
parses for the track offsets |
int[] |
readPlayOrder()
parses for the play order |
String |
readProcessedBy()
parses for the "Processed by" entry (an optional entry) |
int |
readRevision()
parses for the revision number of the entry |
String |
readSubmitter()
parses for the "Submitted via" entry |
String |
readTitle()
parses for the full title |
String |
readTitle(int track)
parses for the entire track title (including artist if available) |
String |
readTrackArtist(int track)
parses for the track artist (using first the track artist info, then the CD artist info) |
String |
readTrackExtension(int track)
parses for extended track info |
String |
readTrackTitle(int track)
parses for the track title (without artist info if applicable) |
int |
readYear()
parses for the year; returns 0 if no year was entered |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_COMMENT
| Constructor Detail |
|---|
public CDDBXmcdParser(File file)
throws IOException,
ParseException
IOException
ParseException
public CDDBXmcdParser(CDInfo cdinfo)
throws ParseException
ParseException
public CDDBXmcdParser(String fileContent)
throws ParseException
ParseException| Method Detail |
|---|
public String getContent()
public boolean isConsistenWith(CDID cd)
throws XmcdFormatException
XmcdFormatExceptionpublic static String createXmcdTemplate(CDID cd)
public static String createXmcdTemplateWithReplacer(CDID cd)
public String[] checkWarnings()
throws XmcdFormatException
XmcdFormatException
public CDID readCDID()
throws XmcdFormatException
XmcdFormatExceptionpublic int readNumberOfTracks()
public int[] readOffsets()
public int readLength()
throws XmcdFormatException
XmcdFormatException
public int readRevision()
throws XmcdFormatException
XmcdFormatException
public String readSubmitter()
throws XmcdFormatException
XmcdFormatException
public String readProcessedBy()
throws XmcdFormatException
XmcdFormatException
public String[] readDiscIDs()
throws XmcdFormatException
XmcdFormatException
public String readTitle()
throws XmcdFormatException
XmcdFormatException
public String readCDTitle()
throws XmcdFormatException
readTitle()) is returned
XmcdFormatException
public String readArtist()
throws XmcdFormatException
XmcdFormatException
public String readExtension()
throws XmcdFormatException
XmcdFormatException
public int readYear()
throws XmcdFormatException
XmcdFormatException
public String readGenre()
throws XmcdFormatException
XmcdFormatException
public String readTitle(int track)
throws XmcdFormatException
XmcdFormatException
public String readTrackTitle(int track)
throws XmcdFormatException
XmcdFormatException
public String readTrackArtist(int track)
throws XmcdFormatException
XmcdFormatException
public String readTrackExtension(int track)
throws XmcdFormatException
XmcdFormatException
public int[] readPlayOrder()
throws XmcdFormatException
XmcdFormatException
public Properties getProperties()
throws XmcdFormatException
XmcdFormatException
public Composition extractComposition(boolean includeTracks)
throws XmcdFormatException
includeTracks - if true, the generated Composition object
will already contain all tracks from the
embedded CDInfo
XmcdFormatException
public Track[] extractTracks(boolean addArtist)
throws XmcdFormatException
XmcdFormatException
public Artist extractCDArtist()
throws XmcdFormatException
XmcdFormatException
public Artist extractTrackArtist(int track)
throws XmcdFormatException
XmcdFormatException
protected String getTagText(String tag)
throws XmcdFormatException
XmcdFormatException
protected String parseTag(String btag,
String etag,
int index)
throws XmcdFormatException
XmcdFormatException
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||