[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/office/tellico/src
From:       Robby Stephenson <robby () periapsis ! org>
Date:       2010-11-06 19:01:49
Message-ID: 20101106190149.8823FAC89B () svn ! kde ! org
[Download RAW message or body]

SVN commit 1193685 by rstephenson:

tweak freebase

 M  +6 -3      fetch/freebasefetcher.cpp  
 M  +14 -6     tests/freebasefetchertest.cpp  


--- trunk/extragear/office/tellico/src/fetch/freebasefetcher.cpp #1193684:1193685
@@ -479,7 +479,9 @@
           entry->setField(QLatin1String("genre"),         value(resultMap, \
                "genre"));
           entry->setField(QLatin1String("nationality"),   value(resultMap, \
                "country"));
           entry->setField(QLatin1String("keyword"),       value(resultMap, \
                "subjects"));
-          entry->setField(QLatin1String("certification"), value(resultMap, \
"rating")); +          // sometimes the rating comes back with multiple values
+          const QStringList certs = FieldFormat::splitValue(value(resultMap, \
"rating")); +          entry->setField(QLatin1String("certification"), \
                certs.isEmpty() ? QString() : certs.first());
           entry->setField(QLatin1String("year"),          value(resultMap, \
                "initial_release_date").left(4));
           entry->setField(QLatin1String("running-time"),  value(resultMap, \
"runtime", "runtime"));  
@@ -510,7 +512,7 @@
             entry->setField(QLatin1String("artist"), value(resultMap, \
"credited_as"));  }
           entry->setField(QLatin1String("year"),   value(resultMap, \
                "release_date").left(4));
-          entry->setField(QLatin1String("label"),  value(resultMap, "album", \
"label")); +          entry->setField(QLatin1String("label"),  value(resultMap, \
                "label"));
           entry->setField(QLatin1String("genre"),  value(resultMap, "album", \
"genre"));  
           QStringList trackList;
@@ -815,7 +817,7 @@
 
   QVariantMap album_query;
 //  album_query.insert(QLatin1String("type"), QLatin1String("/music/album"));
-  album_query.insert(QLatin1String("label"), QVariantList());
+//  album_query.insert(QLatin1String("label"), QVariantList());
   album_query.insert(QLatin1String("genre"), QVariantList());
   album_query.insert(QLatin1String("optional"), QLatin1String("optional"));
 
@@ -826,6 +828,7 @@
   id_query.insert(QLatin1String("limit"), 1);
   album_query.insert(QLatin1String("/common/topic/image"), id_query);
   album_query.insert(QLatin1String("/common/topic/article"), id_query);
+
   query.insert(QLatin1String("album"), QVariantList() << album_query);
 
   QVariantList queries;
--- trunk/extragear/office/tellico/src/tests/freebasefetchertest.cpp #1193684:1193685
@@ -40,6 +40,8 @@
 #include "../entry.h"
 #include "../images/imagefactory.h"
 
+#include <QDebug>
+
 QTEST_KDEMAIN( FreebaseFetcherTest, GUI )
 
 #define QL1(x) QString::fromLatin1(x)
@@ -222,17 +224,22 @@
   job->start();
   m_loop.exec();
 
-  QVERIFY(!m_results.isEmpty());
+  QVERIFY(m_results.size() > 0);
 
-  Tellico::Data::EntryPtr entry;  // freebase results can be randomly ordered, loop \
until we know we found the one we want +  Tellico::Data::EntryPtr entry;  // freebase \
results can be randomly ordered, loop until wee find the one we want  for(int i = 0; \
                i < m_results.size(); ++i) {
-    entry = m_results.at(i);
-    if(entry->field(QLatin1String("title")) == QLatin1String("The Man From Snowy \
River")) { +    Tellico::Data::EntryPtr test = m_results.at(i);
+    if(test->field(QLatin1String("title")).toLower() == QLatin1String("the man from \
snowy river") && +       test->field(QLatin1String("director")) == \
QLatin1String("George T. Miller")) { +      entry = test;
       break;
+    } else {
+      qDebug() << "skipping" << test->title();
     }
   }
+  QVERIFY(entry);
 
-  QCOMPARE(entry->field(QLatin1String("title")), QLatin1String("The Man From Snowy \
River")); +  QCOMPARE(entry->field(QLatin1String("title")).toLower(), \
QLatin1String("the man from snowy river"));  \
QCOMPARE(entry->field(QLatin1String("director")), QLatin1String("George T. Miller")); \
QCOMPARE(entry->field(QLatin1String("producer")), QLatin1String("Simon Wincer"));  \
QCOMPARE(entry->field(QLatin1String("writer")), QLatin1String("Banjo Paterson")); @@ \
-293,7 +300,8 @@  Tellico::Data::EntryPtr entry = m_results.at(0);
   QCOMPARE(entry->field(QLatin1String("title")), QLatin1String("If I Left the \
Zoo"));  QCOMPARE(entry->field(QLatin1String("artist")), QLatin1String("Jars of \
                Clay"));
-  QCOMPARE(entry->field(QLatin1String("label")), QLatin1String("Essential \
Records")); +// as of Tellico 2.3.1, freebase was updating to musicbrainz data and \
label wasn't working +//  QCOMPARE(entry->field(QLatin1String("label")), \
QLatin1String("Essential Records"));  QCOMPARE(entry->field(QLatin1String("year")), \
QLatin1String("1999"));  QCOMPARE(entry->field(QLatin1String("genre")), \
QLatin1String("Folk rock; Pop music; Christian music"));  \
QVERIFY(!entry->field(QLatin1String("cover")).isEmpty());


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic