1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-09 07:36:48 +02:00

* Support a few more URL shorteners: ow.ly, fb.me, itun.es, tinyurl.com.

This commit is contained in:
Christian Muehlhaeuser
2011-11-24 13:30:20 +01:00
parent 758bb74603
commit 5929adfa57
2 changed files with 8 additions and 6 deletions

View File

@@ -125,8 +125,6 @@ DropJob::acceptsMimeData( const QMimeData* data, DropJob::DropTypes acceptedType
if ( acceptedType.testFlag( Track ) ) if ( acceptedType.testFlag( Track ) )
{ {
if( url.contains( "m3u" ) ) if( url.contains( "m3u" ) )
return true; return true;
@@ -473,7 +471,7 @@ DropJob::handleM3u( const QString& fileUrls )
void void
DropJob::handleXspfs( const QString& fileUrls ) DropJob::handleXspfs( const QString& fileUrls )
{ {
tDebug() << Q_FUNC_INFO << "Got xspf playlist!!" << fileUrls; tDebug() << Q_FUNC_INFO << "Got XSPF playlist!" << fileUrls;
bool error = false; bool error = false;
QStringList urls = fileUrls.split( QRegExp( "\n" ), QString::SkipEmptyParts ); QStringList urls = fileUrls.split( QRegExp( "\n" ), QString::SkipEmptyParts );
@@ -488,13 +486,13 @@ DropJob::handleXspfs( const QString& fileUrls )
if ( xspfFile.exists() ) if ( xspfFile.exists() )
{ {
l = new XSPFLoader( dropAction() == Create, this ); l = new XSPFLoader( dropAction() == Create, this );
tDebug( LOGINFO ) << "Loading local xspf " << xspfFile.fileName(); tDebug( LOGINFO ) << "Loading local XSPF" << xspfFile.fileName();
l->load( xspfFile ); l->load( xspfFile );
} }
else if ( QUrl( url ).isValid() ) else if ( QUrl( url ).isValid() )
{ {
l = new XSPFLoader( dropAction() == Create, this ); l = new XSPFLoader( dropAction() == Create, this );
tDebug( LOGINFO ) << "Loading remote xspf " << url; tDebug( LOGINFO ) << "Loading remote XSPF" << url;
l->load( QUrl( url ) ); l->load( QUrl( url ) );
} }
else else
@@ -505,7 +503,7 @@ DropJob::handleXspfs( const QString& fileUrls )
if ( dropAction() == Append && !error && l ) if ( dropAction() == Append && !error && l )
{ {
qDebug() << Q_FUNC_INFO << "Trying to append xspf"; qDebug() << Q_FUNC_INFO << "Trying to append XSPF";
connect( l, SIGNAL( tracks( QList<Tomahawk::query_ptr> ) ), this, SLOT( onTracksAdded( QList< Tomahawk::query_ptr > ) ) ); connect( l, SIGNAL( tracks( QList<Tomahawk::query_ptr> ) ), this, SLOT( onTracksAdded( QList< Tomahawk::query_ptr > ) ) );
} }

View File

@@ -52,6 +52,10 @@ ShortenedLinkParser::handlesUrl( const QString& url )
url.contains( "bit.ly" ) || url.contains( "bit.ly" ) ||
url.contains( "j.mp" ) || url.contains( "j.mp" ) ||
url.contains( "spoti.fi" ) || url.contains( "spoti.fi" ) ||
url.contains( "ow.ly" ) ||
url.contains( "fb.me" ) ||
url.contains( "itun.es" ) ||
url.contains( "tinyurl.com" ) ||
url.contains( "rd.io" ) ); url.contains( "rd.io" ) );
} }