Esempio n. 1
0
void
AsyncMusicBrainzTest::slotFinished(Result r)
{
    m_result = r;
    qDebug() << ": Got " << KCDDB::resultToString(r);

    CDInfoList l = client_->lookupResponse();

    qDebug() << ": Item count: " <<  l.count();

    QVERIFY(l.count() > 0);
    m_info = l.first();

    m_eventLoop.quit();
}
Esempio n. 2
0
void MusicBrainzTestFullDate::testLookup()
{
  using namespace KCDDB;

#ifndef HAVE_MUSICBRAINZ5
  QSKIP("This test requires libmusicbrainz", SkipAll);
#endif

  Client c;
  c.config().setCacheLookupEnabled(false);
  c.config().setFreedbLookupEnabled(false);
  c.config().setMusicBrainzLookupEnabled(true);

  TrackOffsetList list;

  list <<
    150 <<
    11837 <<
    20687 <<
    29120 <<
    35557 <<
    50087 <<
    58550 <<
    72575 <<
    81887 <<
    95745 <<
    104340 <<
    115425 <<
    124285 <<
    132317 <<
    142692 <<
    160272 <<
    169325 <<
    181377 <<
    194482 <<
    205747 <<
    216492 <<
    229507 <<
    242715 <<
    252112 <<
    274965 <<
    285820 <<
    308957 <<
    322362 <<
    338662 <<
    350172 <<
    356692;

  Result r = c.lookup(list);

  QVERIFY(r == Success);

  qDebug() << "Client::lookup gave : " << resultToString(r);

  CDInfoList response = c.lookupResponse();

  qDebug() << "Client::lookup returned : " << response.count() << " entries"
    << endl;

  QVERIFY(response.count() > 0);

  // See http://musicbrainz.org/release/04319e80-0948-4e89-8180-7cf6f17fc77a for changes
  CDInfo i(response.first());
  QCOMPARE(i.numberOfTracks(),30);

  QCOMPARE(i.get(Artist).toString(),QString::fromUtf8("Troublemakers"));
  QCOMPARE(i.get(Title).toString(),QString::fromUtf8("30"));
  // genre not really supported for musicbrainz
  QCOMPARE(i.get(Genre).toString(),QString());
  QCOMPARE(i.get(Year).toInt(),2011);
  QCOMPARE(i.track(0).get(Title).toString(),QString::fromUtf8("30"));
  QCOMPARE(i.track(1).get(Title).toString(),QString::fromUtf8("Staden Göteborg"));
  QCOMPARE(i.track(2).get(Title).toString(),QString::fromUtf8("Lilla Blå"));
  QCOMPARE(i.track(3).get(Title).toString(),QString::fromUtf8("Kleptoman"));
  QCOMPARE(i.track(4).get(Title).toString(),QString::fromUtf8("Grogg å parabol"));
  QCOMPARE(i.track(5).get(Title).toString(),QString::fromUtf8("Majorna brinner"));
  QCOMPARE(i.track(6).get(Title).toString(),QString::fromUtf8("Utan hjärta stannar Sverige"));
  QCOMPARE(i.track(7).get(Title).toString(),QString::fromUtf8("Dom e efter mig"));
  QCOMPARE(i.track(8).get(Title).toString(),QString::fromUtf8("Mammas flickor"));
  QCOMPARE(i.track(9).get(Title).toString(),QString::fromUtf8("Handgranat"));
  QCOMPARE(i.track(10).get(Title).toString(),QString::fromUtf8("Stenar o blod"));
  QCOMPARE(i.track(11).get(Title).toString(),QString::fromUtf8("Enkel Berlin"));
  QCOMPARE(i.track(12).get(Title).toString(),QString::fromUtf8("Dom ljuger"));
  QCOMPARE(i.track(13).get(Title).toString(),QString::fromUtf8("Jobba"));
  QCOMPARE(i.track(14).get(Title).toString(),QString::fromUtf8("Varför lyser inga stjärnor"));
  QCOMPARE(i.track(15).get(Title).toString(),QString::fromUtf8("Partytrash"));
  QCOMPARE(i.track(16).get(Title).toString(),QString::fromUtf8("Förstod ingenting"));
  QCOMPARE(i.track(17).get(Title).toString(),QString::fromUtf8("Bara om min älskade väntar"));
  QCOMPARE(i.track(18).get(Title).toString(),QString::fromUtf8("Lillebror"));
  QCOMPARE(i.track(19).get(Title).toString(),QString::fromUtf8("Skandaler"));
  QCOMPARE(i.track(20).get(Title).toString(),QString::fromUtf8("Hjältarna skålar i blod"));
  QCOMPARE(i.track(21).get(Title).toString(),QString::fromUtf8("Bomber o granater"));
  QCOMPARE(i.track(22).get(Title).toString(),QString::fromUtf8("Vill du bli miljonär"));
  QCOMPARE(i.track(23).get(Title).toString(),QString::fromUtf8("Stjärnorna kvittar det lika"));
  QCOMPARE(i.track(24).get(Title).toString(),QString::fromUtf8("Naken"));
  QCOMPARE(i.track(25).get(Title).toString(),QString::fromUtf8("Månen lyser klar"));
  QCOMPARE(i.track(26).get(Title).toString(),QString::fromUtf8("Vild o vacker"));
  QCOMPARE(i.track(27).get(Title).toString(),QString::fromUtf8("Jag fryser"));
  QCOMPARE(i.track(28).get(Title).toString(),QString::fromUtf8("Ein zwei polizei"));
  QCOMPARE(i.track(29).get(Title).toString(),QString::fromUtf8("Jävla idiot"));
  for (int j=0; j < 30; j++)
    QCOMPARE(i.track(j).get(Artist).toString(),QString::fromUtf8("Troublemakers"));
  // comments not supported in a simple way
  for (int j=0; j < 19; j++)
    QCOMPARE(i.track(j).get(Comment).toString(),QString());

  // Make sure it's the same when loaded from the cache again
  c.config().setCacheLookupEnabled(true);
  c.config().setFreedbLookupEnabled(false);
  c.config().setMusicBrainzLookupEnabled(false);

  c.lookup(list);

  response = c.lookupResponse();
  QVERIFY(response.count() > 0);

  CDInfo cacheInfo(response.first());
  QCOMPARE(i.get(Artist).toString(),cacheInfo.get(Artist).toString());
  QCOMPARE(i.get(Title).toString(),cacheInfo.get(Title).toString());
  QCOMPARE(i.get(Year).toInt(),cacheInfo.get(Year).toInt());
  for (int j=0; j < 19; j++)
  {
    QCOMPARE(i.track(j).get(Title).toString(),cacheInfo.track(j).get(Title).toString());
    QCOMPARE(i.track(j).get(Comment).toString(),cacheInfo.track(j).get(Comment).toString());
  }
}
Esempio n. 3
0
void AsyncMusicBrainzTest::testLookup()
{
    using namespace KCDDB;

#ifndef HAVE_MUSICBRAINZ5
    QSKIP("This test requires libmusicbrainz", SkipAll);
#endif

    client_ = new Client;
    client_->config().setCacheLookupEnabled(false);
    client_->config().setFreedbLookupEnabled(false);
    client_->config().setMusicBrainzLookupEnabled(true);
    client_->setBlockingMode( false );

    connect(client_,SIGNAL(finished(KCDDB::Result)),SLOT(slotFinished(KCDDB::Result)));

    TrackOffsetList list;

    // Various Artists / Definitivt 50 Spänn 10
    list
            << 150
            << 17130
            << 26340
            << 44855
            << 60530
            << 75800
            << 90182
            << 106605
            << 122995
            << 139005
            << 153317
            << 167967
            << 179012
            << 190190
            << 202162
            << 211312
            << 229037
            << 240035;

    client_->lookup(list);

    m_eventLoop.exec(QEventLoop::ExcludeUserInputEvents);

    QVERIFY(m_result == Success);

    // See http://musicbrainz.org/release/dbb3e39a-4bea-4e32-a546-456654f30ca6.html for changes
    QCOMPARE(m_info.numberOfTracks(),17);

    QCOMPARE(m_info.get(Artist).toString(),QString::fromUtf8("Various Artists"));
    QCOMPARE(m_info.get(Title).toString(),QString::fromUtf8("Definitivt 50 spänn 10"));
    // genre not really supported for musicbrainz
    QCOMPARE(m_info.get(Genre).toString(),QString());
    QCOMPARE(m_info.get(Year).toInt(),2001);
    QCOMPARE(m_info.track(0).get(Title).toString(),QString::fromUtf8("Uphill Struggle"));
    QCOMPARE(m_info.track(1).get(Title).toString(),QString::fromUtf8("Vill du bli miljonär?"));
    QCOMPARE(m_info.track(2).get(Title).toString(),QString::fromUtf8("Här är jag"));
    QCOMPARE(m_info.track(3).get(Title).toString(),QString::fromUtf8("Århundradets fest"));
    QCOMPARE(m_info.track(4).get(Title).toString(),QString::fromUtf8("Vem valde mittemellan"));
    QCOMPARE(m_info.track(5).get(Title).toString(),QString::fromUtf8("Hippieambulansen"));
    QCOMPARE(m_info.track(6).get(Title).toString(),QString::fromUtf8("Jonsson"));
    QCOMPARE(m_info.track(7).get(Title).toString(),QString::fromUtf8("Jag lämnar filmen"));
    QCOMPARE(m_info.track(8).get(Title).toString(),QString::fromUtf8("39 Steg"));
    QCOMPARE(m_info.track(9).get(Title).toString(),QString::fromUtf8("Lyckliga land"));
    QCOMPARE(m_info.track(10).get(Title).toString(),QString::fromUtf8("Helpless"));
    QCOMPARE(m_info.track(11).get(Title).toString(),QString::fromUtf8("Tunna skivor"));
    QCOMPARE(m_info.track(12).get(Title).toString(),QString::fromUtf8("God läskeblask"));
    QCOMPARE(m_info.track(13).get(Title).toString(),QString::fromUtf8("Hur snygg é du då?"));
    QCOMPARE(m_info.track(14).get(Title).toString(),QString::fromUtf8("Självupptagen"));
    QCOMPARE(m_info.track(15).get(Title).toString(),QString::fromUtf8("Sound Is Compressed; Words Rebel and Hiss"));
    QCOMPARE(m_info.track(16).get(Title).toString(),QString::fromUtf8("Vi är på väg"));
    QCOMPARE(m_info.track(0).get(Artist).toString(),QString::fromUtf8("Adhesive"));
    QCOMPARE(m_info.track(1).get(Artist).toString(),QString::fromUtf8("Troublemakers"));
    QCOMPARE(m_info.track(2).get(Artist).toString(),QString::fromUtf8("Mimikry"));
    QCOMPARE(m_info.track(3).get(Artist).toString(),QString::fromUtf8("Lundberg & Dellamorte"));
    QCOMPARE(m_info.track(4).get(Artist).toString(),QString::fromUtf8("Charta 77"));
    QCOMPARE(m_info.track(5).get(Artist).toString(),QString::fromUtf8("UBBA"));
    QCOMPARE(m_info.track(6).get(Artist).toString(),QString::fromUtf8("Coca Carola"));
    QCOMPARE(m_info.track(7).get(Artist).toString(),QString::fromUtf8("Spoiler"));
    QCOMPARE(m_info.track(8).get(Artist).toString(),QString::fromUtf8("Strebers"));
    QCOMPARE(m_info.track(9).get(Artist).toString(),QString::fromUtf8("Iguana Party"));
    QCOMPARE(m_info.track(10).get(Artist).toString(),QString::fromUtf8("Stoned"));
    QCOMPARE(m_info.track(11).get(Artist).toString(),QString::fromUtf8("Per Bertil Birgers orkester"));
    QCOMPARE(m_info.track(12).get(Artist).toString(),QString::fromUtf8("Slutstation Tjernobyl"));
    QCOMPARE(m_info.track(13).get(Artist).toString(),QString::fromUtf8("SBD"));
    QCOMPARE(m_info.track(14).get(Artist).toString(),QString::fromUtf8("Skumdum"));
    QCOMPARE(m_info.track(15).get(Artist).toString(),QString::fromUtf8("Text"));
    QCOMPARE(m_info.track(16).get(Artist).toString(),QString::fromUtf8("Ohlson Har Semester Production"));
    // comments not supported in a simple way
    for (int j=0; j < 17; j++)
        QCOMPARE(m_info.track(j).get(Comment).toString(),QString());

    // Make sure it's the same when loaded from the cache again
    client_->config().setCacheLookupEnabled(true);
    client_->config().setFreedbLookupEnabled(false);
    client_->config().setMusicBrainzLookupEnabled(false);
    client_->setBlockingMode(true);

    client_->lookup(list);

    CDInfoList response = client_->lookupResponse();
    QVERIFY(response.count() > 0);

    CDInfo cacheInfo(response.first());
    QCOMPARE(m_info.get(Artist).toString(),cacheInfo.get(Artist).toString());
    QCOMPARE(m_info.get(Title).toString(),cacheInfo.get(Title).toString());
    QCOMPARE(m_info.get(Year).toInt(),cacheInfo.get(Year).toInt());
    for (int j=0; j < 17; j++)
    {
        QCOMPARE(m_info.track(j).get(Title).toString(),cacheInfo.track(j).get(Title).toString());
        QCOMPARE(m_info.track(j).get(Comment).toString(),cacheInfo.track(j).get(Comment).toString());
    }
}
void MusicBrainzTestSeveralDiscs::testLookup()
{
  using namespace KCDDB;

#ifndef HAVE_MUSICBRAINZ5
  QSKIP("This test requires libmusicbrainz", SkipAll);
#endif

  Client c;
  c.config().setCacheLookupEnabled(false);
  c.config().setFreedbLookupEnabled(false);
  c.config().setMusicBrainzLookupEnabled(true);

  TrackOffsetList list;

  list <<
    150 <<
    17272 <<
    36395 <<
    47954 <<
    63638 <<
    77928 <<
    95029 <<
    112094 <<
    130540 <<
    145938 <<
    160463 <<
    180364 <<
    195549 <<
    203821 <<
    222410 <<
    230367 <<
    249241 <<
    273944 <<
    287584 <<
    309904 <<
    325124;

  Result r = c.lookup(list);

  QVERIFY(r == Success);

  kDebug() << "Client::lookup gave : " << resultToString(r);

  CDInfoList response = c.lookupResponse();

  kDebug() << "Client::lookup returned : " << response.count() << " entries"
    << endl;

  QVERIFY(response.count() > 0);

  // See http://musicbrainz.org/release/4e0655b5-22fc-496e-9c14-2ee1a6027b45 for changes (disc 2)
  CDInfo i(response.first());
  QCOMPARE(i.numberOfTracks(),20);

  QCOMPARE(i.get(Artist).toString(),QString("Billy Bragg"));
  QCOMPARE(i.get(Title).toString(),QString("Must I Paint You a Picture? The Essential Billy Bragg (disc 2)"));
  // genre not really supported for musicbrainz
  QCOMPARE(i.get(Genre).toString(),QString());
  QCOMPARE(i.get(Year).toInt(),2003);
  QCOMPARE(i.track(0).get(Title).toString(),QString("Sexuality"));
  QCOMPARE(i.track(1).get(Title).toString(),QString("Cindy of 1000 Lives"));
  QCOMPARE(i.track(2).get(Title).toString(),QString("Moving the Goalposts"));
  QCOMPARE(i.track(3).get(Title).toString(),QString("Tank Park Salute"));
  QCOMPARE(i.track(4).get(Title).toString(),QString("You Woke Up My Neighbourhood"));
  QCOMPARE(i.track(5).get(Title).toString(),QString("Accident Waiting to Happen (Red Stars version)"));
  QCOMPARE(i.track(6).get(Title).toString(),QString("Sulk"));
  QCOMPARE(i.track(7).get(Title).toString(),QString("Upfield"));
  QCOMPARE(i.track(8).get(Title).toString(),QString("The Fourteenth of February"));
  QCOMPARE(i.track(9).get(Title).toString(),QString("Brickbat"));
  QCOMPARE(i.track(10).get(Title).toString(),QString("The Space Race Is Over"));
  QCOMPARE(i.track(11).get(Title).toString(),QString("The Boy Done Good"));
  QCOMPARE(i.track(12).get(Title).toString(),QString("Ingrid Bergman"));
  QCOMPARE(i.track(13).get(Title).toString(),QString("Way Over Yonder in the Minor Key"));
  QCOMPARE(i.track(14).get(Title).toString(),QString("My Flying Saucer"));
  QCOMPARE(i.track(15).get(Title).toString(),QString("All You Fascists Bound to Lose (Blokes version)"));
  QCOMPARE(i.track(16).get(Title).toString(),QString("NPWA"));
  QCOMPARE(i.track(17).get(Title).toString(),QString("St. Monday"));
  QCOMPARE(i.track(18).get(Title).toString(),QString("Somedays I See the Point"));
  QCOMPARE(i.track(19).get(Title).toString(),QString("Take Down the Union Jack (Band version)"));
  for (int j=0; j < 12; j++)
    QCOMPARE(i.track(j).get(Artist).toString(),QString("Billy Bragg"));
  for (int j=12; j < 15; j++)
    QCOMPARE(i.track(j).get(Artist).toString(),QString("Billy Bragg & Wilco"));
  for (int j=15; j < 20; j++)
    QCOMPARE(i.track(j).get(Artist).toString(),QString("Billy Bragg and The Blokes"));
  // comments not supported in a simple way
  for (int j=0; j < 19; j++)
    QCOMPARE(i.track(j).get(Comment).toString(),QString());

  // Make sure it's the same when loaded from the cache again
  c.config().setCacheLookupEnabled(true);
  c.config().setFreedbLookupEnabled(false);
  c.config().setMusicBrainzLookupEnabled(false);

  c.lookup(list);

  response = c.lookupResponse();
  QVERIFY(response.count() > 0);

  CDInfo cacheInfo(response.first());
  QCOMPARE(i.get(Artist).toString(),cacheInfo.get(Artist).toString());
  QCOMPARE(i.get(Title).toString(),cacheInfo.get(Title).toString());
  QCOMPARE(i.get(Year).toInt(),cacheInfo.get(Year).toInt());
  for (int j=0; j < 19; j++)
  {
    QCOMPARE(i.track(j).get(Title).toString(),cacheInfo.track(j).get(Title).toString());
    QCOMPARE(i.track(j).get(Comment).toString(),cacheInfo.track(j).get(Comment).toString());
  }
}