From 3655a2b53753dc4b30ba147529d0ed5484252919 Mon Sep 17 00:00:00 2001 From: Stefan Derkits Date: Wed, 4 Jan 2012 16:37:04 +0100 Subject: [PATCH] Don't check whitelist everytime we want to resolve a redirect --- src/libtomahawk/utils/shortenedlinkparser.cpp | 11 ++++++++--- src/libtomahawk/utils/shortenedlinkparser.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/libtomahawk/utils/shortenedlinkparser.cpp b/src/libtomahawk/utils/shortenedlinkparser.cpp index f7ab8d084..911921153 100644 --- a/src/libtomahawk/utils/shortenedlinkparser.cpp +++ b/src/libtomahawk/utils/shortenedlinkparser.cpp @@ -57,7 +57,6 @@ ShortenedLinkParser::handlesUrl( const QString& url ) url.contains( "itun.es" ) || url.contains( "tinyurl.com" ) || url.contains( "tinysong.com" ) || - url.contains( "grooveshark.com" ) || url.contains( "rd.io" ) ); } @@ -67,7 +66,14 @@ ShortenedLinkParser::lengthenUrl( const QString& url ) { if ( !handlesUrl( url ) ) return; + + lengthenShortUrl( url ); +} + +void +ShortenedLinkParser::lengthenShortUrl ( const QString& url ) +{ tDebug() << "Looking up..." << url; QNetworkReply* reply = TomahawkUtils::nam()->get( QNetworkRequest( QUrl( url ) ) ); @@ -76,7 +82,6 @@ ShortenedLinkParser::lengthenUrl( const QString& url ) m_queries.insert( reply ); } - void ShortenedLinkParser::lookupFinished() { @@ -89,7 +94,7 @@ ShortenedLinkParser::lookupFinished() tDebug() << "RedirectionTargetAttribute set on " << redir; m_queries.remove( r ); r->deleteLater(); - lengthenUrl( redir.toUrl().toString() ); + lengthenShortUrl( redir.toUrl().toString() ); } else { diff --git a/src/libtomahawk/utils/shortenedlinkparser.h b/src/libtomahawk/utils/shortenedlinkparser.h index 51c208725..53fd655a6 100644 --- a/src/libtomahawk/utils/shortenedlinkparser.h +++ b/src/libtomahawk/utils/shortenedlinkparser.h @@ -56,6 +56,7 @@ signals: private: void lengthenUrl( const QString& url ); + void lengthenShortUrl( const QString& url ); void checkFinished(); QStringList m_links;