1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-19 23:41:51 +02:00

Only handle https by ourselves, delay http until we have faster seeking

This commit is contained in:
Uwe L. Korn 2013-09-16 23:35:17 +02:00
parent 8f8736c965
commit 361e960c0b
3 changed files with 12 additions and 5 deletions

View File

@ -640,7 +640,7 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
setCurrentTrack( result );
if ( !TomahawkUtils::isLocalResult( d->currentTrack->url() ) )
if ( !TomahawkUtils::isLocalResult( d->currentTrack->url() ) && !TomahawkUtils::isHttpResult( d->currentTrack->url() ) )
{
boost::function< void ( QSharedPointer< QIODevice >& ) > callback =
boost::bind( &AudioEngine::performLoadTrack, this, result, _1 );
@ -668,7 +668,8 @@ AudioEngine::performLoadTrack( const Tomahawk::result_ptr& result, QSharedPointe
bool err = false;
{
if ( !TomahawkUtils::isLocalResult( d->currentTrack->url() ) && ( !io || io.isNull() ) )
if ( !( TomahawkUtils::isLocalResult( d->currentTrack->url() ) || TomahawkUtils::isHttpResult( d->currentTrack->url() ) )
&& ( !io || io.isNull() ) )
{
tLog() << "Error getting iodevice for" << result->url();
err = true;
@ -680,7 +681,7 @@ AudioEngine::performLoadTrack( const Tomahawk::result_ptr& result, QSharedPointe
d->state = Loading;
emit loading( d->currentTrack );
if ( !TomahawkUtils::isLocalResult( d->currentTrack->url() ) )
if ( !TomahawkUtils::isLocalResult( d->currentTrack->url() ) && !TomahawkUtils::isHttpResult( d->currentTrack->url() ) )
{
QSharedPointer<QNetworkReply> qnr = io.objectCast<QNetworkReply>();
if ( !qnr.isNull() )
@ -704,6 +705,7 @@ AudioEngine::performLoadTrack( const Tomahawk::result_ptr& result, QSharedPointe
/*
* TODO: Do we need this anymore as we now do HTTP streaming ourselves?
* Maybe this can be useful for letting phonon do other protocols?
*/
if ( !TomahawkUtils::isLocalResult( d->currentTrack->url() ) )
{
QUrl furl = d->currentTrack->url();
@ -716,7 +718,7 @@ AudioEngine::performLoadTrack( const Tomahawk::result_ptr& result, QSharedPointe
tLog( LOGVERBOSE ) << "Passing to Phonon:" << furl;
d->mediaObject->setCurrentSource( furl );
}
else*/
else
{
QString furl = d->currentTrack->url();
if ( furl.startsWith( "file://" ) )

View File

@ -543,7 +543,7 @@ md5( const QByteArray& data )
bool
isHttpResult( const QString& url )
{
return url.startsWith( "http://" ) || url.startsWith( "https://" );
return url.startsWith( "http://" ); // || url.startsWith( "https://" );
}

View File

@ -165,6 +165,11 @@ namespace TomahawkUtils
DLLEXPORT QString md5( const QByteArray& data );
DLLEXPORT bool removeDirectory( const QString& dir );
/**
* Check if this URL refers to a http-Result.
*
* Attention: This only checks for a http result, not a httpS result.
*/
DLLEXPORT bool isHttpResult( const QString& url );
DLLEXPORT bool isLocalResult( const QString& url );