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

List:       kde-commits
Subject:    extragear/office/tellico/src/fetch
From:       Robby Stephenson <robby () periapsis ! org>
Date:       2010-09-12 3:07:51
Message-ID: 20100912030751.5467BAC887 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1174347 by rstephenson:

allow updating directly form IMDB link

 M  +20 -26    imdbfetcher.cpp  
 M  +1 -1      imdbfetcher.h  


--- trunk/extragear/office/tellico/src/fetch/imdbfetcher.cpp #1174346:1174347
@@ -140,6 +140,9 @@
   m_url.setHost(m_host.isEmpty() ? QLatin1String(IMDB_SERVER) : m_host);
   m_url.setPath(QLatin1String("/find"));
 
+  // as far as I can tell, the url encoding should always be iso-8859-1?
+  m_url.addQueryItem(QLatin1String("q"), request().value);
+
   switch(request().key) {
     case Title:
       m_url.addQueryItem(QLatin1String("s"), QLatin1String("tt"));
@@ -149,15 +152,17 @@
       m_url.addQueryItem(QLatin1String("s"), QLatin1String("nm"));
       break;
 
+    case Raw:
+      m_url = request().value;
+      myDebug() << "using url raw value";
+      break;
+
     default:
-      myWarning() << "FetchKey not supported";
+      myWarning() << "not supported:" << request().key;
       stop();
       return;
   }
 
-  // as far as I can tell, the url encoding should always be iso-8859-1?
-  m_url.addQueryItem(QLatin1String("q"), request().value);
-
 //  myDebug() << "url =" << m_url;
 #endif
 
@@ -251,18 +256,26 @@
   m_job = 0;
 
   // a single result was found if we got redirected
-  if(request().key == Title) {
+  switch(request().key) {
+    case Title:
     if(m_redirected) {
       parseSingleTitleResult();
     } else {
       parseMultipleTitleResults();
     }
-  } else {
+      break;
+
+    case Person:
     if(m_redirected) {
       parseSingleNameResult();
     } else {
       parseMultipleNameResults();
     }
+      break;
+
+    case Raw:
+      parseSingleTitleResult();
+      break;
   }
 }
 
@@ -824,8 +837,6 @@
     if(!values.isEmpty()) {
       entry_->setField(QLatin1String("alttitle"), values.join(FieldFormat::rowDelimiterString()));
     }
-  } else {
-    myDebug() << "No alternative titles found";
   }
 }
 
@@ -1143,28 +1154,11 @@
   KUrl link = entry_->field(QLatin1String("imdb"));
 
   if(!link.isEmpty() && link.isValid()) {
-    myWarning() << "IMDb link searching not implemented";
-    return FetchRequest(Title, t);
-
-    // TODO: fix this
-    // check if we want a different host
     if(link.host() != m_host) {
 //      myLog() << "switching hosts to " << m_host;
       link.setHost(m_host);
     }
-//    request().key = Fetch::Title;
-//    request().value = t;
-    m_started = true;
-    m_text.clear();
-    m_matches.clear();
-    m_url = link;
-    m_redirected = true; // m_redirected is used as a flag later to tell if we get a single result
-    m_job = KIO::storedGet(m_url, KIO::NoReload, KIO::HideProgressInfo);
-    m_job->ui()->setWindow(GUI::Proxy::widget());
-    connect(m_job, SIGNAL(result(KJob*)),
-            SLOT(slotComplete(KJob*)));
-    connect(m_job, SIGNAL(redirection(KIO::Job*, const KUrl&)),
-            SLOT(slotRedirection(KIO::Job*, const KUrl&)));
+    return FetchRequest(Fetch::Raw, link.url());
   }
 
   // optimistically try searching for title and rely on Collection::sameEntry() to figure things out
--- trunk/extragear/office/tellico/src/fetch/imdbfetcher.h #1174346:1174347
@@ -62,7 +62,7 @@
   virtual bool isSearching() const { return m_started; }
   virtual void continueSearch();
   // imdb can search title, person
-  virtual bool canSearch(FetchKey k) const { return k == Title || k == Person; }
+  virtual bool canSearch(FetchKey k) const { return k == Title || k == Person || k == Raw; }
   virtual void stop();
   virtual Data::EntryPtr fetchEntryHook(uint uid);
   virtual Type type() const { return IMDB; }
[prev in list] [next in list] [prev in thread] [next in thread] 

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