summaryrefslogtreecommitdiffstats
path: root/src/fetch/imdbfetcher.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-12-16 09:57:51 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-12-16 09:57:51 -0600
commit2781e27b871150395a5a82e221684108641002b2 (patch)
tree57f4d7c01a48faef1a840fbe0de8f4ec1e5f606f /src/fetch/imdbfetcher.cpp
parent031454e56009d576589c28757f6c6fcf4884095e (diff)
downloadtellico-2781e27b871150395a5a82e221684108641002b2.tar.gz
tellico-2781e27b871150395a5a82e221684108641002b2.zip
Revert "Rename a number of old tq methods that are no longer tq specific"
This reverts commit 031454e56009d576589c28757f6c6fcf4884095e.
Diffstat (limited to 'src/fetch/imdbfetcher.cpp')
-rw-r--r--src/fetch/imdbfetcher.cpp236
1 files changed, 118 insertions, 118 deletions
diff --git a/src/fetch/imdbfetcher.cpp b/src/fetch/imdbfetcher.cpp
index 2ddbc10..682ae1f 100644
--- a/src/fetch/imdbfetcher.cpp
+++ b/src/fetch/imdbfetcher.cpp
@@ -36,7 +36,7 @@
#include <tqlabel.h>
#include <tqlistbox.h>
#include <tqwhatsthis.h>
-#include <layout.h>
+#include <tqlayout.h>
#include <tqcheckbox.h>
#include <tqvgroupbox.h>
@@ -45,7 +45,7 @@
namespace {
static const char* IMDB_SERVER = "akas.imdb.com";
static const uint IMDB_MAX_RESULTS = 20;
- static const TQString sep = TQString::fromLatin1("; ");
+ static const TQString sep = TQString::tqfromLatin1("; ");
}
using Tellico::Fetch::IMDBFetcher;
@@ -58,24 +58,24 @@ TQRegExp* IMDBFetcher::s_titleRx = 0;
// static
void IMDBFetcher::initRegExps() {
- s_tagRx = new TQRegExp(TQString::fromLatin1("<.*>"));
+ s_tagRx = new TQRegExp(TQString::tqfromLatin1("<.*>"));
s_tagRx->setMinimal(true);
- s_anchorRx = new TQRegExp(TQString::fromLatin1("<a\\s+[^>]*href\\s*=\\s*\"([^\"]*)\"[^<]*>([^<]*)</a>"), false);
+ s_anchorRx = new TQRegExp(TQString::tqfromLatin1("<a\\s+[^>]*href\\s*=\\s*\"([^\"]*)\"[^<]*>([^<]*)</a>"), false);
s_anchorRx->setMinimal(true);
- s_anchorTitleRx = new TQRegExp(TQString::fromLatin1("<a\\s+[^>]*href\\s*=\\s*\"([^\"]*/title/[^\"]*)\"[^<]*>([^<]*)</a>"), false);
+ s_anchorTitleRx = new TQRegExp(TQString::tqfromLatin1("<a\\s+[^>]*href\\s*=\\s*\"([^\"]*/title/[^\"]*)\"[^<]*>([^<]*)</a>"), false);
s_anchorTitleRx->setMinimal(true);
- s_anchorNameRx = new TQRegExp(TQString::fromLatin1("<a\\s+[^>]*href\\s*=\\s*\"([^\"]*/name/[^\"]*)\"[^<]*>([^<]*)</a>"), false);
+ s_anchorNameRx = new TQRegExp(TQString::tqfromLatin1("<a\\s+[^>]*href\\s*=\\s*\"([^\"]*/name/[^\"]*)\"[^<]*>([^<]*)</a>"), false);
s_anchorNameRx->setMinimal(true);
- s_titleRx = new TQRegExp(TQString::fromLatin1("<title>(.*)</title>"), false);
+ s_titleRx = new TQRegExp(TQString::tqfromLatin1("<title>(.*)</title>"), false);
s_titleRx->setMinimal(true);
}
IMDBFetcher::IMDBFetcher(TQObject* parent_, const char* name_) : Fetcher(parent_, name_),
- m_job(0), m_started(false), m_fetchImages(true), m_host(TQString::fromLatin1(IMDB_SERVER)),
+ m_job(0), m_started(false), m_fetchImages(true), m_host(TQString::tqfromLatin1(IMDB_SERVER)),
m_limit(IMDB_MAX_RESULTS), m_countOffset(0) {
if(!s_tagRx) {
initRegExps();
@@ -130,25 +130,25 @@ void IMDBFetcher::search(FetchKey key_, const TQString& value_) {
#ifdef IMDB_TEST
if(m_key == Title) {
- m_url = KURL::fromPathOrURL(TQString::fromLatin1("/home/robby/imdb-title.html"));
+ m_url = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/imdb-title.html"));
m_redirected = false;
} else {
- m_url = KURL::fromPathOrURL(TQString::fromLatin1("/home/robby/imdb-name.html"));
+ m_url = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/imdb-name.html"));
m_redirected = true;
}
#else
m_url = KURL();
- m_url.setProtocol(TQString::fromLatin1("http"));
- m_url.setHost(m_host.isEmpty() ? TQString::fromLatin1(IMDB_SERVER) : m_host);
- m_url.setPath(TQString::fromLatin1("/find"));
+ m_url.setProtocol(TQString::tqfromLatin1("http"));
+ m_url.setHost(m_host.isEmpty() ? TQString::tqfromLatin1(IMDB_SERVER) : m_host);
+ m_url.setPath(TQString::tqfromLatin1("/find"));
switch(key_) {
case Title:
- m_url.addQueryItem(TQString::fromLatin1("s"), TQString::fromLatin1("tt"));
+ m_url.addQueryItem(TQString::tqfromLatin1("s"), TQString::tqfromLatin1("tt"));
break;
case Person:
- m_url.addQueryItem(TQString::fromLatin1("s"), TQString::fromLatin1("nm"));
+ m_url.addQueryItem(TQString::tqfromLatin1("s"), TQString::tqfromLatin1("nm"));
break;
default:
@@ -159,7 +159,7 @@ void IMDBFetcher::search(FetchKey key_, const TQString& value_) {
// as far as I can tell, the url encoding should always be iso-8859-1
// not utf-8
- m_url.addQueryItem(TQString::fromLatin1("q"), value_, 4 /* iso-8859-1 */);
+ m_url.addQueryItem(TQString::tqfromLatin1("q"), value_, 4 /* iso-8859-1 */);
// myDebug() << "IMDBFetcher::search() url = " << m_url << endl;
#endif
@@ -282,9 +282,9 @@ void IMDBFetcher::parseMultipleTitleResults() {
// IMDb can return three title lists, popular, exact, and partial
// the popular titles are in the first table, after the "Popular Results" text
- int pos_popular = output.find(TQString::fromLatin1("Popular Titles"), 0, false);
- int pos_exact = output.find(TQString::fromLatin1("Exact Matches"), TQMAX(pos_popular, 0), false);
- int pos_partial = output.find(TQString::fromLatin1("Partial Matches"), TQMAX(pos_exact, 0), false);
+ int pos_popular = output.find(TQString::tqfromLatin1("Popular Titles"), 0, false);
+ int pos_exact = output.find(TQString::tqfromLatin1("Exact Matches"), TQMAX(pos_popular, 0), false);
+ int pos_partial = output.find(TQString::tqfromLatin1("Partial Matches"), TQMAX(pos_exact, 0), false);
int end_popular = pos_exact; // keep track of where to end
if(end_popular == -1) {
end_popular = pos_partial == -1 ? output.length() : pos_partial;
@@ -336,7 +336,7 @@ void IMDBFetcher::parseTitleBlock(const TQString& str_) {
}
// myDebug() << "IMDBFetcher::parseTitleBlock() - " << m_currentTitleBlock << endl;
- TQRegExp akaRx(TQString::fromLatin1("aka (.*)(</li>|<br)"), false);
+ TQRegExp akaRx(TQString::tqfromLatin1("aka (.*)(</li>|<br)"), false);
akaRx.setMinimal(true);
m_hasMoreResults = false;
@@ -364,7 +364,7 @@ void IMDBFetcher::parseTitleBlock(const TQString& str_) {
TQString text = str_.mid(start, end-start);
pPos = text.find('(');
if(pPos > -1) {
- int pNewLine = text.find(TQString::fromLatin1("<br"));
+ int pNewLine = text.find(TQString::tqfromLatin1("<br"));
if(pNewLine == -1 || pPos < pNewLine) {
int pPos2 = text.find(')', pPos);
desc = text.mid(pPos+1, pPos2-pPos-1);
@@ -382,7 +382,7 @@ void IMDBFetcher::parseTitleBlock(const TQString& str_) {
// limit to 50 chars
desc += TQChar(' ') + akaRx.cap(1).stripWhiteSpace().remove(*s_tagRx);
if(desc.length() > 50) {
- desc = desc.left(50) + TQString::fromLatin1("...");
+ desc = desc.left(50) + TQString::tqfromLatin1("...");
}
}
@@ -425,7 +425,7 @@ void IMDBFetcher::parseSingleNameResult() {
return;
}
- TQRegExp tvRegExp(TQString::fromLatin1("TV\\sEpisode"), false);
+ TQRegExp tvRegExp(TQString::tqfromLatin1("TV\\sEpisode"), false);
int len = 0;
int count = 0;
@@ -441,7 +441,7 @@ void IMDBFetcher::parseSingleNameResult() {
desc = cap2.mid(pPos);
} else {
// look until the next <a
- int aPos = output.find(TQString::fromLatin1("<a"), pos+len, false);
+ int aPos = output.find(TQString::tqfromLatin1("<a"), pos+len, false);
if(aPos == -1) {
aPos = output.length();
}
@@ -451,7 +451,7 @@ void IMDBFetcher::parseSingleNameResult() {
}
pPos = tmp.find('(');
if(pPos > -1) {
- int pNewLine = tmp.find(TQString::fromLatin1("<br"));
+ int pNewLine = tmp.find(TQString::tqfromLatin1("<br"));
if(pNewLine == -1 || pPos < pNewLine) {
int pEnd = tmp.find(')', pPos+1);
desc = tmp.mid(pPos+1, pEnd-pPos-1).remove(*s_tagRx);
@@ -501,17 +501,17 @@ void IMDBFetcher::parseMultipleNameResults() {
// the exact results are in the first table after the "exact results" text
TQString output = Tellico::decodeHTML(TQString(m_data));
- int pos = output.find(TQString::fromLatin1("Popular Results"), 0, false);
+ int pos = output.find(TQString::tqfromLatin1("Popular Results"), 0, false);
if(pos == -1) {
- pos = output.find(TQString::fromLatin1("Exact Matches"), 0, false);
+ pos = output.find(TQString::tqfromLatin1("Exact Matches"), 0, false);
}
// find beginning of partial matches
- int end = output.find(TQString::fromLatin1("Other Results"), TQMAX(pos, 0), false);
+ int end = output.find(TQString::tqfromLatin1("Other Results"), TQMAX(pos, 0), false);
if(end == -1) {
- end = output.find(TQString::fromLatin1("Partial Matches"), TQMAX(pos, 0), false);
+ end = output.find(TQString::tqfromLatin1("Partial Matches"), TQMAX(pos, 0), false);
if(end == -1) {
- end = output.find(TQString::fromLatin1("Approx Matches"), TQMAX(pos, 0), false);
+ end = output.find(TQString::tqfromLatin1("Approx Matches"), TQMAX(pos, 0), false);
if(end == -1) {
end = output.length();
}
@@ -538,7 +538,7 @@ void IMDBFetcher::parseMultipleNameResults() {
}
nameMap.insert(s, nameMap[s] + 1);
// check for duplicate names
- s += TQString::fromLatin1("(%1) ").arg(nameMap[s]);
+ s += TQString::tqfromLatin1("(%1) ").tqarg(nameMap[s]);
} else {
nameMap.insert(s, 1);
}
@@ -561,7 +561,7 @@ void IMDBFetcher::parseMultipleNameResults() {
}
nameMap.insert(s, nameMap[s] + 1);
// check for duplicate names
- s += TQString::fromLatin1(" (%1)").arg(nameMap[s]);
+ s += TQString::tqfromLatin1(" (%1)").tqarg(nameMap[s]);
} else {
nameMap.insert(s, 1);
}
@@ -641,7 +641,7 @@ Tellico::Data::EntryPtr IMDBFetcher::fetchEntry(uint uid_) {
} else {
// now it's sychronous
#ifdef IMDB_TEST
- KURL u = KURL::fromPathOrURL(TQString::fromLatin1("/home/robby/imdb-title-result.html"));
+ KURL u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/imdb-title-result.html"));
results = Tellico::decodeHTML(FileHandler::readTextFile(u));
#else
// be quiet about failure
@@ -675,8 +675,8 @@ Tellico::Data::EntryPtr IMDBFetcher::parseEntry(const TQString& str_) {
doAlsoKnownAs(str_, entry);
doPlot(str_, entry, m_url);
doLists(str_, entry);
- doPerson(str_, entry, TQString::fromLatin1("Director"), TQString::fromLatin1("director"));
- doPerson(str_, entry, TQString::fromLatin1("Writer"), TQString::fromLatin1("writer"));
+ doPerson(str_, entry, TQString::tqfromLatin1("Director"), TQString::tqfromLatin1("director"));
+ doPerson(str_, entry, TQString::tqfromLatin1("Writer"), TQString::tqfromLatin1("writer"));
doRating(str_, entry);
doCast(str_, entry, m_url);
if(m_fetchImages) {
@@ -684,7 +684,7 @@ Tellico::Data::EntryPtr IMDBFetcher::parseEntry(const TQString& str_) {
doCover(str_, entry, m_url);
}
- const TQString imdb = TQString::fromLatin1("imdb");
+ const TQString imdb = TQString::tqfromLatin1("imdb");
if(!coll->hasField(imdb) && m_fields.findIndex(imdb) > -1) {
Data::FieldPtr field = new Data::Field(imdb, i18n("IMDB Link"), Data::Field::URL);
field->setCategory(i18n("General"));
@@ -707,7 +707,7 @@ void IMDBFetcher::doTitle(const TQString& str_, Data::EntryPtr entry_) {
if(title.startsWith(TQChar('"')) && title.endsWith(TQChar('"'))) {
title = title.mid(1, title.length()-2);
}
- entry_->setField(TQString::fromLatin1("title"), title);
+ entry_->setField(TQString::tqfromLatin1("title"), title);
// remove parenthesis
uint pPos2 = pPos+1;
while(pPos2 < cap1.length() && cap1[pPos2].isDigit()) {
@@ -715,62 +715,62 @@ void IMDBFetcher::doTitle(const TQString& str_, Data::EntryPtr entry_) {
}
TQString year = cap1.mid(pPos+1, pPos2-pPos-1);
if(!year.isEmpty()) {
- entry_->setField(TQString::fromLatin1("year"), year);
+ entry_->setField(TQString::tqfromLatin1("year"), year);
}
}
}
void IMDBFetcher::doRunningTime(const TQString& str_, Data::EntryPtr entry_) {
// running time
- TQRegExp runtimeRx(TQString::fromLatin1("runtime:.*(\\d+)\\s+min"), false);
+ TQRegExp runtimeRx(TQString::tqfromLatin1("runtime:.*(\\d+)\\s+min"), false);
runtimeRx.setMinimal(true);
if(runtimeRx.search(str_) > -1) {
// myDebug() << "running-time = " << runtimeRx.cap(1) << endl;
- entry_->setField(TQString::fromLatin1("running-time"), runtimeRx.cap(1));
+ entry_->setField(TQString::tqfromLatin1("running-time"), runtimeRx.cap(1));
}
}
void IMDBFetcher::doAspectRatio(const TQString& str_, Data::EntryPtr entry_) {
- TQRegExp rx(TQString::fromLatin1("aspect ratio:.*([\\d\\.]+\\s*:\\s*[\\d\\.]+)"), false);
+ TQRegExp rx(TQString::tqfromLatin1("aspect ratio:.*([\\d\\.]+\\s*:\\s*[\\d\\.]+)"), false);
rx.setMinimal(true);
if(rx.search(str_) > -1) {
// myDebug() << "aspect ratio = " << rx.cap(1) << endl;
- entry_->setField(TQString::fromLatin1("aspect-ratio"), rx.cap(1).stripWhiteSpace());
+ entry_->setField(TQString::tqfromLatin1("aspect-ratio"), rx.cap(1).stripWhiteSpace());
}
}
void IMDBFetcher::doAlsoKnownAs(const TQString& str_, Data::EntryPtr entry_) {
- if(m_fields.findIndex(TQString::fromLatin1("alttitle")) == -1) {
+ if(m_fields.findIndex(TQString::tqfromLatin1("alttitle")) == -1) {
return;
}
// match until next b tag
-// TQRegExp akaRx(TQString::fromLatin1("also known as(.*)<b(?:\\s.*)?>"));
- TQRegExp akaRx(TQString::fromLatin1("also known as(.*)<(b[>\\s/]|div)"), false);
+// TQRegExp akaRx(TQString::tqfromLatin1("also known as(.*)<b(?:\\s.*)?>"));
+ TQRegExp akaRx(TQString::tqfromLatin1("also known as(.*)<(b[>\\s/]|div)"), false);
akaRx.setMinimal(true);
if(akaRx.search(str_) > -1 && !akaRx.cap(1).isEmpty()) {
- Data::FieldPtr f = entry_->collection()->fieldByName(TQString::fromLatin1("alttitle"));
+ Data::FieldPtr f = entry_->collection()->fieldByName(TQString::tqfromLatin1("alttitle"));
if(!f) {
- f = new Data::Field(TQString::fromLatin1("alttitle"), i18n("Alternative Titles"), Data::Field::Table);
+ f = new Data::Field(TQString::tqfromLatin1("alttitle"), i18n("Alternative Titles"), Data::Field::Table);
f->setFormatFlag(Data::Field::FormatTitle);
entry_->collection()->addField(f);
}
// split by <br>, remembering it could become valid xhtml!
- TQRegExp brRx(TQString::fromLatin1("<br[\\s/]*>"), false);
+ TQRegExp brRx(TQString::tqfromLatin1("<br[\\s/]*>"), false);
brRx.setMinimal(true);
TQStringList list = TQStringList::split(brRx, akaRx.cap(1));
// lang could be included with [fr]
-// const TQRegExp parRx(TQString::fromLatin1("\\(.+\\)"));
- const TQRegExp brackRx(TQString::fromLatin1("\\[\\w+\\]"));
+// const TQRegExp parRx(TQString::tqfromLatin1("\\(.+\\)"));
+ const TQRegExp brackRx(TQString::tqfromLatin1("\\[\\w+\\]"));
TQStringList values;
for(TQStringList::Iterator it = list.begin(); it != list.end(); ++it) {
TQString s = *it;
// sometimes, the word "more" gets linked to the releaseinfo page, check that
- if(s.find(TQString::fromLatin1("releaseinfo")) > -1) {
+ if(s.find(TQString::tqfromLatin1("releaseinfo")) > -1) {
continue;
}
s.remove(*s_tagRx);
@@ -786,7 +786,7 @@ void IMDBFetcher::doAlsoKnownAs(const TQString& str_, Data::EntryPtr entry_) {
}
}
if(!values.isEmpty()) {
- entry_->setField(TQString::fromLatin1("alttitle"), values.join(sep));
+ entry_->setField(TQString::tqfromLatin1("alttitle"), values.join(sep));
}
}
}
@@ -799,36 +799,36 @@ void IMDBFetcher::doPlot(const TQString& str_, Data::EntryPtr entry_, const KURL
TQString thisPlot;
// match until next opening tag
- TQRegExp plotRx(TQString::fromLatin1("plot (?:outline|summary):(.*)<[^/].*</"), false);
+ TQRegExp plotRx(TQString::tqfromLatin1("plot (?:outline|summary):(.*)<[^/].*</"), false);
plotRx.setMinimal(true);
- TQRegExp plotURLRx(TQString::fromLatin1("<a\\s+.*href\\s*=\\s*\".*/title/.*/plotsummary\""), false);
+ TQRegExp plotURLRx(TQString::tqfromLatin1("<a\\s+.*href\\s*=\\s*\".*/title/.*/plotsummary\""), false);
plotURLRx.setMinimal(true);
if(plotRx.search(str_) > -1) {
thisPlot = plotRx.cap(1);
thisPlot.remove(*s_tagRx); // remove HTML tags
- entry_->setField(TQString::fromLatin1("plot"), thisPlot);
+ entry_->setField(TQString::tqfromLatin1("plot"), thisPlot);
// if thisPlot ends with (more) or contains
// a url that ends with plotsummary, then we'll grab it, otherwise not
- if(plotRx.cap(0).endsWith(TQString::fromLatin1("(more)</")) || plotURLRx.search(plotRx.cap(0)) > -1) {
+ if(plotRx.cap(0).endsWith(TQString::tqfromLatin1("(more)</")) || plotURLRx.search(plotRx.cap(0)) > -1) {
useUserSummary = true;
}
}
if(useUserSummary) {
- TQRegExp idRx(TQString::fromLatin1("title/(tt\\d+)"));
+ TQRegExp idRx(TQString::tqfromLatin1("title/(tt\\d+)"));
idRx.search(baseURL_.path());
KURL plotURL = baseURL_;
- plotURL.setPath(TQString::fromLatin1("/title/") + idRx.cap(1) + TQString::fromLatin1("/plotsummary"));
+ plotURL.setPath(TQString::tqfromLatin1("/title/") + idRx.cap(1) + TQString::tqfromLatin1("/plotsummary"));
// be quiet about failure
TQString plotPage = FileHandler::readTextFile(plotURL, true);
if(!plotPage.isEmpty()) {
- TQRegExp plotRx(TQString::fromLatin1("<p\\s+class\\s*=\\s*\"plotpar\">(.*)</p"));
+ TQRegExp plotRx(TQString::tqfromLatin1("<p\\s+class\\s*=\\s*\"plotpar\">(.*)</p"));
plotRx.setMinimal(true);
if(plotRx.search(plotPage) > -1) {
TQString userPlot = plotRx.cap(1);
userPlot.remove(*s_tagRx); // remove HTML tags
- entry_->setField(TQString::fromLatin1("plot"), Tellico::decodeHTML(userPlot));
+ entry_->setField(TQString::tqfromLatin1("plot"), Tellico::decodeHTML(userPlot));
}
}
}
@@ -836,11 +836,11 @@ void IMDBFetcher::doPlot(const TQString& str_, Data::EntryPtr entry_, const KURL
void IMDBFetcher::doPerson(const TQString& str_, Data::EntryPtr entry_,
const TQString& imdbHeader_, const TQString& fieldName_) {
- TQRegExp br2Rx(TQString::fromLatin1("<br[\\s/]*>\\s*<br[\\s/]*>"), false);
+ TQRegExp br2Rx(TQString::tqfromLatin1("<br[\\s/]*>\\s*<br[\\s/]*>"), false);
br2Rx.setMinimal(true);
- TQRegExp divRx(TQString::fromLatin1("<[/]*div"), false);
+ TQRegExp divRx(TQString::tqfromLatin1("<[/]*div"), false);
divRx.setMinimal(true);
- TQString name = TQString::fromLatin1("/name/");
+ TQString name = TQString::tqfromLatin1("/name/");
StringSet people;
for(int pos = str_.find(imdbHeader_); pos > 0; pos = str_.find(imdbHeader_, pos)) {
@@ -866,13 +866,13 @@ void IMDBFetcher::doCast(const TQString& str_, Data::EntryPtr entry_, const KURL
// that's usually a lot of people
// but since it can be in billing order, the main actors might not
// be in the short list
- TQRegExp idRx(TQString::fromLatin1("title/(tt\\d+)"));
+ TQRegExp idRx(TQString::tqfromLatin1("title/(tt\\d+)"));
idRx.search(baseURL_.path());
#ifdef IMDB_TEST
- KURL castURL = KURL::fromPathOrURL(TQString::fromLatin1("/home/robby/imdb-title-fullcredits.html"));
+ KURL castURL = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/imdb-title-fullcredits.html"));
#else
KURL castURL = baseURL_;
- castURL.setPath(TQString::fromLatin1("/title/") + idRx.cap(1) + TQString::fromLatin1("/fullcredits"));
+ castURL.setPath(TQString::tqfromLatin1("/title/") + idRx.cap(1) + TQString::tqfromLatin1("/fullcredits"));
#endif
// be quiet about failure and be sure to translate entities
TQString castPage = Tellico::decodeHTML(FileHandler::readTextFile(castURL, true));
@@ -883,28 +883,28 @@ void IMDBFetcher::doCast(const TQString& str_, Data::EntryPtr entry_, const KURL
if(castText.isEmpty()) {
// fall back to short list
castText = str_;
- pos = castText.find(TQString::fromLatin1("cast overview"), 0, false);
+ pos = castText.find(TQString::tqfromLatin1("cast overview"), 0, false);
if(pos == -1) {
- pos = castText.find(TQString::fromLatin1("credited cast"), 0, false);
+ pos = castText.find(TQString::tqfromLatin1("credited cast"), 0, false);
}
} else {
// first look for anchor
- TQRegExp castAnchorRx(TQString::fromLatin1("<a\\s+name\\s*=\\s*\"cast\""), false);
+ TQRegExp castAnchorRx(TQString::tqfromLatin1("<a\\s+name\\s*=\\s*\"cast\""), false);
pos = castText.find(castAnchorRx);
if(pos < 0) {
- TQRegExp tableClassRx(TQString::fromLatin1("<table\\s+class\\s*=\\s*\"cast\""), false);
+ TQRegExp tableClassRx(TQString::tqfromLatin1("<table\\s+class\\s*=\\s*\"cast\""), false);
pos = castText.find(tableClassRx);
if(pos < 0) {
// fragile, the word "cast" appears in the title, but need to find
// the one right above the actual cast table
// for TV shows, there's a link on the sidebar for "episodes case"
// so need to not match that one
- pos = castText.find(TQString::fromLatin1("cast</"), 0, false);
+ pos = castText.find(TQString::tqfromLatin1("cast</"), 0, false);
if(pos > 9) {
// back up 9 places
- if(castText.mid(pos-9, 9).startsWith(TQString::fromLatin1("episodes"))) {
+ if(castText.mid(pos-9, 9).startsWith(TQString::tqfromLatin1("episodes"))) {
// find next cast list
- pos = castText.find(TQString::fromLatin1("cast</"), pos+6, false);
+ pos = castText.find(TQString::tqfromLatin1("cast</"), pos+6, false);
}
}
}
@@ -915,13 +915,13 @@ void IMDBFetcher::doCast(const TQString& str_, Data::EntryPtr entry_, const KURL
return;
}
- const TQString name = TQString::fromLatin1("/name/");
- TQRegExp tdRx(TQString::fromLatin1("<td[^>]*>(.*)</td>"), false);
+ const TQString name = TQString::tqfromLatin1("/name/");
+ TQRegExp tdRx(TQString::tqfromLatin1("<td[^>]*>(.*)</td>"), false);
tdRx.setMinimal(true);
TQStringList cast;
// loop until closing table tag
- const int endPos = castText.find(TQString::fromLatin1("</table"), pos, false);
+ const int endPos = castText.find(TQString::tqfromLatin1("</table"), pos, false);
pos = s_anchorRx->search(castText, pos+1);
while(pos > -1 && pos < endPos && static_cast<int>(cast.count()) < m_numCast) {
if(s_anchorRx->cap(1).find(name) > -1) {
@@ -930,7 +930,7 @@ void IMDBFetcher::doCast(const TQString& str_, Data::EntryPtr entry_, const KURL
const int pos2 = tdRx.search(castText, pos);
if(pos2 > -1 && tdRx.search(castText, pos2+1) > -1) {
cast += s_anchorRx->cap(2).stripWhiteSpace()
- + TQString::fromLatin1("::") + tdRx.cap(1).simplifyWhiteSpace().remove(*s_tagRx);
+ + TQString::tqfromLatin1("::") + tdRx.cap(1).simplifyWhiteSpace().remove(*s_tagRx);
} else {
cast += s_anchorRx->cap(2).stripWhiteSpace();
}
@@ -939,46 +939,46 @@ void IMDBFetcher::doCast(const TQString& str_, Data::EntryPtr entry_, const KURL
}
if(!cast.isEmpty()) {
- entry_->setField(TQString::fromLatin1("cast"), cast.join(sep));
+ entry_->setField(TQString::tqfromLatin1("cast"), cast.join(sep));
}
}
void IMDBFetcher::doRating(const TQString& str_, Data::EntryPtr entry_) {
- if(m_fields.findIndex(TQString::fromLatin1("imdb-rating")) == -1) {
+ if(m_fields.findIndex(TQString::tqfromLatin1("imdb-rating")) == -1) {
return;
}
// don't add a colon, since there's a <br> at the end
// some of the imdb images use /10.gif in their path, so check for space or bracket
- TQRegExp rx(TQString::fromLatin1("[>\\s](\\d+.?\\d*)/10[<//s]"), false);
+ TQRegExp rx(TQString::tqfromLatin1("[>\\s](\\d+.?\\d*)/10[<//s]"), false);
rx.setMinimal(true);
if(rx.search(str_) > -1 && !rx.cap(1).isEmpty()) {
- Data::FieldPtr f = entry_->collection()->fieldByName(TQString::fromLatin1("imdb-rating"));
+ Data::FieldPtr f = entry_->collection()->fieldByName(TQString::tqfromLatin1("imdb-rating"));
if(!f) {
- f = new Data::Field(TQString::fromLatin1("imdb-rating"), i18n("IMDB Rating"), Data::Field::Rating);
+ f = new Data::Field(TQString::tqfromLatin1("imdb-rating"), i18n("IMDB Rating"), Data::Field::Rating);
f->setCategory(i18n("General"));
- f->setProperty(TQString::fromLatin1("maximum"), TQString::fromLatin1("10"));
+ f->setProperty(TQString::tqfromLatin1("maximum"), TQString::tqfromLatin1("10"));
entry_->collection()->addField(f);
}
bool ok;
float value = rx.cap(1).toFloat(&ok);
if(ok) {
- entry_->setField(TQString::fromLatin1("imdb-rating"), TQString::number(value));
+ entry_->setField(TQString::tqfromLatin1("imdb-rating"), TQString::number(value));
}
}
}
void IMDBFetcher::doCover(const TQString& str_, Data::EntryPtr entry_, const KURL& baseURL_) {
// cover is the img with the "cover" alt text
- TQRegExp imgRx(TQString::fromLatin1("<img\\s+[^>]*src\\s*=\\s*\"([^\"]*)\"[^>]*>"), false);
+ TQRegExp imgRx(TQString::tqfromLatin1("<img\\s+[^>]*src\\s*=\\s*\"([^\"]*)\"[^>]*>"), false);
imgRx.setMinimal(true);
- TQRegExp posterRx(TQString::fromLatin1("<a\\s+[^>]*name\\s*=\\s*\"poster\"[^>]*>(.*)</a>"), false);
+ TQRegExp posterRx(TQString::tqfromLatin1("<a\\s+[^>]*name\\s*=\\s*\"poster\"[^>]*>(.*)</a>"), false);
posterRx.setMinimal(true);
- const TQString cover = TQString::fromLatin1("cover");
+ const TQString cover = TQString::tqfromLatin1("cover");
int pos = posterRx.search(str_);
while(pos > -1) {
@@ -1011,14 +1011,14 @@ void IMDBFetcher::doCover(const TQString& str_, Data::EntryPtr entry_, const KUR
// end up reparsing whole string, but it's not really that slow
// loook at every anchor tag in the string
void IMDBFetcher::doLists(const TQString& str_, Data::EntryPtr entry_) {
- const TQString genre = TQString::fromLatin1("/Genres/");
- const TQString country = TQString::fromLatin1("/Countries/");
- const TQString lang = TQString::fromLatin1("/Languages/");
- const TQString colorInfo = TQString::fromLatin1("color-info");
- const TQString cert = TQString::fromLatin1("certificates=");
- const TQString soundMix = TQString::fromLatin1("sound-mix=");
- const TQString year = TQString::fromLatin1("/Years/");
- const TQString company = TQString::fromLatin1("/company/");
+ const TQString genre = TQString::tqfromLatin1("/Genres/");
+ const TQString country = TQString::tqfromLatin1("/Countries/");
+ const TQString lang = TQString::tqfromLatin1("/Languages/");
+ const TQString colorInfo = TQString::tqfromLatin1("color-info");
+ const TQString cert = TQString::tqfromLatin1("certificates=");
+ const TQString soundMix = TQString::tqfromLatin1("sound-mix=");
+ const TQString year = TQString::tqfromLatin1("/Years/");
+ const TQString company = TQString::tqfromLatin1("/company/");
// IIMdb also has links with the word "sections" in them, remove that
// for genres and nationalities
@@ -1027,19 +1027,19 @@ void IMDBFetcher::doLists(const TQString& str_, Data::EntryPtr entry_) {
for(int pos = s_anchorRx->search(str_); pos > -1; pos = s_anchorRx->search(str_, pos+1)) {
const TQString cap1 = s_anchorRx->cap(1);
if(cap1.find(genre) > -1) {
- if(s_anchorRx->cap(2).find(TQString::fromLatin1(" section"), 0, false) == -1) {
+ if(s_anchorRx->cap(2).find(TQString::tqfromLatin1(" section"), 0, false) == -1) {
genres += s_anchorRx->cap(2).stripWhiteSpace();
}
} else if(cap1.find(country) > -1) {
- if(s_anchorRx->cap(2).find(TQString::fromLatin1(" section"), 0, false) == -1) {
+ if(s_anchorRx->cap(2).find(TQString::tqfromLatin1(" section"), 0, false) == -1) {
countries += s_anchorRx->cap(2).stripWhiteSpace();
}
} else if(cap1.find(lang) > -1) {
langs += s_anchorRx->cap(2).stripWhiteSpace();
} else if(cap1.find(colorInfo) > -1) {
// change "black and white" to "black & white"
- entry_->setField(TQString::fromLatin1("color"),
- s_anchorRx->cap(2).replace(TQString::fromLatin1("and"), TQChar('&')).stripWhiteSpace());
+ entry_->setField(TQString::tqfromLatin1("color"),
+ s_anchorRx->cap(2).replace(TQString::tqfromLatin1("and"), TQChar('&')).stripWhiteSpace());
} else if(cap1.find(cert) > -1) {
certs += s_anchorRx->cap(2).stripWhiteSpace();
} else if(cap1.find(soundMix) > -1) {
@@ -1047,34 +1047,34 @@ void IMDBFetcher::doLists(const TQString& str_, Data::EntryPtr entry_) {
} else if(cap1.find(company) > -1) {
studios += s_anchorRx->cap(2).stripWhiteSpace();
// if year field wasn't set before, do it now
- } else if(entry_->field(TQString::fromLatin1("year")).isEmpty() && cap1.find(year) > -1) {
- entry_->setField(TQString::fromLatin1("year"), s_anchorRx->cap(2).stripWhiteSpace());
+ } else if(entry_->field(TQString::tqfromLatin1("year")).isEmpty() && cap1.find(year) > -1) {
+ entry_->setField(TQString::tqfromLatin1("year"), s_anchorRx->cap(2).stripWhiteSpace());
}
}
- entry_->setField(TQString::fromLatin1("genre"), genres.join(sep));
- entry_->setField(TQString::fromLatin1("nationality"), countries.join(sep));
- entry_->setField(TQString::fromLatin1("language"), langs.join(sep));
- entry_->setField(TQString::fromLatin1("audio-track"), tracks.join(sep));
- entry_->setField(TQString::fromLatin1("studio"), studios.join(sep));
+ entry_->setField(TQString::tqfromLatin1("genre"), genres.join(sep));
+ entry_->setField(TQString::tqfromLatin1("nationality"), countries.join(sep));
+ entry_->setField(TQString::tqfromLatin1("language"), langs.join(sep));
+ entry_->setField(TQString::tqfromLatin1("audio-track"), tracks.join(sep));
+ entry_->setField(TQString::tqfromLatin1("studio"), studios.join(sep));
if(!certs.isEmpty()) {
// first try to set default certification
- const TQStringList& certsAllowed = entry_->collection()->fieldByName(TQString::fromLatin1("certification"))->allowed();
+ const TQStringList& certsAllowed = entry_->collection()->fieldByName(TQString::tqfromLatin1("certification"))->allowed();
for(TQStringList::ConstIterator it = certs.begin(); it != certs.end(); ++it) {
TQString country = (*it).section(':', 0, 0);
TQString cert = (*it).section(':', 1, 1);
if(cert == Latin1Literal("Unrated")) {
cert = TQChar('U');
}
- cert += TQString::fromLatin1(" (") + country + ')';
+ cert += TQString::tqfromLatin1(" (") + country + ')';
if(certsAllowed.findIndex(cert) > -1) {
- entry_->setField(TQString::fromLatin1("certification"), cert);
+ entry_->setField(TQString::tqfromLatin1("certification"), cert);
break;
}
}
// now add new field for all certifications
- const TQString allc = TQString::fromLatin1("allcertification");
+ const TQString allc = TQString::tqfromLatin1("allcertification");
if(m_fields.findIndex(allc) > -1) {
Data::FieldPtr f = entry_->collection()->fieldByName(allc);
if(!f) {
@@ -1082,7 +1082,7 @@ void IMDBFetcher::doLists(const TQString& str_, Data::EntryPtr entry_) {
f->setFlags(Data::Field::AllowGrouped);
entry_->collection()->addField(f);
}
- entry_->setField(TQString::fromLatin1("allcertification"), certs.join(sep));
+ entry_->setField(TQString::tqfromLatin1("allcertification"), certs.join(sep));
}
}
}
@@ -1091,8 +1091,8 @@ void IMDBFetcher::updateEntry(Data::EntryPtr entry_) {
// myLog() << "IMDBFetcher::updateEntry() - " << entry_->title() << endl;
// only take first 5
m_limit = 5;
- TQString t = entry_->field(TQString::fromLatin1("title"));
- KURL link = entry_->field(TQString::fromLatin1("imdb"));
+ TQString t = entry_->field(TQString::tqfromLatin1("title"));
+ KURL link = entry_->field(TQString::tqfromLatin1("imdb"));
if(!link.isEmpty() && link.isValid()) {
// check if we want a different host
if(link.host() != m_host) {
@@ -1173,7 +1173,7 @@ IMDBFetcher::ConfigWidget::ConfigWidget(TQWidget* parent_, const IMDBFetcher* fe
m_numCast->setValue(fetcher_->m_numCast);
m_fetchImageCheck->setChecked(fetcher_->m_fetchImages);
} else { //defaults
- m_hostEdit->setText(TQString::fromLatin1(IMDB_SERVER));
+ m_hostEdit->setText(TQString::tqfromLatin1(IMDB_SERVER));
m_numCast->setValue(10);
m_fetchImageCheck->setChecked(true);
}
@@ -1198,10 +1198,10 @@ TQString IMDBFetcher::ConfigWidget::preferredName() const {
//static
Tellico::StringMap IMDBFetcher::customFields() {
StringMap map;
- map[TQString::fromLatin1("imdb")] = i18n("IMDB Link");
- map[TQString::fromLatin1("imdb-rating")] = i18n("IMDB Rating");
- map[TQString::fromLatin1("alttitle")] = i18n("Alternative Titles");
- map[TQString::fromLatin1("allcertification")] = i18n("Certifications");
+ map[TQString::tqfromLatin1("imdb")] = i18n("IMDB Link");
+ map[TQString::tqfromLatin1("imdb-rating")] = i18n("IMDB Rating");
+ map[TQString::tqfromLatin1("alttitle")] = i18n("Alternative Titles");
+ map[TQString::tqfromLatin1("allcertification")] = i18n("Certifications");
return map;
}