cddb_lookup: verbose now dumps server response.
* The pretty dump output is now only used for the -d and -i options.
This commit is contained in:
parent
df53a4bf21
commit
3008268c9d
@ -38,7 +38,7 @@ public:
|
||||
status_t Lookup(CDDBServer& server, const dev_t device,
|
||||
bool dumpOnly, bool verbose);
|
||||
status_t Dump(CDDBServer& server, const char* category,
|
||||
const char* cddbID);
|
||||
const char* cddbID, bool verbose);
|
||||
|
||||
private:
|
||||
bool _ReadTOC(const dev_t device, uint32* cddbID,
|
||||
@ -147,14 +147,14 @@ CDDBLookup::Lookup(CDDBServer& server, const dev_t device, bool dumpOnly,
|
||||
}
|
||||
|
||||
ReadResponseData readResponse;
|
||||
result = server.Read(*diskData, readResponse);
|
||||
result = server.Read(*diskData, readResponse, verbose);
|
||||
if (result != B_OK) {
|
||||
fprintf(stderr, "Could not read detailed CD entry from server: %s\n",
|
||||
strerror(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
if (verbose || dumpOnly)
|
||||
if (dumpOnly)
|
||||
_Dump(readResponse);
|
||||
|
||||
if (!dumpOnly) {
|
||||
@ -169,10 +169,11 @@ CDDBLookup::Lookup(CDDBServer& server, const dev_t device, bool dumpOnly,
|
||||
|
||||
|
||||
status_t
|
||||
CDDBLookup::Dump(CDDBServer& server, const char* category, const char* cddbID)
|
||||
CDDBLookup::Dump(CDDBServer& server, const char* category, const char* cddbID,
|
||||
bool verbose)
|
||||
{
|
||||
ReadResponseData readResponse;
|
||||
status_t status = server.Read(category, cddbID, "", readResponse);
|
||||
status_t status = server.Read(category, cddbID, "", readResponse, verbose);
|
||||
if (status != B_OK) {
|
||||
fprintf(stderr, "Could not read detailed CD entry from server: %s\n",
|
||||
strerror(status));
|
||||
@ -402,7 +403,7 @@ main(int argc, char* const* argv)
|
||||
}
|
||||
|
||||
const char* cddbID = argv[optind];
|
||||
cddb.Dump(server, category, cddbID);
|
||||
cddb.Dump(server, category, cddbID, verbose);
|
||||
} else {
|
||||
// Lookup via actual CD
|
||||
if (left > 0) {
|
||||
|
@ -153,16 +153,16 @@ CDDBServer::Query(uint32 cddbID, const scsi_toc_toc* toc,
|
||||
|
||||
status_t
|
||||
CDDBServer::Read(const QueryResponseData& diskData,
|
||||
ReadResponseData& readResponse)
|
||||
ReadResponseData& readResponse, bool verbose)
|
||||
{
|
||||
return Read(diskData.category, diskData.cddbID, diskData.artist,
|
||||
readResponse);
|
||||
readResponse, verbose);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
CDDBServer::Read(const BString& category, const BString& cddbID,
|
||||
const BString& artist, ReadResponseData& readResponse)
|
||||
const BString& artist, ReadResponseData& readResponse, bool verbose)
|
||||
{
|
||||
if (_OpenConnection() != B_OK)
|
||||
return B_ERROR;
|
||||
@ -174,6 +174,9 @@ CDDBServer::Read(const BString& category, const BString& cddbID,
|
||||
BString output;
|
||||
status_t result = _SendCommand(cddbCommand, output);
|
||||
if (result == B_OK) {
|
||||
if (verbose)
|
||||
puts(output);
|
||||
|
||||
// Remove the header from the reply.
|
||||
output.Remove(0, output.FindFirst("\r\n\r\n") + 4);
|
||||
|
||||
|
@ -61,11 +61,13 @@ public:
|
||||
status_t Query(uint32 cddbID, const scsi_toc_toc* toc,
|
||||
QueryResponseList& queryResponses);
|
||||
status_t Read(const QueryResponseData& diskData,
|
||||
ReadResponseData& readResponse);
|
||||
ReadResponseData& readResponse,
|
||||
bool verbose = false);
|
||||
status_t Read(const BString& category,
|
||||
const BString& cddbID,
|
||||
const BString& artist,
|
||||
ReadResponseData& readResponse);
|
||||
ReadResponseData& readResponse,
|
||||
bool verbose = false);
|
||||
|
||||
private:
|
||||
status_t _ParseAddress(const BString& cddbServer);
|
||||
|
Loading…
x
Reference in New Issue
Block a user