Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions src/ws.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
#include <QMutex>
#include <QSslSocket>

static lastfm::ws::Scheme theScheme = lastfm::ws::Http;
static lastfm::ws::Scheme theScheme = lastfm::ws::Https;
static QString theHost = LASTFM_WS_HOSTNAME;
static QMap< QThread*, QNetworkAccessManager* > threadNamHash;
static QSet< QThread* > ourNamSet;
static QMutex namAccessMutex;
Expand Down Expand Up @@ -96,15 +97,13 @@ lastfm::ws::setScheme( lastfm::ws::Scheme scheme )
QString
lastfm::ws::host()
{
QStringList const args = QCoreApplication::arguments();
if (args.contains( "--debug"))
return "ws.staging.audioscrobbler.com";

int const n = args.indexOf( "--host" );
if (n != -1 && args.count() > n+1)
return args[n+1];
return theHost;
}

return LASTFM_WS_HOSTNAME;
void
lastfm::ws::setHost( QString host )
{
theHost = host;
}

static QUrl baseUrl()
Expand Down
9 changes: 5 additions & 4 deletions src/ws.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace lastfm

namespace ws
{
/** both of these are provided when you register at http://last.fm/api */
/** both of these are provided when you register at https://www.last.fm/api/ */
LASTFM_DLLEXPORT extern const char* SharedSecret;
LASTFM_DLLEXPORT extern const char* ApiKey;

Expand All @@ -54,8 +54,8 @@ namespace lastfm

/** Some webservices require authentication. See the following
* documentation:
* http://www.last.fm/api/authentication
* http://www.last.fm/api/desktopauth
* https://www.last.fm/api/authentication
* https://www.last.fm/api/desktopauth
* You have to authenticate and then assign to SessionKey, liblastfm does
* not do that for you. Also we do not store this. You should store this!
* You only need to authenticate once, and that key lasts forever!
Expand Down Expand Up @@ -122,9 +122,10 @@ namespace lastfm
LASTFM_DLLEXPORT void setScheme( Scheme scheme );
LASTFM_DLLEXPORT Scheme scheme();

LASTFM_DLLEXPORT void setHost( QString host );
LASTFM_DLLEXPORT QString host();

/** the map needs a method entry, as per http://last.fm/api */
/** the map needs a method entry, as per https://www.last.fm/api/ */
LASTFM_DLLEXPORT QUrl url( QMap<QString, QString>, bool sessionKey = true);
LASTFM_DLLEXPORT QNetworkReply* get( QMap<QString, QString> );
/** generates api sig, includes api key, and posts, don't add the api
Expand Down
4 changes: 4 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
include(lastfm_add_test.cmake)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../src)

if(NOT BUILD_WITH_QT4)
find_package(Qt5Test REQUIRED)
endif()

lastfm_add_test(UrlBuilder)
lastfm_add_test(Track)