Exemple #1
0
//Other constructor
SoundSourceProxy::SoundSourceProxy(TrackPointer pTrack)
        : m_pTrack(pTrack)
                , m_pSecurityToken(
                openSecurityToken(pTrack->getLocation(),
                        pTrack->getSecurityToken()))
                        , m_pSoundSource(initialize(pTrack->getLocation())) {
}
Exemple #2
0
//static
CoverArt CoverArtUtils::guessCoverArt(TrackPointer pTrack) {
    CoverArt art;
    art.info.source = CoverInfo::GUESSED;

    if (pTrack.isNull()) {
        return art;
    }

    const QFileInfo fileInfo(pTrack->getFileInfo());
    art.image = extractEmbeddedCover(fileInfo, pTrack->getSecurityToken());
    if (!art.image.isNull()) {
        // TODO() here we my introduce a duplicate hash code
        art.info.hash = calculateHash(art.image);
        art.info.coverLocation = QString();
        art.info.type = CoverInfo::METADATA;
        qDebug() << "CoverArtUtils::guessCoverArt found metadata art" << art;
        return art;
    }

    QLinkedList<QFileInfo> possibleCovers = findPossibleCoversInFolder(
            fileInfo.absolutePath());
    art = selectCoverArtForTrack(pTrack.data(), possibleCovers);
    if (art.info.type == CoverInfo::FILE) {
        qDebug() << "CoverArtUtils::guessCoverArt found file art" << art;
    } else {
        qDebug() << "CoverArtUtils::guessCoverArt didn't find art" << art;
    }
    return art;
}
Exemple #3
0
void TagFetcher::tagsFetched(int index, const MusicBrainzClient::ResultList& results) {
    if (index >= m_tracks.count()) {
        return;
    }
    // qDebug() << "Tagfetcher got musicbrainz results and now parses them";
    const TrackPointer originalTrack = m_tracks[index];
    QList<TrackPointer> tracksGuessed;
    foreach (const MusicBrainzClient::Result& result, results) {
        TrackPointer track(
                Track::newTemporary(
                        originalTrack->getFileInfo(),
                        originalTrack->getSecurityToken()));
        track->setTitle(result.m_title);
        track->setArtist(result.m_artist);
        track->setAlbum(result.m_album);
        track->setDuration(result.m_duration);
        track->setTrackNumber(QString::number(result.m_track));
        track->setYear(QString::number(result.m_year));
        tracksGuessed << track;
    }