mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-14 10:05:32 +02:00
Sort by rank if possible
This commit is contained in:
committed by
Michael Zanetti
parent
c2f3cff83a
commit
c3995a0cc8
@@ -48,15 +48,21 @@ using namespace Tomahawk::InfoSystem;
|
|||||||
bool
|
bool
|
||||||
newReleaseSort( const InfoStringHash& left, const InfoStringHash& right )
|
newReleaseSort( const InfoStringHash& left, const InfoStringHash& right )
|
||||||
{
|
{
|
||||||
if ( !left.contains( "date" ) || !right.contains( "date" ) )
|
if ( left.contains( "rank" ) && right.contains( "rank" ) )
|
||||||
{
|
{
|
||||||
return true;
|
const int lRank = left[ "rank" ].toInt();
|
||||||
|
const int rRank = right[ "rank" ].toInt();
|
||||||
|
return lRank < rRank;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QDate lDate = QDate::fromString( left[ "date" ], "yyyy-MM-dd" );
|
if ( left.contains( "date" ) && right.contains( "date" ) )
|
||||||
const QDate rDate = QDate::fromString( right[ "date" ], "yyyy-MM-dd" );
|
{
|
||||||
|
const QDate lDate = QDate::fromString( left[ "date" ], "yyyy-MM-dd" );
|
||||||
|
const QDate rDate = QDate::fromString( right[ "date" ], "yyyy-MM-dd" );
|
||||||
|
return lDate > rDate;
|
||||||
|
}
|
||||||
|
|
||||||
return lDate > rDate;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -64,7 +70,7 @@ NewReleasesPlugin::NewReleasesPlugin()
|
|||||||
: InfoPlugin()
|
: InfoPlugin()
|
||||||
, m_nrFetchJobs( 0 )
|
, m_nrFetchJobs( 0 )
|
||||||
{
|
{
|
||||||
m_nrVersion = "0.5.1";
|
m_nrVersion = "0.5.2";
|
||||||
m_supportedGetTypes << InfoNewReleaseCapabilities << InfoNewRelease;
|
m_supportedGetTypes << InfoNewReleaseCapabilities << InfoNewRelease;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -685,11 +691,12 @@ NewReleasesPlugin::nrReturned()
|
|||||||
const QString album = albumMap.value( "album" ).toString();
|
const QString album = albumMap.value( "album" ).toString();
|
||||||
const QString artist = albumMap.value( "artist" ).toString();
|
const QString artist = albumMap.value( "artist" ).toString();
|
||||||
const QString date = albumMap.value( "date" ).toString();
|
const QString date = albumMap.value( "date" ).toString();
|
||||||
|
const QString rank = albumMap.value( "rank" ).toString();
|
||||||
Tomahawk::InfoSystem::InfoStringHash pair;
|
Tomahawk::InfoSystem::InfoStringHash pair;
|
||||||
pair[ "artist" ] = artist;
|
pair[ "artist" ] = artist;
|
||||||
pair[ "album" ] = album;
|
pair[ "album" ] = album;
|
||||||
pair[ "date" ] = date;
|
pair[ "date" ] = date;
|
||||||
|
pair[ "rank" ] = rank;
|
||||||
newreleases.append( pair );
|
newreleases.append( pair );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user