1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-24 09:49:42 +01:00

Add the possibility for JSResolvers to specify that a given URL is checked/valid.

This commit is contained in:
Uwe L. Korn 2013-05-25 19:49:30 +02:00
parent c03c8b8223
commit f733b6126f
4 changed files with 11 additions and 1 deletions

@ -295,7 +295,7 @@ Pipeline::reportResults( QID qid, const QList< result_ptr >& results )
if ( r.isNull() )
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;
else
cleanResults << r;

@ -90,6 +90,7 @@ Result::Result( const QString& url )
, m_modtime( 0 )
, m_score( 0 )
, m_fileId( 0 )
, m_checked( false )
{
connect( Pipeline::instance(), SIGNAL( resolverRemoved( Tomahawk::Resolver* ) ), SLOT( onResolverRemoved( Tomahawk::Resolver* ) ), Qt::QueuedConnection );
}

@ -74,6 +74,12 @@ public:
collection_ptr collection() const;
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 friendlySource() const;
QString purchaseUrl() const { return m_purchaseUrl; }
@ -92,6 +98,7 @@ public:
void setFriendlySource( const QString& s ) { m_friendlySource = s; }
void setPurchaseUrl( const QString& u ) { m_purchaseUrl = 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 setBitrate( unsigned int bitrate ) { m_bitrate = bitrate; }
void setSize( unsigned int size ) { m_size = size; }
@ -133,6 +140,7 @@ private:
QString m_mimetype;
QString m_friendlySource;
bool m_checked;
unsigned int m_bitrate;
unsigned int m_size;
unsigned int m_modtime;

@ -760,6 +760,7 @@ JSResolver::parseResultVariantList( const QVariantList& reslist )
rp->setPurchaseUrl( m.value( "purchaseUrl" ).toString() );
rp->setLinkUrl( m.value( "linkUrl" ).toString() );
rp->setScore( m.value( "score" ).toFloat() );
rp->setChecked( m.value( "checked" ).toBool() );
//FIXME
if ( m.contains( "year" ) )