Skip to content

Commit

Permalink
update to use the standard last.fm api!
Browse files Browse the repository at this point in the history
  • Loading branch information
nova77 committed Jun 29, 2010
1 parent fd6b302 commit 675f1aa
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions lastfmfpclient/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,13 @@ using namespace std;

// DO NOT CHANGE THOSE!
const char FP_SERVER_NAME[] = "ws.audioscrobbler.com/fingerprint/query/";
const char METADATA_SERVER_NAME[] = "http://ws.audioscrobbler.com/fingerprint/";
const char PUBLIC_CLIENT_NAME[] = "FP Beta 1.51";
const char METADATA_SERVER_NAME[] = "http://ws.audioscrobbler.com/2.0/";
//"http://ws.audioscrobbler.com/fingerprint/";
const char PUBLIC_CLIENT_NAME[] = "FP Beta 1.6";
const char HTTP_POST_DATA_NAME[] = "fpdata";

const char LASTFM_API_KEY[] = "2bfed60da64b96c16ea77adbf5fe1a82";

// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------

Expand Down Expand Up @@ -149,7 +152,6 @@ void getFileInfo( const string& fileName, map<string, string>& urlParams, bool d

urlParams["sha256"] = Sha256File::toHexString(sha256, SHA_SIZE);


if ( !doTaglib )
return;

Expand Down Expand Up @@ -195,20 +197,23 @@ void getFileInfo( const string& fileName, map<string, string>& urlParams, bool d

string fetchMetadata(int fpid, HTTPClient& client, bool justURL)
{
ostringstream fpss;
fpss << fpid;
string fpidStr = fpss.str();
//ostringstream fpss;
//fpss << fpid;
//string fpidStr = fpss.str();

ostringstream oss;
oss << METADATA_SERVER_NAME;
oss << METADATA_SERVER_NAME
<< "?method=track.getfingerprintmetadata"
<< "&fingerprintid=" << fpid
<< "&api_key=" << LASTFM_API_KEY;

//string::reverse_iterator rIt;
//const int maxLev = 4; // max 4 levels in the dir structure
//int levCounter = 0;
//for ( rIt = fpidStr.rbegin(); rIt != fpidStr.rend() && levCounter < maxLev; ++rIt, ++levCounter )
// oss << *rIt << '/';

oss << fpidStr << ".xml";
//oss << fpidStr << ".xml";

if ( justURL )
return oss.str();
Expand Down

0 comments on commit 675f1aa

Please sign in to comment.