|
|
|
#include <kdebug.h>
|
|
|
|
#include <tdeapplication.h>
|
|
|
|
#include <tdecmdlineargs.h>
|
|
|
|
|
|
|
|
#include "asynchttpsubmittest.h"
|
|
|
|
#include "libkcddb/submit.h"
|
|
|
|
|
|
|
|
AsyncHTTPSubmitTest::AsyncHTTPSubmitTest()
|
|
|
|
: TQObject()
|
|
|
|
{
|
|
|
|
using namespace KCDDB;
|
|
|
|
|
|
|
|
client_ = new Client;
|
|
|
|
client_->config().setSubmitTransport(Submit::HTTP);
|
|
|
|
client_->setBlockingMode( false );
|
|
|
|
|
|
|
|
TrackOffsetList list;
|
|
|
|
|
|
|
|
list
|
|
|
|
<< 150 // First track start.
|
|
|
|
<< 2592
|
|
|
|
<< 35472
|
|
|
|
<< 47891
|
|
|
|
<< 123310
|
|
|
|
<< 150 // Disc start.
|
|
|
|
<< 133125; // Disc end.
|
|
|
|
|
|
|
|
CDInfo cdInfo;
|
|
|
|
|
|
|
|
cdInfo.id = "3606ed05";
|
|
|
|
cdInfo.revision = 4;
|
|
|
|
cdInfo.title = "Bamse och Bronto";
|
|
|
|
cdInfo.artist = "Musiksage";
|
|
|
|
cdInfo.year = 2001;
|
|
|
|
cdInfo.category = "misc";
|
|
|
|
cdInfo.genre = "Barnsaga";
|
|
|
|
cdInfo.extd = TQString::fromUtf8("Berättare: Olof Thunberg");
|
|
|
|
|
|
|
|
TrackInfo info;
|
|
|
|
info.title = "Bamses signaturmelodi";
|
|
|
|
cdInfo.trackInfoList.append(info);
|
|
|
|
info.title = "*";
|
|
|
|
cdInfo.trackInfoList.append(info);
|
|
|
|
info.title = "Brummavisan";
|
|
|
|
cdInfo.trackInfoList.append(info);
|
|
|
|
info.title = "*";
|
|
|
|
cdInfo.trackInfoList.append(info);
|
|
|
|
info.title = TQString::fromUtf8("Jätteödlan Bronto");
|
|
|
|
cdInfo.trackInfoList.append(info);
|
|
|
|
|
|
|
|
connect
|
|
|
|
(
|
|
|
|
client_,
|
|
|
|
TQ_SIGNAL(finished(CDDB::Result)),
|
|
|
|
TQ_SLOT(slotFinished(CDDB::Result))
|
|
|
|
);
|
|
|
|
|
|
|
|
client_->submit(cdInfo, list);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
AsyncHTTPSubmitTest::slotFinished(CDDB::Result r)
|
|
|
|
{
|
|
|
|
kdDebug() << "AsyncHTTPSubmitTest::slotFinished: Got " << KCDDB::CDDB::resultToString(r) << endl;
|
|
|
|
|
|
|
|
kapp->quit();
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char ** argv)
|
|
|
|
{
|
|
|
|
TDECmdLineArgs::init(argc, argv, "libkcddb_test", "", "", "");
|
|
|
|
|
|
|
|
TDEApplication app(false /* No styles */, false /* No GUI */);
|
|
|
|
|
|
|
|
new AsyncHTTPSubmitTest;
|
|
|
|
|
|
|
|
return app.exec();
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "asynchttpsubmittest.moc"
|