mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-18 23:09:42 +01:00
Deprecate UrlTranslator again.
UrlTranslator and UrlHandler have the same interface but only differed in the internal implementation. We can distinguish between them internally, so do it instead of making more interfaces.
This commit is contained in:
parent
1fd6b1bc21
commit
cc873c1199
@ -241,15 +241,17 @@ Api_v1::sid( QxtWebRequestEvent* event, QString unused )
|
||||
return send404( event );
|
||||
}
|
||||
|
||||
boost::function< void ( QSharedPointer< QIODevice >& ) > callback =
|
||||
boost::bind( &Api_v1::processSid, this, event, rp, _1 );
|
||||
boost::function< void ( const QString&, QSharedPointer< QIODevice >& ) > callback =
|
||||
boost::bind( &Api_v1::processSid, this, event, rp, _1, _2 );
|
||||
Tomahawk::UrlHandler::getIODeviceForUrl( rp, rp->url(), callback );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Api_v1::processSid( QxtWebRequestEvent* event, Tomahawk::result_ptr& rp, QSharedPointer< QIODevice >& iodev )
|
||||
Api_v1::processSid( QxtWebRequestEvent* event, Tomahawk::result_ptr& rp, const QString& url, QSharedPointer< QIODevice >& iodev )
|
||||
{
|
||||
Q_UNUSED( url );
|
||||
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||
if ( !iodev || !rp )
|
||||
{
|
||||
|
@ -89,7 +89,7 @@ protected:
|
||||
void sendPlain404( QxtWebRequestEvent* event, const QString& message, const QString& statusmessage );
|
||||
|
||||
private:
|
||||
void processSid( QxtWebRequestEvent* event, Tomahawk::result_ptr&, QSharedPointer< QIODevice >& );
|
||||
void processSid( QxtWebRequestEvent* event, Tomahawk::result_ptr&, const QString& url, QSharedPointer< QIODevice >& );
|
||||
|
||||
QxtWebRequestEvent* m_storedEvent;
|
||||
QSharedPointer< QIODevice > m_ioDevice;
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
Q_DECLARE_METATYPE( IODeviceFactoryFunc )
|
||||
Q_DECLARE_METATYPE( IODeviceCallback )
|
||||
|
||||
namespace Tomahawk {
|
||||
@ -67,7 +68,7 @@ registerIODeviceFactory( const QString &proto, IODeviceFactoryFunc fac )
|
||||
|
||||
void
|
||||
getIODeviceForUrl( const Tomahawk::result_ptr& result, const QString& url,
|
||||
boost::function< void ( QSharedPointer< QIODevice >& ) > callback )
|
||||
boost::function< void ( const QString&, QSharedPointer< QIODevice >& ) > callback )
|
||||
{
|
||||
if ( iofactories.isEmpty() )
|
||||
{
|
||||
@ -79,14 +80,14 @@ getIODeviceForUrl( const Tomahawk::result_ptr& result, const QString& url,
|
||||
QRegExp rx( "^([a-zA-Z0-9]+)://(.+)$" );
|
||||
if ( rx.indexIn( url ) == -1 )
|
||||
{
|
||||
callback( sp );
|
||||
callback( url, sp );
|
||||
return;
|
||||
}
|
||||
|
||||
const QString proto = rx.cap( 1 );
|
||||
if ( !iofactories.contains( proto ) )
|
||||
{
|
||||
callback( sp );
|
||||
callback( url, sp );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -97,7 +98,7 @@ getIODeviceForUrl( const Tomahawk::result_ptr& result, const QString& url,
|
||||
|
||||
void
|
||||
localFileIODeviceFactory( const Tomahawk::result_ptr&, const QString& url,
|
||||
boost::function< void ( QSharedPointer< QIODevice >& ) > callback )
|
||||
boost::function< void ( const QString&, QSharedPointer< QIODevice >& ) > callback )
|
||||
{
|
||||
// ignore "file://" at front of url
|
||||
QFile* io = new QFile( url.mid( QString( "file://" ).length() ) );
|
||||
@ -106,13 +107,13 @@ localFileIODeviceFactory( const Tomahawk::result_ptr&, const QString& url,
|
||||
|
||||
//boost::functions cannot accept temporaries as parameters
|
||||
QSharedPointer< QIODevice > sp = QSharedPointer<QIODevice>( io );
|
||||
callback( sp );
|
||||
callback( url, sp );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
httpIODeviceFactory( const Tomahawk::result_ptr&, const QString& url,
|
||||
boost::function< void ( QSharedPointer< QIODevice >& ) > callback )
|
||||
boost::function< void ( const QString&, QSharedPointer< QIODevice >& ) > callback )
|
||||
{
|
||||
QNetworkRequest req( url );
|
||||
// Follow HTTP Redirects
|
||||
|
@ -28,10 +28,10 @@
|
||||
#include <boost/function.hpp>
|
||||
|
||||
typedef boost::function< void( const Tomahawk::result_ptr&, const QString&,
|
||||
boost::function< void( QSharedPointer< QIODevice >& ) > )> IODeviceFactoryFunc;
|
||||
boost::function< void( const QString&, QSharedPointer< QIODevice >& ) > )> IODeviceFactoryFunc;
|
||||
typedef boost::function< void( const Tomahawk::result_ptr&, const QString&,
|
||||
boost::function< void( const QString& ) > )> UrlTranslatorFunc;
|
||||
typedef boost::function< void ( QSharedPointer< QIODevice >& ) > IODeviceCallback;
|
||||
typedef boost::function< void ( const QString&, QSharedPointer< QIODevice >& ) > IODeviceCallback;
|
||||
|
||||
|
||||
namespace Tomahawk
|
||||
@ -40,17 +40,13 @@ namespace Tomahawk
|
||||
namespace UrlHandler
|
||||
{
|
||||
|
||||
DLLEXPORT void getIODeviceForUrl( const Tomahawk::result_ptr&, const QString& url, boost::function< void ( QSharedPointer< QIODevice >& ) > callback );
|
||||
DLLEXPORT void getIODeviceForUrl( const Tomahawk::result_ptr&, const QString& url,
|
||||
boost::function< void ( const QString&, QSharedPointer< QIODevice >& ) > callback );
|
||||
DLLEXPORT void registerIODeviceFactory( const QString& proto, IODeviceFactoryFunc fac );
|
||||
DLLEXPORT void localFileIODeviceFactory( const Tomahawk::result_ptr& result, const QString& url,
|
||||
boost::function< void ( QSharedPointer< QIODevice >& ) > callback );
|
||||
boost::function< void ( const QString&, QSharedPointer< QIODevice >& ) > callback );
|
||||
DLLEXPORT void httpIODeviceFactory( const Tomahawk::result_ptr& result, const QString& url,
|
||||
boost::function< void ( QSharedPointer< QIODevice >& ) > callback );
|
||||
|
||||
DLLEXPORT void getUrlTranslation( const Tomahawk::result_ptr& result, const QString& url,
|
||||
boost::function< void ( const QString& ) > callback );
|
||||
DLLEXPORT void registerUrlTranslator( const QString &proto, UrlTranslatorFunc fac );
|
||||
|
||||
boost::function< void ( const QString&, QSharedPointer< QIODevice >& ) > callback );
|
||||
} // namespace UrlHandler
|
||||
|
||||
} // namespace Tomahawk
|
||||
|
@ -45,7 +45,7 @@ public slots:
|
||||
void called()
|
||||
{
|
||||
QSharedPointer< QIODevice > sp = QSharedPointer< QIODevice >( reply->reply(), &QObject::deleteLater );
|
||||
callback( sp );
|
||||
callback( reply->reply()->url().toString(), sp );
|
||||
|
||||
// Call once, then self-destruct
|
||||
deleteLater();
|
||||
|
@ -631,9 +631,7 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
||||
if ( !TomahawkUtils::isLocalResult( d->currentTrack->url() ) && !TomahawkUtils::isHttpResult( d->currentTrack->url() )
|
||||
&& !TomahawkUtils::isRtmpResult( d->currentTrack->url() ) )
|
||||
{
|
||||
boost::function< void ( const QString& ) > callback =
|
||||
boost::bind( &AudioEngine::performLoadIODevice, this, result, _1 );
|
||||
Tomahawk::UrlHandler::getUrlTranslation( d->currentTrack, d->currentTrack->url(), callback );
|
||||
performLoadIODevice( d->currentTrack, d->currentTrack->url() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -651,8 +649,8 @@ AudioEngine::performLoadIODevice( const result_ptr& result, const QString& url )
|
||||
if ( !TomahawkUtils::isLocalResult( url ) && !TomahawkUtils::isHttpResult( url )
|
||||
&& !TomahawkUtils::isRtmpResult( url ) )
|
||||
{
|
||||
boost::function< void ( QSharedPointer< QIODevice >& ) > callback =
|
||||
boost::bind( &AudioEngine::performLoadTrack, this, result, url, _1 );
|
||||
boost::function< void ( const QString&, QSharedPointer< QIODevice >& ) > callback =
|
||||
boost::bind( &AudioEngine::performLoadTrack, this, result, _1, _2 );
|
||||
Tomahawk::UrlHandler::getIODeviceForUrl( result, url, callback );
|
||||
}
|
||||
else
|
||||
|
@ -1225,7 +1225,7 @@ Servent::claimOffer( ControlConnection* cc, const QString &nodeid, const QString
|
||||
|
||||
void
|
||||
Servent::remoteIODeviceFactory( const Tomahawk::result_ptr& result, const QString& url,
|
||||
boost::function< void ( QSharedPointer< QIODevice >& ) > callback )
|
||||
boost::function< void ( const QString&, QSharedPointer< QIODevice >& ) > callback )
|
||||
{
|
||||
QSharedPointer<QIODevice> sp;
|
||||
|
||||
@ -1235,7 +1235,7 @@ Servent::remoteIODeviceFactory( const Tomahawk::result_ptr& result, const QStrin
|
||||
source_ptr s = SourceList::instance()->get( sourceName );
|
||||
if ( s.isNull() || !s->controlConnection() )
|
||||
{
|
||||
callback( sp );
|
||||
callback( result->url(), sp );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1245,7 +1245,7 @@ Servent::remoteIODeviceFactory( const Tomahawk::result_ptr& result, const QStrin
|
||||
|
||||
//boost::functions cannot accept temporaries as parameters
|
||||
sp = sc->iodevice();
|
||||
callback( sp );
|
||||
callback( result->url(), sp );
|
||||
}
|
||||
|
||||
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
ControlConnection* lookupControlConnection( const QString& nodeid );
|
||||
|
||||
void remoteIODeviceFactory( const Tomahawk::result_ptr& result, const QString& url,
|
||||
boost::function< void ( QSharedPointer< QIODevice >& ) > callback );
|
||||
boost::function< void ( const QString&, QSharedPointer< QIODevice >& ) > callback );
|
||||
|
||||
// you may call this method as often as you like for the same peerInfo, dupe checking is done inside
|
||||
void registerPeer( const Tomahawk::peerinfo_ptr& peerInfo );
|
||||
|
@ -188,15 +188,17 @@ StreamConnection::startSending( const Tomahawk::result_ptr& result )
|
||||
m_result = result;
|
||||
qDebug() << "Starting to transmit" << m_result->url();
|
||||
|
||||
boost::function< void ( QSharedPointer< QIODevice >& ) > callback =
|
||||
boost::bind( &StreamConnection::reallyStartSending, this, result, _1 );
|
||||
boost::function< void ( const QString&, QSharedPointer< QIODevice >& ) > callback =
|
||||
boost::bind( &StreamConnection::reallyStartSending, this, result, _1, _2 );
|
||||
Tomahawk::UrlHandler::getIODeviceForUrl( m_result, m_result->url(), callback );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StreamConnection::reallyStartSending( const Tomahawk::result_ptr& result, QSharedPointer< QIODevice >& io )
|
||||
StreamConnection::reallyStartSending( const Tomahawk::result_ptr& result, const QString& url, QSharedPointer< QIODevice >& io )
|
||||
{
|
||||
Q_UNUSED( url );
|
||||
|
||||
// Note: We don't really need to pass in 'result' here, since we already have it stored
|
||||
// as a member variable. The callback-signature of getIODeviceForUrl requires it, though.
|
||||
if ( !io || io.isNull() )
|
||||
|
@ -73,7 +73,7 @@ protected slots:
|
||||
|
||||
private slots:
|
||||
void startSending( const Tomahawk::result_ptr& result );
|
||||
void reallyStartSending( const Tomahawk::result_ptr& result, QSharedPointer< QIODevice >& io ); //only called back from startSending
|
||||
void reallyStartSending( const Tomahawk::result_ptr& result, const QString& url, QSharedPointer< QIODevice >& io ); //only called back from startSending
|
||||
void sendSome();
|
||||
void showStats( qint64 tx, qint64 rx );
|
||||
|
||||
|
@ -155,8 +155,10 @@ PlayableProxyModelPlaylistInterface::siblingIndex( int itemsAway, qint64 rootInd
|
||||
{
|
||||
if ( m_shuffleHistory.count() > 1 )
|
||||
{
|
||||
if ( proxyModel->itemFromQuery( m_shuffleHistory.at( m_shuffleHistory.count() - 2 ) ) )
|
||||
idx = proxyModel->mapFromSource( proxyModel->itemFromQuery( m_shuffleHistory.at( m_shuffleHistory.count() - 2 ) )->index );
|
||||
if ( proxyModel->itemFromQuery( m_shuffleHistory.at( m_shuffleHistory.count() - 2 ) ) ) {
|
||||
int historyIndex = m_shuffleHistory.count() - 2;
|
||||
idx = proxyModel->mapFromSource( proxyModel->itemFromQuery( m_shuffleHistory.at( historyIndex ) )->index );
|
||||
}
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
|
@ -423,7 +423,7 @@ JSResolverHelper::addCustomUrlHandler( const QString& protocol,
|
||||
m_urlCallbackIsAsync = ( isAsynchronous.toLower() == "true" ) ? true : false;
|
||||
|
||||
boost::function< void( const Tomahawk::result_ptr&, const QString&,
|
||||
boost::function< void( QSharedPointer< QIODevice >& ) > )> fac =
|
||||
boost::function< void( const QString&, QSharedPointer< QIODevice >& ) > )> fac =
|
||||
boost::bind( &JSResolverHelper::customIODeviceFactory, this, _1, _2, _3 );
|
||||
Tomahawk::UrlHandler::registerIODeviceFactory( protocol, fac );
|
||||
|
||||
@ -438,37 +438,9 @@ JSResolverHelper::reportStreamUrl( const QString& qid, const QString& streamUrl
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JSResolverHelper::addCustomUrlTranslator( const QString& protocol,
|
||||
const QString& callbackFuncName,
|
||||
const QString& isAsynchronous )
|
||||
{
|
||||
m_urlTranslatorIsAsync = ( isAsynchronous.toLower() == "true" ) ? true : false;
|
||||
|
||||
boost::function< void( const Tomahawk::result_ptr&, const QString&,
|
||||
boost::function< void( const QString& ) > )> fac =
|
||||
boost::bind( &JSResolverHelper::customUrlTranslator, this, _1, _2, _3 );
|
||||
Tomahawk::UrlHandler::registerUrlTranslator( protocol, fac );
|
||||
|
||||
m_urlTranslator = callbackFuncName;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JSResolverHelper::reportUrlTranslation( const QString& qid, const QString& streamUrl )
|
||||
{
|
||||
if ( !m_translatorCallbacks.contains( qid ) )
|
||||
return;
|
||||
|
||||
boost::function< void( const QString& ) > callback = m_translatorCallbacks.take( qid );
|
||||
|
||||
returnUrlTranslation( streamUrl, callback );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JSResolverHelper::customIODeviceFactory( const Tomahawk::result_ptr&, const QString& url,
|
||||
boost::function< void( QSharedPointer< QIODevice >& ) > callback )
|
||||
boost::function< void( const QString&, QSharedPointer< QIODevice >& ) > callback )
|
||||
{
|
||||
//can be sync or async
|
||||
QString origResultUrl = QString( QUrl( url ).toEncoded() );
|
||||
@ -495,34 +467,6 @@ JSResolverHelper::customIODeviceFactory( const Tomahawk::result_ptr&, const QStr
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JSResolverHelper::customUrlTranslator( const Tomahawk::result_ptr&, const QString& url, boost::function<void (const QString& )> callback )
|
||||
{
|
||||
//can be sync or async
|
||||
QString origResultUrl = QString( QUrl( url ).toEncoded() );
|
||||
|
||||
if ( m_urlTranslatorIsAsync )
|
||||
{
|
||||
QString qid = uuid();
|
||||
QString getUrl = QString( "Tomahawk.resolver.instance.%1( '%2', '%3' );" ).arg( m_urlTranslator )
|
||||
.arg( qid )
|
||||
.arg( origResultUrl );
|
||||
|
||||
m_translatorCallbacks.insert( qid, callback );
|
||||
m_resolver->d_func()->engine->mainFrame()->evaluateJavaScript( getUrl );
|
||||
}
|
||||
else
|
||||
{
|
||||
QString getUrl = QString( "Tomahawk.resolver.instance.%1( '%2' );" ).arg( m_urlTranslator )
|
||||
.arg( origResultUrl );
|
||||
|
||||
QString urlStr = m_resolver->d_func()->engine->mainFrame()->evaluateJavaScript( getUrl ).toString();
|
||||
|
||||
returnUrlTranslation( urlStr, callback );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JSResolverHelper::reportStreamUrl( const QString& qid,
|
||||
const QString& streamUrl, const QVariantMap& headers )
|
||||
@ -530,7 +474,7 @@ JSResolverHelper::reportStreamUrl( const QString& qid,
|
||||
if ( !m_streamCallbacks.contains( qid ) )
|
||||
return;
|
||||
|
||||
boost::function< void( QSharedPointer< QIODevice >& ) > callback = m_streamCallbacks.take( qid );
|
||||
boost::function< void( const QString&, QSharedPointer< QIODevice >& ) > callback = m_streamCallbacks.take( qid );
|
||||
|
||||
QMap<QString, QString> parsedHeaders;
|
||||
foreach ( const QString& key, headers.keys()) {
|
||||
@ -546,48 +490,38 @@ JSResolverHelper::reportStreamUrl( const QString& qid,
|
||||
|
||||
void
|
||||
JSResolverHelper::returnStreamUrl( const QString& streamUrl, const QMap<QString, QString>& headers,
|
||||
boost::function< void( QSharedPointer< QIODevice >& ) > callback )
|
||||
boost::function< void( const QString&, QSharedPointer< QIODevice >& ) > callback )
|
||||
{
|
||||
if ( streamUrl.isEmpty() )
|
||||
if ( streamUrl.isEmpty() || !( TomahawkUtils::isHttpResult( streamUrl ) || TomahawkUtils::isHttpsResult( streamUrl ) ) )
|
||||
{
|
||||
// Not an https? URL, so let Phonon handle it
|
||||
QSharedPointer< QIODevice > sp;
|
||||
callback( sp );
|
||||
return;
|
||||
callback( streamUrl, sp );
|
||||
}
|
||||
else
|
||||
{
|
||||
QUrl url = QUrl::fromEncoded( streamUrl.toUtf8() );
|
||||
QNetworkRequest req( url );
|
||||
foreach ( const QString& key , headers.keys() ) {
|
||||
req.setRawHeader( key.toLatin1(), headers[key].toLatin1() );
|
||||
}
|
||||
tDebug() << "Creating a QNetowrkReply with url:" << req.url().toString();
|
||||
NetworkReply* reply = new NetworkReply( Tomahawk::Utils::nam()->get( req ) );
|
||||
|
||||
QUrl url = QUrl::fromEncoded( streamUrl.toUtf8() );
|
||||
QNetworkRequest req( url );
|
||||
foreach ( const QString& key , headers.keys() ) {
|
||||
req.setRawHeader( key.toLatin1(), headers[key].toLatin1() );
|
||||
NewClosure( reply , SIGNAL( finalUrlReached() ), this, SLOT( gotStreamUrl( IODeviceCallback, NetworkReply* )), callback, reply );
|
||||
}
|
||||
tDebug() << "Creating a QNetowrkReply with url:" << req.url().toString();
|
||||
NetworkReply* reply = new NetworkReply( Tomahawk::Utils::nam()->get( req ) );
|
||||
|
||||
NewClosure( reply , SIGNAL( finalUrlReached() ), this, SLOT( gotStreamUrl( boost::function< void( QSharedPointer< QIODevice >& ) >, NetworkReply* )), callback, reply );
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE( IODeviceCallback )
|
||||
|
||||
void
|
||||
JSResolverHelper::gotStreamUrl( boost::function< void( QSharedPointer< QIODevice >& ) > callback, NetworkReply* reply )
|
||||
JSResolverHelper::gotStreamUrl( boost::function< void( const QString&, QSharedPointer< QIODevice >& ) > callback, NetworkReply* reply )
|
||||
{
|
||||
//boost::functions cannot accept temporaries as parameters
|
||||
QSharedPointer< QIODevice > sp = QSharedPointer< QIODevice >( reply->reply(), &QObject::deleteLater );
|
||||
QString url = reply->reply()->url().toString();
|
||||
reply->disconnectFromReply();
|
||||
reply->deleteLater();
|
||||
|
||||
callback( sp );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JSResolverHelper::returnUrlTranslation( const QString& streamUrl, boost::function<void (const QString& )> callback )
|
||||
{
|
||||
if ( streamUrl.isEmpty() )
|
||||
{
|
||||
callback( QString() );
|
||||
return;
|
||||
}
|
||||
|
||||
//boost::functions cannot accept temporaries as parameters
|
||||
// sp = QSharedPointer< QString >( streamUrl , &QObject::deleteLater );
|
||||
callback( streamUrl );
|
||||
callback( url, sp );
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include "DllMacro.h"
|
||||
#include "Typedefs.h"
|
||||
#include "UrlHandler.h"
|
||||
#include "utils/NetworkReply.h"
|
||||
|
||||
#include <boost/function.hpp>
|
||||
@ -45,13 +46,9 @@ public:
|
||||
Q_INVOKABLE void addCustomUrlHandler( const QString& protocol, const QString& callbackFuncName, const QString& isAsynchronous = "false" );
|
||||
Q_INVOKABLE void reportStreamUrl( const QString& qid, const QString& streamUrl );
|
||||
Q_INVOKABLE void reportStreamUrl( const QString& qid, const QString& streamUrl, const QVariantMap& headers );
|
||||
Q_INVOKABLE void addCustomUrlTranslator( const QString& protocol, const QString& callbackFuncName, const QString& isAsynchronous = "false" );
|
||||
Q_INVOKABLE void reportUrlTranslation( const QString& qid, const QString& streamUrl );
|
||||
|
||||
void customIODeviceFactory( const Tomahawk::result_ptr&, const QString& url,
|
||||
boost::function< void( QSharedPointer< QIODevice >& ) > callback ); // async
|
||||
void customUrlTranslator( const Tomahawk::result_ptr&, const QString& url,
|
||||
boost::function< void( const QString& ) > callback ); // async
|
||||
boost::function< void( const QString&, QSharedPointer< QIODevice >& ) > callback ); // async
|
||||
|
||||
public slots:
|
||||
QByteArray readRaw( const QString& fileName );
|
||||
@ -76,20 +73,19 @@ public slots:
|
||||
void reportCapabilities( const QVariant& capabilities );
|
||||
|
||||
private slots:
|
||||
void gotStreamUrl( boost::function< void( QSharedPointer< QIODevice >& ) > callback, NetworkReply* reply );
|
||||
void gotStreamUrl( IODeviceCallback callback, NetworkReply* reply );
|
||||
void tracksAdded( const QList<Tomahawk::query_ptr>& tracks, const Tomahawk::ModelMode, const Tomahawk::collection_ptr& collection );
|
||||
void pltemplateTracksLoadedForUrl( const QString& url, const Tomahawk::playlisttemplate_ptr& pltemplate );
|
||||
|
||||
private:
|
||||
Tomahawk::query_ptr parseTrack( const QVariantMap& track );
|
||||
void returnStreamUrl( const QString& streamUrl, const QMap<QString, QString>& headers,
|
||||
boost::function< void( QSharedPointer< QIODevice >& ) > callback );
|
||||
void returnUrlTranslation( const QString& streamUrl, boost::function< void( const QString& ) > callback );
|
||||
boost::function< void( const QString&, QSharedPointer< QIODevice >& ) > callback );
|
||||
|
||||
QVariantMap m_resolverConfig;
|
||||
JSResolver* m_resolver;
|
||||
QString m_scriptPath, m_urlCallback, m_urlTranslator;
|
||||
QHash< QString, boost::function< void( QSharedPointer< QIODevice >& ) > > m_streamCallbacks;
|
||||
QHash< QString, boost::function< void( const QString&, QSharedPointer< QIODevice >& ) > > m_streamCallbacks;
|
||||
QHash< QString, boost::function< void( const QString& ) > > m_translatorCallbacks;
|
||||
bool m_urlCallbackIsAsync;
|
||||
bool m_urlTranslatorIsAsync;
|
||||
|
@ -556,6 +556,13 @@ isHttpResult( const QString& url )
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
isHttpsResult( const QString& url )
|
||||
{
|
||||
return url.startsWith( "https://" );
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
isLocalResult( const QString& url )
|
||||
{
|
||||
|
@ -171,6 +171,7 @@ namespace TomahawkUtils
|
||||
* Attention: This only checks for a http result, not a httpS result.
|
||||
*/
|
||||
DLLEXPORT bool isHttpResult( const QString& url );
|
||||
DLLEXPORT bool isHttpsResult( const QString& url );
|
||||
DLLEXPORT bool isLocalResult( const QString& url );
|
||||
DLLEXPORT bool isRtmpResult( const QString& url );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user