コード例 #1
0
bool
ScrobbleService::isDirExcluded( const lastfm::Track& track )
{
    if ( track.source() == lastfm::Track::LastFmRadio )
        return false;

    QString pathToTest = track.url().toLocalFile();

#ifdef Q_OS_WIN
    pathToTest = pathToTest.toLower();
#endif

    if ( pathToTest.isEmpty() )
        return false;

    unicorn::UserSettings us;
    QStringList exculsionDirs = us.value( "ExclusionDirs" ).toStringList();

    foreach ( QString bannedPath, exculsionDirs )
    {
        bannedPath = QDir( bannedPath ).absolutePath();
#ifdef Q_OS_WIN
        bannedPath = bannedPath.toLower();
#endif

        qDebug() << pathToTest << bannedPath;

        // Try and match start of given path with banned dir
        if ( pathToTest.startsWith( bannedPath ) )
        {
            // Found, this path is from a banned dir
            return true;
        }
    }
コード例 #2
0
	void LastFmRadioStation::EmitTrack (const lastfm::Track& track)
	{
		qDebug () << Q_FUNC_INFO << track.url ();
		const Media::AudioInfo info =
		{
			track.artist (),
			track.album (),
			track.title (),
			QStringList (),
			static_cast<qint32> (track.duration () / 1000),
			0,
			static_cast<qint32> (track.trackNumber ()),
			QVariantMap ()
		};
		emit gotNewStream (track.url (), info);
	}