2
#include <kapplication.h>
3
#include <kcmdlineargs.h>
5
#include "asynccddblookuptest.h"
7
#include "libkcddb/cache.h"
8
#include "libkcddb/lookup.h"
10
AsyncCDDBLookupTest::AsyncCDDBLookupTest()
13
using namespace KCDDB;
16
client_->config().setHostname("freedb.freedb.org");
17
client_->config().setPort(8880);
18
client_->config().setCachePolicy(Cache::Ignore);
19
client_->config().setLookupTransport(Lookup::CDDBP);
20
client_->setBlockingMode( false );
25
SIGNAL(finished(CDDB::Result)),
26
SLOT(slotFinished(CDDB::Result))
31
// a1107d0a - Kruder & Dorfmeister - The K&D Sessions - Disc One.
33
<< 150 // First track start.
42
<< 278203 // Last track start.
44
<< 316732; // Disc end.
46
client_->lookup(list);
49
AsyncCDDBLookupTest::~AsyncCDDBLookupTest()
55
AsyncCDDBLookupTest::slotFinished(CDDB::Result r)
57
kdDebug() << "AsyncCDDBLookupTest::slotResult: Got " << KCDDB::CDDB::resultToString(r) << endl;
59
CDInfoList l = client_->lookupResponse();
61
kdDebug() << "AsyncCDDBLookupTest::slotResult: Item count: " << l.count() << endl;
63
for (CDInfoList::ConstIterator it(l.begin()); it != l.end(); ++it)
67
kdDebug() << "Disc artist: `" << i.artist << "'" << endl;
68
kdDebug() << "Disc title: `" << i.title << "'" << endl;
69
kdDebug() << "Disc revision: `" << i.revision << "'" << endl;
74
kdDebug() << "---------------------------------------" << endl;
75
kdDebug() << "Showing first item" << endl;
79
kdDebug() << "Disc artist: `" << i.artist << "'" << endl;
80
kdDebug() << "Disc title: `" << i.title << "'" << endl;
81
kdDebug() << "Disc genre: `" << i.genre << "'" << endl;
82
kdDebug() << "Disc year: `" << i.year << "'" << endl;
83
kdDebug() << "Disc length: `" << i.length << "'" << endl;
84
kdDebug() << "Disc id: `" << i.id << "'" << endl;
85
kdDebug() << "Tracks........" << endl;
87
for (TrackInfoList::ConstIterator it(i.trackInfoList.begin()); it != i.trackInfoList.end(); ++it)
89
kdDebug() << " Track: `" << (*it).title << "'" << endl;
91
kdDebug() << "---------------------------------------" << endl;
94
CDInfo i(client_->bestLookupResponse());
96
kdDebug() << "Best CDInfo had title: " << i.title << endl;
97
kdDebug() << "and revision: " << i.revision << endl;
102
int main(int argc, char ** argv)
104
KCmdLineArgs::init(argc, argv, "libkcddb_test", "", "", "");
106
KApplication app(false /* No styles */, false /* No GUI */);
108
AsyncCDDBLookupTest test;
113
#include "asynccddblookuptest.moc"