mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 03:40:16 +02:00
Add the possibility for JSResolvers to specify that a given URL is checked/valid.
This commit is contained in:
@@ -295,7 +295,7 @@ Pipeline::reportResults( QID qid, const QList< result_ptr >& results )
|
|||||||
if ( r.isNull() )
|
if ( r.isNull() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ( r->url().startsWith( "http" ) && !r->url().startsWith( "http://localhost" ) )
|
if ( !r->checked() && ( r->url().startsWith( "http" ) && !r->url().startsWith( "http://localhost" ) ) )
|
||||||
httpResults << r;
|
httpResults << r;
|
||||||
else
|
else
|
||||||
cleanResults << r;
|
cleanResults << r;
|
||||||
|
@@ -90,6 +90,7 @@ Result::Result( const QString& url )
|
|||||||
, m_modtime( 0 )
|
, m_modtime( 0 )
|
||||||
, m_score( 0 )
|
, m_score( 0 )
|
||||||
, m_fileId( 0 )
|
, m_fileId( 0 )
|
||||||
|
, m_checked( false )
|
||||||
{
|
{
|
||||||
connect( Pipeline::instance(), SIGNAL( resolverRemoved( Tomahawk::Resolver* ) ), SLOT( onResolverRemoved( Tomahawk::Resolver* ) ), Qt::QueuedConnection );
|
connect( Pipeline::instance(), SIGNAL( resolverRemoved( Tomahawk::Resolver* ) ), SLOT( onResolverRemoved( Tomahawk::Resolver* ) ), Qt::QueuedConnection );
|
||||||
}
|
}
|
||||||
|
@@ -74,6 +74,12 @@ public:
|
|||||||
|
|
||||||
collection_ptr collection() const;
|
collection_ptr collection() const;
|
||||||
QString url() const { return m_url; }
|
QString url() const { return m_url; }
|
||||||
|
/**
|
||||||
|
* Has the given url been checked that it is accessible/valid.
|
||||||
|
*
|
||||||
|
* Results marked as true will bypass the ResultUrlChecker.
|
||||||
|
*/
|
||||||
|
bool checked() const { return m_checked; }
|
||||||
QString mimetype() const { return m_mimetype; }
|
QString mimetype() const { return m_mimetype; }
|
||||||
QString friendlySource() const;
|
QString friendlySource() const;
|
||||||
QString purchaseUrl() const { return m_purchaseUrl; }
|
QString purchaseUrl() const { return m_purchaseUrl; }
|
||||||
@@ -92,6 +98,7 @@ public:
|
|||||||
void setFriendlySource( const QString& s ) { m_friendlySource = s; }
|
void setFriendlySource( const QString& s ) { m_friendlySource = s; }
|
||||||
void setPurchaseUrl( const QString& u ) { m_purchaseUrl = u; }
|
void setPurchaseUrl( const QString& u ) { m_purchaseUrl = u; }
|
||||||
void setLinkUrl( const QString& u ) { m_linkUrl = u; }
|
void setLinkUrl( const QString& u ) { m_linkUrl = u; }
|
||||||
|
void setChecked( bool checked ) { m_checked = checked; }
|
||||||
void setMimetype( const QString& mimetype ) { m_mimetype = mimetype; }
|
void setMimetype( const QString& mimetype ) { m_mimetype = mimetype; }
|
||||||
void setBitrate( unsigned int bitrate ) { m_bitrate = bitrate; }
|
void setBitrate( unsigned int bitrate ) { m_bitrate = bitrate; }
|
||||||
void setSize( unsigned int size ) { m_size = size; }
|
void setSize( unsigned int size ) { m_size = size; }
|
||||||
@@ -133,6 +140,7 @@ private:
|
|||||||
QString m_mimetype;
|
QString m_mimetype;
|
||||||
QString m_friendlySource;
|
QString m_friendlySource;
|
||||||
|
|
||||||
|
bool m_checked;
|
||||||
unsigned int m_bitrate;
|
unsigned int m_bitrate;
|
||||||
unsigned int m_size;
|
unsigned int m_size;
|
||||||
unsigned int m_modtime;
|
unsigned int m_modtime;
|
||||||
|
@@ -760,6 +760,7 @@ JSResolver::parseResultVariantList( const QVariantList& reslist )
|
|||||||
rp->setPurchaseUrl( m.value( "purchaseUrl" ).toString() );
|
rp->setPurchaseUrl( m.value( "purchaseUrl" ).toString() );
|
||||||
rp->setLinkUrl( m.value( "linkUrl" ).toString() );
|
rp->setLinkUrl( m.value( "linkUrl" ).toString() );
|
||||||
rp->setScore( m.value( "score" ).toFloat() );
|
rp->setScore( m.value( "score" ).toFloat() );
|
||||||
|
rp->setChecked( m.value( "checked" ).toBool() );
|
||||||
|
|
||||||
//FIXME
|
//FIXME
|
||||||
if ( m.contains( "year" ) )
|
if ( m.contains( "year" ) )
|
||||||
|
Reference in New Issue
Block a user