Permalink
Browse files

update to use the standard last.fm api!

  • Loading branch information...
nova77 committed Jun 29, 2010
1 parent fd6b302 commit 675f1aa694bf83adaa530742ef195164be08c138
Showing with 13 additions and 8 deletions.
  1. +13 −8 lastfmfpclient/src/main.cpp
@@ -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";
+
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
@@ -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;
@@ -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();

0 comments on commit 675f1aa

Please sign in to comment.