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

List:       kde-commits
Subject:    [tellico/2.3] src: clean up imdb a.k.a. list
From:       Robby Stephenson <robby () periapsis ! org>
Date:       2013-01-07 5:21:00
Message-ID: 20130107052100.D11BCA6091 () git ! kde ! org
[Download RAW message or body]

Git commit b57a14e0e28de938f08a71fe08ad9352be9ee014 by Robby Stephenson.
Committed on 07/01/2013 at 05:19.
Pushed by rstephenson into branch '2.3'.

clean up imdb a.k.a. list

M  +4    -0    src/fetch/imdbfetcher.cpp
M  +1    -0    src/tests/imdbfetchertest.cpp

http://commits.kde.org/tellico/b57a14e0e28de938f08a71fe08ad9352be9ee014

diff --git a/src/fetch/imdbfetcher.cpp b/src/fetch/imdbfetcher.cpp
index 66cc544..4f75042 100644
--- a/src/fetch/imdbfetcher.cpp
+++ b/src/fetch/imdbfetcher.cpp
@@ -1025,6 +1025,7 @@ void IMDBFetcher::doAlsoKnownAs(const QString& str_, Tellico::Data::EntryPtr ent
     // lang could be included with [fr]
 //    const QRegExp parRx(QLatin1String("\\(.+\\)"));
     const QRegExp brackRx(QLatin1String("\\[\\w+\\]"));
+    const QRegExp dashEndRx(QLatin1String("\\s*-\\s+.+$"));
     QStringList values;
     for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) {
       QString s = *it;
@@ -1034,6 +1035,9 @@ void IMDBFetcher::doAlsoKnownAs(const QString& str_, Tellico::Data::EntryPtr ent
       }
       s.remove(*s_tagRx);
       s.remove(brackRx);
+      // remove country
+      s.remove(dashEndRx);
+      s.remove(QLatin1Char('"'));
       s = s.trimmed();
       // the first value ends up being or starting with the colon after "Also known as"
       // I'm too lazy to figure out a better regexp
diff --git a/src/tests/imdbfetchertest.cpp b/src/tests/imdbfetchertest.cpp
index 1465a2d..30b389e 100644
--- a/src/tests/imdbfetchertest.cpp
+++ b/src/tests/imdbfetchertest.cpp
@@ -190,6 +190,7 @@ void ImdbFetcherTest::testAsterix() {
   QCOMPARE(entry->field("writer"), QString::fromUtf8("René Goscinny; Albert Uderzo"));
   QStringList altTitleList = Tellico::FieldFormat::splitTable(entry->field("alttitle"));
   QVERIFY(altTitleList.contains(QString::fromUtf8("Astérix en los juegos olímpicos")));
+  QVERIFY(altTitleList.contains(QLatin1String("Asterix alle olimpiadi")));
 }
 
 // https://bugs.kde.org/show_bug.cgi?id=249096

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

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