コード例 #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
ScrobblerAdapter::announceTrackCorrections( const lastfm::Track &track )
{
    static const lastfm::Track::Corrections orig = lastfm::Track::Original;
    static const lastfm::Track::Corrections correct = lastfm::Track::Corrected;

    QString trackName = i18nc( "%1 is artist, %2 is title", "%1 - %2",
                               track.artist().name(), track.title() );
    QStringList lines;
    lines << i18n( "Last.fm suggests that some tags of track <b>%1</b> should be "
                   "corrected:", trackName );
    QString line;
    line = printCorrected( Meta::valTitle, track.title( orig ), track.title( correct ) );
    if( !line.isEmpty() )
        lines << line;
    line = printCorrected( Meta::valAlbum, track.album( orig ), track.album( correct ) );
    if( !line.isEmpty() )
        lines << line;
    line = printCorrected( Meta::valArtist, track.artist( orig ), track.artist( correct ) );
    if( !line.isEmpty() )
        lines << line;
    line = printCorrected( Meta::valAlbumArtist, track.albumArtist( orig ), track.albumArtist( correct ) );
    if( !line.isEmpty() )
        lines << line;
    Amarok::Components::logger()->longMessage( lines.join( "<br>" ) );
}
コード例 #3
0
bool
ScrobbleService::scrobblableTrack( const lastfm::Track& track ) const
{
    return unicorn::UserSettings().value( "scrobblingOn", true ).toBool()
            && track.extra( "playerId" ) != "spt"
            && !track.artist().isNull()
            && ( unicorn::UserSettings().value( "podcasts", true ).toBool() || !track.isPodcast() )
            && !track.isVideo();
}
コード例 #4
0
ファイル: song.cpp プロジェクト: ConfusedGiant/Clementine
void Song::InitFromLastFM(const lastfm::Track& track) {
  d->valid_ = true;
  d->filetype_ = Type_Stream;

  d->title_ = track.title();
  d->album_ = track.album();
  d->artist_ = track.artist();
  d->track_ = track.trackNumber();

  set_length_nanosec(track.duration() * kNsecPerSec);
}
コード例 #5
0
void
TrackWidget::update( const lastfm::Track& track )
{
    // we're getting an update from a track fetched from user.getRecentTracks
    MutableTrack mt( m_track );
    mt.setScrobbleStatus( Track::Submitted ); // it's definitely been scrobbled
    mt.setLoved( track.isLoved() ); // make sure the love state is consistent with Last.fm
}
コード例 #6
0
ファイル: mainwindow.cpp プロジェクト: eartle/PresentRadio
void MainWindow::onTrackSpooled(const lastfm::Track& track)
{
    setWindowTitle(m_radio.station().rql());

    ui->trackProgress->setMinimum(0);
    ui->trackProgress->setMaximum(track.duration());

    ui->album->setText(track.album());
    ui->artist->setText(track.artist());
    ui->title->setText(track.title());

    m_trackGetInfoReply = track.getInfo();
    connect(m_trackGetInfoReply, SIGNAL(finished()), SLOT(onGetInfoFinished()));

    // send the now playing and cache the track so it can be submitted later
    m_scrobSocket->start(track);
}
コード例 #7
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);
	}
コード例 #8
0
void
TrackWidget::setTrack( lastfm::Track& track )
{
    disconnect( m_track.signalProxy(), 0, this, 0 );

    m_track = track;

    connect( m_track.signalProxy(), SIGNAL(loveToggled(bool)), SLOT(onLoveToggled(bool)) );
    connect( m_track.signalProxy(), SIGNAL(scrobbleStatusChanged(short)), SLOT(onScrobbleStatusChanged()));
    connect( m_track.signalProxy(), SIGNAL(corrected(QString)), SLOT(onCorrected(QString)));

    m_movie->stop();
    ui->equaliser->hide();

    setTrackDetails();

    ui->albumArt->setPixmap( QPixmap( ":/meta_album_no_art.png" ) );
    ui->albumArt->setHref( track.www() );

    m_triedFetchAlbumArt = false;
    fetchAlbumArt();
}
コード例 #9
0
uint qHash(const lastfm::Track& track) {
  return qHash(track.title()) ^
         qHash(track.artist().name()) ^
         qHash(track.album().title());
}