summaryrefslogtreecommitdiffstats
path: root/libkcddb/test/synchttplookuptest.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commite2de64d6f1beb9e492daf5b886e19933c1fa41dd (patch)
tree9047cf9e6b5c43878d5bf82660adae77ceee097a /libkcddb/test/synchttplookuptest.cpp
downloadtdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.tar.gz
tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkcddb/test/synchttplookuptest.cpp')
-rw-r--r--libkcddb/test/synchttplookuptest.cpp84
1 files changed, 84 insertions, 0 deletions
diff --git a/libkcddb/test/synchttplookuptest.cpp b/libkcddb/test/synchttplookuptest.cpp
new file mode 100644
index 00000000..8bc05c18
--- /dev/null
+++ b/libkcddb/test/synchttplookuptest.cpp
@@ -0,0 +1,84 @@
+#include <kapplication.h>
+#include <kcmdlineargs.h>
+#include <kdebug.h>
+
+#include "libkcddb/client.h"
+#include "libkcddb/cache.h"
+#include "libkcddb/lookup.h"
+
+ int
+main(int argc, char ** argv)
+{
+ KCmdLineArgs::init(argc, argv, "libkcddb_test", "", "", "");
+
+ KApplication app(false /* No styles */);
+
+ using namespace KCDDB;
+
+ Client c;
+ c.config().setHostname("freedb.freedb.org");
+ c.config().setPort(80);
+ c.config().setCachePolicy(Cache::Ignore);
+ c.config().setLookupTransport(Lookup::HTTP);
+
+
+ TrackOffsetList list;
+
+ // a1107d0a - Kruder & Dorfmeister - The K&D Sessions - Disc One.
+// list
+// << 150 // First track start.
+// << 29462
+// << 66983
+// << 96785
+// << 135628
+// << 168676
+// << 194147
+// << 222158
+// << 247076
+// << 278203 // Last track start.
+// << 10 // Disc start.
+// << 316732; // Disc end.
+ list
+ << 150
+ << 106965
+ << 127220
+ << 151925
+ << 176085
+ << 5
+ << 234500;
+
+ kdDebug() << "Stuff to send to server:" << endl;
+
+ kdDebug()
+ << CDDB::trackOffsetListToId(list)
+ << " "
+ //<< trackOffsetListToString(list)
+ << endl;
+
+ CDDB::Result r = c.lookup(list);
+
+ kdDebug() << "Client::lookup gave : " << CDDB::resultToString(r) << endl;
+
+ CDInfoList response = c.lookupResponse();
+
+ kdDebug() << "Client::lookup returned : " << response.count() << " entries"
+ << endl;
+
+ CDInfoList::ConstIterator it;
+
+ for (it = response.begin(); it != response.end(); ++it)
+ {
+ CDInfo i(*it);
+
+ kdDebug() << "Disc title: " << i.title << endl;
+ kdDebug() << "Total tracks: " << i.trackInfoList.count() << endl;
+ kdDebug() << "Disc revision: `" << i.revision << "'" << endl;
+ }
+
+ CDInfo i( c.bestLookupResponse() );
+
+ kdDebug() << "Best CDInfo had title: " << i.title << endl;
+ kdDebug() << "and revision: " << i.revision << endl;
+
+ return 0;
+}