コード例 #1
0
ファイル: soundproxy_test.cpp プロジェクト: niveau0/mixxx
TEST_F(SoundSourceProxyTest, readArtist) {
    SoundSourceProxy proxy(
            QDir::currentPath().append("/src/test/id3-test-data/artist.mp3"));
    Mixxx::TrackMetadata trackMetadata;
    EXPECT_EQ(OK, proxy.parseTrackMetadataAndCoverArt(&trackMetadata, NULL));
    EXPECT_EQ("Test Artist", trackMetadata.getArtist());
}
コード例 #2
0
ファイル: soundproxy_test.cpp プロジェクト: tarche/mixxx
TEST_F(SoundSourceProxyTest, readArtist) {
    TrackPointer pTrack(new TrackInfoObject(
            QDir::currentPath().append("/src/test/id3-test-data/artist.mp3")));
    SoundSourceProxy proxy(pTrack);
    Mixxx::TrackMetadata trackMetadata;
    EXPECT_EQ(OK, proxy.parseTrackMetadata(&trackMetadata));
    EXPECT_EQ("Test Artist", trackMetadata.getArtist());
}
コード例 #3
0
ファイル: soundproxy_test.cpp プロジェクト: 22degrees/mixxx
TEST_F(SoundSourceProxyTest, readArtist) {
    TrackPointer pTrack(Track::newTemporary(
            kTestDir.absoluteFilePath("artist.mp3")));
    SoundSourceProxy proxy(pTrack);
    Mixxx::TrackMetadata trackMetadata;
    EXPECT_EQ(OK, proxy.parseTrackMetadata(&trackMetadata));
    EXPECT_EQ("Test Artist", trackMetadata.getArtist());
}
コード例 #4
0
ファイル: soundproxy_test.cpp プロジェクト: niveau0/mixxx
TEST_F(SoundSourceProxyTest, TOAL_TPE2) {
    SoundSourceProxy proxy(
        QDir::currentPath().append("/src/test/id3-test-data/TOAL_TPE2.mp3"));
    Mixxx::TrackMetadata trackMetadata;
    EXPECT_EQ(OK, proxy.parseTrackMetadataAndCoverArt(&trackMetadata, NULL));
    EXPECT_EQ("TITLE2", trackMetadata.getArtist());
    EXPECT_EQ("ARTIST", trackMetadata.getAlbum());
    EXPECT_EQ("TITLE", trackMetadata.getAlbumArtist());
}
コード例 #5
0
ファイル: soundproxy_test.cpp プロジェクト: tarche/mixxx
TEST_F(SoundSourceProxyTest, TOAL_TPE2) {
    TrackPointer pTrack(new TrackInfoObject(
            QDir::currentPath().append("/src/test/id3-test-data/TOAL_TPE2.mp3")));
    SoundSourceProxy proxy(pTrack);
    Mixxx::TrackMetadata trackMetadata;
    EXPECT_EQ(OK, proxy.parseTrackMetadata(&trackMetadata));
    EXPECT_EQ("TITLE2", trackMetadata.getArtist());
    EXPECT_EQ("ARTIST", trackMetadata.getAlbum());
    EXPECT_EQ("TITLE", trackMetadata.getAlbumArtist());
}
コード例 #6
0
ファイル: soundproxy_test.cpp プロジェクト: 22degrees/mixxx
TEST_F(SoundSourceProxyTest, TOAL_TPE2) {
    TrackPointer pTrack(Track::newTemporary(
            kTestDir.absoluteFilePath("TOAL_TPE2.mp3")));
    SoundSourceProxy proxy(pTrack);
    Mixxx::TrackMetadata trackMetadata;
    EXPECT_EQ(OK, proxy.parseTrackMetadata(&trackMetadata));
    EXPECT_EQ("TITLE2", trackMetadata.getArtist());
    EXPECT_EQ("ARTIST", trackMetadata.getAlbum());
    EXPECT_EQ("TITLE", trackMetadata.getAlbumArtist());
}
コード例 #7
0
void SoundSourceProxy::loadTrackMetadataAndCoverArt(
        bool withCoverArt,
        bool reloadFromFile) const {
    DEBUG_ASSERT(!m_pTrack.isNull());

    if (m_pSoundSource.isNull()) {
        // Silently ignore requests for unsupported files
        qDebug() << "Unable to parse file tags without a SoundSource"
                << getUrl();
        return;
    }

    bool parsedFromFile = m_pTrack->getHeaderParsed();
    if (parsedFromFile && !reloadFromFile) {
        qDebug() << "Skip parsing of track metadata from file"
                << getUrl();
        return; // do not reload from file
    }

    // Use the existing trackMetadata as default values. Otherwise
    // existing values in the library will be overwritten with
    // empty values if the corresponding file tags are missing.
    // Depending on the file type some kind of tags might even
    // not be supported at all and those would get lost!
    Mixxx::TrackMetadata trackMetadata;
    m_pTrack->getMetadata(&trackMetadata);
    CoverArt coverArt(m_pTrack->getCoverArt());

    // If parsing of the cover art image should be omitted the
    // 2nd output parameter must be set to nullptr. Cover art
    // is not reloaded from file once the metadata has been parsed!
    QImage* pCoverImg = (withCoverArt && !parsedFromFile) ? &coverArt.image : nullptr;

    // Parse the tags stored in the audio file.
    if (m_pSoundSource->parseTrackMetadataAndCoverArt(&trackMetadata, pCoverImg) == OK) {
        parsedFromFile = true;
    } else {
        qWarning() << "Failed to parse track metadata from file"
                 << getUrl();
        if (parsedFromFile) {
            // Don't overwrite any existing metadata that once has
            // been parsed successfully from file.
            return;
        }
    }

    // If Artist or title fields are blank try to parse them
    // from the file name.
    // TODO(rryan): Should we re-visit this decision?
    if (trackMetadata.getArtist().isEmpty() || trackMetadata.getTitle().isEmpty()) {
        parseMetadataFromFileName(&trackMetadata, m_pTrack->getFileInfo().fileName());
    }

    // Dump the trackMetadata extracted from the file back into the track.
    m_pTrack->setMetadata(trackMetadata);
    m_pTrack->setHeaderParsed(parsedFromFile);
    if (parsedFromFile && (nullptr != pCoverImg) && !pCoverImg->isNull()) {
        CoverArt coverArt;
        coverArt.image = *pCoverImg;
        coverArt.info.hash = CoverArtUtils::calculateHash(
                coverArt.image);
        coverArt.info.coverLocation = QString();
        coverArt.info.type = CoverInfo::METADATA;
        coverArt.info.source = CoverInfo::GUESSED;
        m_pTrack->setCoverArt(coverArt);
    }
}