public class MusicBrainzRestRequester extends RestRequester
discid, isrc, iswc
Modifier and Type | Field and Description |
---|---|
protected static String |
CLASSNAME |
protected static boolean |
debugOut_ |
protected static String |
DEFAULT_MUSICBRAINZ_IP
DEFAULT MUSICBRAINZ IP address to use: 10.0.0.207 .
|
protected static String |
DEFAULT_MUSICBRAINZ_PASSWORD
DEFAULT MUSICBRAINZ password to use: admin .
|
protected static String |
DEFAULT_MUSICBRAINZ_REST_URL_PATHSTR
DEFAULT MUSICBRAINZ rest URL to start the URL path: /rest .
|
protected static String |
DEFAULT_MUSICBRAINZ_TEST_ARTIST_MRID |
protected static String |
DEFAULT_MUSICBRAINZ_TEST_RELEASE_MRID
A default Release MRID to use for testing.
|
protected static String |
DEFAULT_MUSICBRAINZ_USERNAME
DEFAULT MUSICBRAINZ username to use: admin .
|
protected static boolean |
doWrites_ |
protected static StringBuilder |
helpMsg_ |
static String |
LOG_TAG |
protected String |
metaDataFilename_ |
protected String |
restUrlPath_
The start path to use in therest URL.
|
(package private) Builder |
xmlBuilder_ |
acceptJSON_, authenticating_, baseUrl_, password_, SYSTEM_FILE_SEPERATOR, SYSTEM_LINE_SEPERATOR, USER_AGENT, username_
Constructor and Description |
---|
MusicBrainzRestRequester()
Default constructor .
|
MusicBrainzRestRequester(String server,
String user,
String pass)
Constructor to customize all connection settings.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canConnect()
Check connectivity to the MusicBrainz URL specified by the class parms.
|
StringBuilder |
getConfig()
returns config.
|
protected static StringBuilder |
getHelpMsg()
initializes and gets the helpMsg_
class var.
|
protected static String |
getHelpMsgStr()
gets the help as a String.
|
StringBuilder |
getQuery()
queries all the nodes.
|
String |
getRestUrlPath()
Get Method for class field 'restUrlPath_'.
|
StringBuilder |
getStatus()
returns the status for all the nodes.
|
protected StringBuilder |
lookupArtist(String mrid) |
StringBuilder |
lookupArtist(String mrid,
String[] incs)
commandLine command executor method for the test Command.
|
protected StringBuilder |
lookupRelease(String mrid) |
StringBuilder |
lookupRelease(String mrid,
String[] incs)
commandLine command executor method for the test Command.
|
static void |
main(String[] args)
Class main commandLine entry method that has a test command and some convienience commands, as well as a pure rest command.
|
Date |
parseFirstReleaseDate(Document respDoc) |
Element |
parseFirstReleaseEventElem(Document respDoc) |
int |
parseFirstReleaseYear(Document respDoc) |
Date |
parseReleaseDate(Document respDoc,
int releaseIndex) |
Element |
parseReleaseEventElem(Document respDoc,
int releaseIndex) |
Elements |
parseReleaseEventElems(Document respDoc) |
int |
parseReleaseYear(Document respDoc,
int releaseIndex) |
Element |
parseSearchResultsForFirstReleaseElem(Document respDoc) |
String |
parseSearchResultsForFirstReleaseStatus(Document respDoc)
Parses through the Release search results doc, gets the 1st release
and looks for the status subElement.
|
String |
parseSearchResultsForFirstReleaseSubElement(Document respDoc,
String elementName)
Parses through the Release search results doc, gets the 1st release
and looks for the subElement named elemntName passed into this method.
|
Element |
parseSearchResultsForReleaseElem(Document respDoc,
int releaseIndex) |
String |
parseSearchResultsForReleaseStatus(Document respDoc,
int releaseIndex)
Parses through the Release search results doc, gets the 1st release
and looks for the status subElement.
|
String |
parseSearchResultsForReleaseSubElement(Document respDoc,
int releaseIndex,
String elementName)
Parses through the search results doc, gets the releaseIndex specified release
and looks for the subElement named elemntName passed into this method.
|
int |
parseSearchResultsForReleaseYear(Document respDoc) |
void |
parseTunesDir(String tunesDirPath)
Parses the tunes dir and reads in all the artists.
|
Document |
parseXMLResponse(String respXmlStr) |
static String |
prettyJson(String jsonStr)
Makes the JSON string pretty with indenting.
|
protected void |
restCMD(String[] args)
commandLine command executor method for the default rest Command.
|
StringBuilder |
searchArtist(String artist)
Wraps the MusicBrainz search, specifically for an Artist ; example: https://musicbrainz.org/ws/2/release/?
|
StringBuilder |
searchRelease(String artist,
String release)
Wraps the MusicBrainz search, specifically for a release ; example: https://musicbrainz.org/ws/2/release/?
|
void |
setRestUrlPath(String restUrlPath)
Set Method for class field 'restUrlPath_'.
|
protected void |
templateCMD(String[] args)
Template method for future commandLine command executor methods.
|
protected void |
testCMD(String[] args)
commandLine command executor method for the test Command.
|
callService, callService, getAcceptJSON, getBaseUrl, getPassword, getServiceUrl, getUsername, isInit, responseIndenter, serviceGet, servicePost, setAcceptJSON, setBaseUrl, setPassword, setUsername
protected static final String CLASSNAME
public static final String LOG_TAG
protected static final String DEFAULT_MUSICBRAINZ_IP
protected static final String DEFAULT_MUSICBRAINZ_USERNAME
protected static final String DEFAULT_MUSICBRAINZ_PASSWORD
protected static final String DEFAULT_MUSICBRAINZ_REST_URL_PATHSTR
protected static final String DEFAULT_MUSICBRAINZ_TEST_RELEASE_MRID
protected static final String DEFAULT_MUSICBRAINZ_TEST_ARTIST_MRID
protected static StringBuilder helpMsg_
protected static boolean debugOut_
protected static boolean doWrites_
protected String metaDataFilename_
protected String restUrlPath_
Builder xmlBuilder_
public MusicBrainzRestRequester()
public MusicBrainzRestRequester(String server, String user, String pass)
public void setRestUrlPath(String restUrlPath)
restUrlPath_
- is the value to set this class field to.public String getRestUrlPath()
public boolean canConnect()
public StringBuilder getStatus()
public StringBuilder getQuery()
public StringBuilder getConfig()
public static void main(String[] args)
public void parseTunesDir(String tunesDirPath)
protected void testCMD(String[] args)
args
- the array of commandLine args that got passed inprotected StringBuilder lookupRelease(String mrid)
public StringBuilder lookupRelease(String mrid, String[] incs)
mrid
- the MusicBrainz Release ID to lookupinc
- the optional array of associated includes to add to the lookup, null to not add any extra includespublic StringBuilder searchRelease(String artist, String release)
Artist
- the artistName of teh releaserelease
- the name of the releasepublic StringBuilder searchArtist(String artist)
Artist
- the artistName of teh releaseprotected StringBuilder lookupArtist(String mrid)
public StringBuilder lookupArtist(String mrid, String[] incs)
mrid
- the MusicBrainz Release ID to lookupinc
- the optional array of associated includes to add to the lookup, null to not add any extra includespublic Document parseXMLResponse(String respXmlStr)
public Date parseFirstReleaseDate(Document respDoc)
public Date parseReleaseDate(Document respDoc, int releaseIndex)
public int parseFirstReleaseYear(Document respDoc)
public int parseReleaseYear(Document respDoc, int releaseIndex)
public Elements parseReleaseEventElems(Document respDoc)
public Element parseFirstReleaseEventElem(Document respDoc)
public Element parseReleaseEventElem(Document respDoc, int releaseIndex)
public int parseSearchResultsForReleaseYear(Document respDoc)
public Element parseSearchResultsForFirstReleaseElem(Document respDoc)
public Element parseSearchResultsForReleaseElem(Document respDoc, int releaseIndex)
public String parseSearchResultsForFirstReleaseStatus(Document respDoc)
public String parseSearchResultsForReleaseStatus(Document respDoc, int releaseIndex)
public String parseSearchResultsForFirstReleaseSubElement(Document respDoc, String elementName)
public String parseSearchResultsForReleaseSubElement(Document respDoc, int releaseIndex, String elementName)
protected void restCMD(String[] args)
args
- the array of commandLine args that got passed inprotected void templateCMD(String[] args)
args
- the array of commandLine args that got passed inprotected static String getHelpMsgStr()
public static String prettyJson(String jsonStr)
protected static StringBuilder getHelpMsg()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses