Fix deezer url handler
This commit is contained in:
parent
f456ca674d
commit
4993201b70
|
@ -768,14 +768,15 @@ Song DeezerService::ParseSong(const int album_id, const QString &album, const QS
|
|||
|
||||
}
|
||||
|
||||
void DeezerService::GetStreamURL(const QUrl &original_url) {
|
||||
bool DeezerService::GetStreamURL(const QUrl &original_url) {
|
||||
|
||||
#ifdef HAVE_DZMEDIA
|
||||
stream_request_url_ = original_url;
|
||||
dzmedia_->GetStreamURL(original_url);
|
||||
return true;
|
||||
#else
|
||||
stream_request_url_ = QUrl();
|
||||
emit StreamURLReceived(original_url, original_url, Song::FileType_Stream);
|
||||
return false;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ class DeezerService : public InternetService {
|
|||
const bool app_id() { return kAppID; }
|
||||
const bool authenticated() { return !access_token_.isEmpty(); }
|
||||
|
||||
void GetStreamURL(const QUrl &url);
|
||||
bool GetStreamURL(const QUrl &url);
|
||||
|
||||
signals:
|
||||
void Login();
|
||||
|
|
|
@ -43,8 +43,15 @@ UrlHandler::LoadResult DeezerUrlHandler::StartLoading(const QUrl &url) {
|
|||
if (task_id_ != -1) return ret;
|
||||
last_original_url_ = url;
|
||||
task_id_ = app_->task_manager()->StartTask(QString("Loading %1 stream...").arg(url.scheme()));
|
||||
service_->GetStreamURL(url);
|
||||
ret.type_ = LoadResult::WillLoadAsynchronously;
|
||||
bool wait_for_url = service_->GetStreamURL(url);
|
||||
if (wait_for_url) {
|
||||
ret.type_ = LoadResult::WillLoadAsynchronously;
|
||||
}
|
||||
else {
|
||||
CancelTask();
|
||||
ret.type_ = LoadResult::TrackAvailable;
|
||||
ret.media_url_ = url;
|
||||
}
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue