void AmpacheTrackForUrlWorker::run() { m_urlTrack = 0; m_urlAlbum = 0; m_urlArtist = 0; m_urlTrackId = 0; m_urlAlbumId = 0; m_urlArtistId = 0; //send url_to_song to Ampache QString requestUrl = QString( "%1/server/xml.server.php?action=url_to_song&auth=%2&url=%3" ) .arg( m_server, m_sessionId, QUrl::toPercentEncoding( m_url.url() ) ); QNetworkRequest req( requestUrl ); QNetworkReply *reply = The::networkAccessManager()->get( req ); if( reply->waitForReadyRead(-1) ) { if( reply->error() == QNetworkReply::ContentAccessDenied ) { debug() << "Trying to re-authenticate Ampache.."; emit authenticationNeeded(); } } parseTrack( reply->readAll() ); m_track = Meta::TrackPtr( m_urlTrack ); m_proxy->updateTrack( m_track ); reply->deleteLater(); }
bool QNetworkReplyProto::waitForReadyRead(int msecs) { QNetworkReply *item = qscriptvalue_cast<QNetworkReply*>(thisObject()); if (item) return item->waitForReadyRead(msecs); return false; }