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

List:       kde-commits
Subject:    extragear/office/tellico
From:       Robby Stephenson <robby () periapsis ! org>
Date:       2011-01-04 6:59:47
Message-ID: 20110104065947.6EB61AC8B0 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1211442 by rstephenson:

Fix parsing bug with IMDb results.

BUG: 262036


 M  +4 -0      ChangeLog  
 M  +5 -2      src/fetch/imdbfetcher.cpp  
 M  +24 -0     src/tests/imdbfetchertest.cpp  
 M  +1 -0      src/tests/imdbfetchertest.h  


--- trunk/extragear/office/tellico/ChangeLog #1211441:1211442
@@ -1,3 +1,7 @@
+2011-01-03  Robby Stephenson  <robby@periapsis.org>
+
+	* Fixed parsing bug with IMDb results (Bug 262036).
+
 2010-12-12  Robby Stephenson  <robby@periapsis.org>
 
 	* Released Tellico 2.3.2.
--- trunk/extragear/office/tellico/src/fetch/imdbfetcher.cpp #1211441:1211442
@@ -294,7 +294,11 @@
   FetchResult* r = new FetchResult(Fetcher::Ptr(this),
                                    pPos == -1 ? cap1 : cap1.left(pPos),
                                    pPos == -1 ? QString() : cap1.mid(pPos));
-  m_matches.insert(r->uid, m_url);
+  // IMDB returns different HTML for single title results and has a query in the url
+  // clear the query so we download the "canonical" page for the title
+  KUrl url(m_url);
+  url.setEncodedQuery(QByteArray());
+  m_matches.insert(r->uid, url);
   emit signalResultFound(r);
 
   m_hasMoreResults = false;
@@ -907,7 +911,6 @@
 
   const int pos1 = str_.indexOf(productionRx);
   if(pos1 == -1) {
-    myDebug() << "no studios found";
     return;
   }
 
--- trunk/extragear/office/tellico/src/tests/imdbfetchertest.cpp #1211441:1211442
@@ -88,6 +88,8 @@
   QStringList castList = Tellico::FieldFormat::splitTable(entry->field("cast"));
   QCOMPARE(castList.at(0), QLatin1String("Tom Burlinson::Jim Craig"));
   QCOMPARE(entry->field("imdb"), \
QLatin1String("http://akas.imdb.com/title/tt0084296/")); +  \
QVERIFY(!entry->field("plot").isEmpty()); +  \
QVERIFY(!entry->field("cover").isEmpty());  }
 
 void ImdbFetcherTest::testAsterix() {
@@ -165,6 +167,28 @@
   QCOMPARE(entry->field("writer"), QLatin1String("John J. Strauss; Ed Decter"));
 }
 
+// https://bugs.kde.org/show_bug.cgi?id=249096
+void ImdbFetcherTest::testOkunen() {
+  Tellico::Fetch::FetchRequest request(Tellico::Data::Collection::Video, \
Tellico::Fetch::Title, "46-okunen no koi"); +  Tellico::Fetch::Fetcher::Ptr \
fetcher(new Tellico::Fetch::IMDBFetcher(this)); +
+  Tellico::Fetch::FetcherJob* job = new Tellico::Fetch::FetcherJob(0, fetcher, \
request); +  job->setMaximumResults(1);
+  connect(job, SIGNAL(result(KJob*)), this, SLOT(slotResult(KJob*)));
+
+  job->start();
+  m_loop.exec();
+
+  QCOMPARE(m_results.size(), 1);
+  Tellico::Data::EntryPtr entry = m_results.at(0);
+
+  QCOMPARE(entry->field("year"), QLatin1String("2006"));
+  QCOMPARE(entry->field("genre"), QLatin1String("Drama"));
+  QCOMPARE(entry->field("director"), QLatin1String("Takashi Miike"));
+  QVERIFY(!entry->field("plot").isEmpty());
+  QVERIFY(!entry->field("cover").isEmpty());
+}
+
 void ImdbFetcherTest::slotResult(KJob* job_) {
   m_results = static_cast<Tellico::Fetch::FetcherJob*>(job_)->entries();
   m_loop.quit();
--- trunk/extragear/office/tellico/src/tests/imdbfetchertest.h #1211441:1211442
@@ -44,6 +44,7 @@
   void testAsterix();
   void testBodyDouble();
   void testMary();
+  void testOkunen();
 
   void slotResult(KJob* job);
 


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

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