summaryrefslogtreecommitdiffstats
path: root/src/fetch/imdbfetcher.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-10 06:08:18 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-10 06:08:18 +0000
commit0254ebaa5e056092461fd585b6851d15faa43035 (patch)
tree2bf41a1c189b92dc1b9ab89e3ce392f8132214c4 /src/fetch/imdbfetcher.cpp
parentfa071926f015f39711632b3fb9fe16004d93d0ec (diff)
downloadtellico-0254ebaa5e056092461fd585b6851d15faa43035.tar.gz
tellico-0254ebaa5e056092461fd585b6851d15faa43035.zip
rename the following methods:
tqfind find tqreplace replace tqcontains contains git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1246075 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/fetch/imdbfetcher.cpp')
-rw-r--r--src/fetch/imdbfetcher.cpp112
1 files changed, 56 insertions, 56 deletions
diff --git a/src/fetch/imdbfetcher.cpp b/src/fetch/imdbfetcher.cpp
index d70429f..682ae1f 100644
--- a/src/fetch/imdbfetcher.cpp
+++ b/src/fetch/imdbfetcher.cpp
@@ -140,7 +140,7 @@ void IMDBFetcher::search(FetchKey key_, const TQString& value_) {
m_url = KURL();
m_url.setProtocol(TQString::tqfromLatin1("http"));
m_url.setHost(m_host.isEmpty() ? TQString::tqfromLatin1(IMDB_SERVER) : m_host);
- m_url.setPath(TQString::tqfromLatin1("/tqfind"));
+ m_url.setPath(TQString::tqfromLatin1("/find"));
switch(key_) {
case Title:
@@ -263,7 +263,7 @@ void IMDBFetcher::parseSingleTitleResult() {
s_titleRx->search(Tellico::decodeHTML(TQString(m_data)));
// split title at parenthesis
const TQString cap1 = s_titleRx->cap(1);
- int pPos = cap1.tqfind('(');
+ int pPos = cap1.find('(');
// FIXME: maybe remove parentheses here?
SearchResult* r = new SearchResult(this,
pPos == -1 ? cap1 : cap1.left(pPos),
@@ -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.tqfind(TQString::tqfromLatin1("Popular Titles"), 0, false);
- int pos_exact = output.tqfind(TQString::tqfromLatin1("Exact Matches"), TQMAX(pos_popular, 0), false);
- int pos_partial = output.tqfind(TQString::tqfromLatin1("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;
@@ -348,10 +348,10 @@ void IMDBFetcher::parseTitleBlock(const TQString& str_) {
const TQString cap1 = s_anchorTitleRx->cap(1); // the anchor url
const TQString cap2 = s_anchorTitleRx->cap(2).stripWhiteSpace(); // the anchor text
start += s_anchorTitleRx->matchedLength();
- int pPos = cap2.tqfind('('); // if it has parentheses, use that for description
+ int pPos = cap2.find('('); // if it has parentheses, use that for description
TQString desc;
if(pPos > -1) {
- int pPos2 = cap2.tqfind(')', pPos+1);
+ int pPos2 = cap2.find(')', pPos+1);
if(pPos2 > -1) {
desc = cap2.mid(pPos+1, pPos2-pPos-1);
}
@@ -362,11 +362,11 @@ void IMDBFetcher::parseTitleBlock(const TQString& str_) {
end = str_.length();
}
TQString text = str_.mid(start, end-start);
- pPos = text.tqfind('(');
+ pPos = text.find('(');
if(pPos > -1) {
- int pNewLine = text.tqfind(TQString::tqfromLatin1("<br"));
+ int pNewLine = text.find(TQString::tqfromLatin1("<br"));
if(pNewLine == -1 || pPos < pNewLine) {
- int pPos2 = text.tqfind(')', pPos);
+ int pPos2 = text.find(')', pPos);
desc = text.mid(pPos+1, pPos2-pPos-1);
}
pPos = -1;
@@ -436,24 +436,24 @@ void IMDBFetcher::parseSingleNameResult() {
len = s_anchorTitleRx->cap(0).length();
// split title at parenthesis
const TQString cap2 = s_anchorTitleRx->cap(2).stripWhiteSpace();
- int pPos = cap2.tqfind('(');
+ int pPos = cap2.find('(');
if(pPos > -1) {
desc = cap2.mid(pPos);
} else {
// look until the next <a
- int aPos = output.tqfind(TQString::tqfromLatin1("<a"), pos+len, false);
+ int aPos = output.find(TQString::tqfromLatin1("<a"), pos+len, false);
if(aPos == -1) {
aPos = output.length();
}
TQString tmp = output.mid(pos+len, aPos-pos-len);
- if(tmp.tqfind(tvRegExp) > -1) {
+ if(tmp.find(tvRegExp) > -1) {
isEpisode = true;
}
- pPos = tmp.tqfind('(');
+ pPos = tmp.find('(');
if(pPos > -1) {
- int pNewLine = tmp.tqfind(TQString::tqfromLatin1("<br"));
+ int pNewLine = tmp.find(TQString::tqfromLatin1("<br"));
if(pNewLine == -1 || pPos < pNewLine) {
- int pEnd = tmp.tqfind(')', pPos+1);
+ int pEnd = tmp.find(')', pPos+1);
desc = tmp.mid(pPos+1, pEnd-pPos-1).remove(*s_tagRx);
}
// but need to indicate it wasn't found initially
@@ -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.tqfind(TQString::tqfromLatin1("Popular Results"), 0, false);
+ int pos = output.find(TQString::tqfromLatin1("Popular Results"), 0, false);
if(pos == -1) {
- pos = output.tqfind(TQString::tqfromLatin1("Exact Matches"), 0, false);
+ pos = output.find(TQString::tqfromLatin1("Exact Matches"), 0, false);
}
// find beginning of partial matches
- int end = output.tqfind(TQString::tqfromLatin1("Other Results"), TQMAX(pos, 0), false);
+ int end = output.find(TQString::tqfromLatin1("Other Results"), TQMAX(pos, 0), false);
if(end == -1) {
- end = output.tqfind(TQString::tqfromLatin1("Partial Matches"), TQMAX(pos, 0), false);
+ end = output.find(TQString::tqfromLatin1("Partial Matches"), TQMAX(pos, 0), false);
if(end == -1) {
- end = output.tqfind(TQString::tqfromLatin1("Approx Matches"), TQMAX(pos, 0), false);
+ end = output.find(TQString::tqfromLatin1("Approx Matches"), TQMAX(pos, 0), false);
if(end == -1) {
end = output.length();
}
@@ -529,7 +529,7 @@ void IMDBFetcher::parseMultipleNameResults() {
KURL u(m_url, s_anchorNameRx->cap(1));
s = s_anchorNameRx->cap(2).stripWhiteSpace() + ' ';
// if more than one exact, add parentheses
- if(nameMap.tqcontains(s) && nameMap[s] > 0) {
+ if(nameMap.contains(s) && nameMap[s] > 0) {
// fix the first one that didn't have a number
if(nameMap[s] == 1) {
KURL u2 = map[s];
@@ -552,7 +552,7 @@ void IMDBFetcher::parseMultipleNameResults() {
while(pos > -1 && m_matches.size() < m_limit) {
KURL u(m_url, s_anchorNameRx->cap(1)); // relative URL
s = s_anchorNameRx->cap(2).stripWhiteSpace();
- if(nameMap.tqcontains(s) && nameMap[s] > 0) {
+ if(nameMap.contains(s) && nameMap[s] > 0) {
// fix the first one that didn't have a number
if(nameMap[s] == 1) {
KURL u2 = map[s];
@@ -685,7 +685,7 @@ Tellico::Data::EntryPtr IMDBFetcher::parseEntry(const TQString& str_) {
}
const TQString imdb = TQString::tqfromLatin1("imdb");
- if(!coll->hasField(imdb) && m_fields.tqfindIndex(imdb) > -1) {
+ 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"));
coll->addField(field);
@@ -701,7 +701,7 @@ void IMDBFetcher::doTitle(const TQString& str_, Data::EntryPtr entry_) {
if(s_titleRx->search(str_) > -1) {
const TQString cap1 = s_titleRx->cap(1);
// titles always have parentheses
- int pPos = cap1.tqfind('(');
+ int pPos = cap1.find('(');
TQString title = cap1.left(pPos).stripWhiteSpace();
// remove first and last quotes is there
if(title.startsWith(TQChar('"')) && title.endsWith(TQChar('"'))) {
@@ -742,7 +742,7 @@ void IMDBFetcher::doAspectRatio(const TQString& str_, Data::EntryPtr entry_) {
}
void IMDBFetcher::doAlsoKnownAs(const TQString& str_, Data::EntryPtr entry_) {
- if(m_fields.tqfindIndex(TQString::tqfromLatin1("alttitle")) == -1) {
+ if(m_fields.findIndex(TQString::tqfromLatin1("alttitle")) == -1) {
return;
}
@@ -770,7 +770,7 @@ void IMDBFetcher::doAlsoKnownAs(const TQString& str_, Data::EntryPtr entry_) {
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.tqfind(TQString::tqfromLatin1("releaseinfo")) > -1) {
+ if(s.find(TQString::tqfromLatin1("releaseinfo")) > -1) {
continue;
}
s.remove(*s_tagRx);
@@ -807,7 +807,7 @@ void IMDBFetcher::doPlot(const TQString& str_, Data::EntryPtr entry_, const KURL
thisPlot = plotRx.cap(1);
thisPlot.remove(*s_tagRx); // remove HTML tags
entry_->setField(TQString::tqfromLatin1("plot"), thisPlot);
- // if thisPlot ends with (more) or tqcontains
+ // 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::tqfromLatin1("(more)</")) || plotURLRx.search(plotRx.cap(0)) > -1) {
useUserSummary = true;
@@ -843,14 +843,14 @@ void IMDBFetcher::doPerson(const TQString& str_, Data::EntryPtr entry_,
TQString name = TQString::tqfromLatin1("/name/");
StringSet people;
- for(int pos = str_.tqfind(imdbHeader_); pos > 0; pos = str_.tqfind(imdbHeader_, pos)) {
+ for(int pos = str_.find(imdbHeader_); pos > 0; pos = str_.find(imdbHeader_, pos)) {
// loop until repeated <br> tags or </div> tag
- const int endPos1 = str_.tqfind(br2Rx, pos);
- const int endPos2 = str_.tqfind(divRx, pos);
+ const int endPos1 = str_.find(br2Rx, pos);
+ const int endPos2 = str_.find(divRx, pos);
const int endPos = TQMIN(endPos1, endPos2); // ok to be -1
pos = s_anchorRx->search(str_, pos+1);
while(pos > -1 && pos < endPos) {
- if(s_anchorRx->cap(1).tqfind(name) > -1) {
+ if(s_anchorRx->cap(1).find(name) > -1) {
people.add(s_anchorRx->cap(2).stripWhiteSpace());
}
pos = s_anchorRx->search(str_, pos+1);
@@ -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.tqfind(TQString::tqfromLatin1("cast overview"), 0, false);
+ pos = castText.find(TQString::tqfromLatin1("cast overview"), 0, false);
if(pos == -1) {
- pos = castText.tqfind(TQString::tqfromLatin1("credited cast"), 0, false);
+ pos = castText.find(TQString::tqfromLatin1("credited cast"), 0, false);
}
} else {
// first look for anchor
TQRegExp castAnchorRx(TQString::tqfromLatin1("<a\\s+name\\s*=\\s*\"cast\""), false);
- pos = castText.tqfind(castAnchorRx);
+ pos = castText.find(castAnchorRx);
if(pos < 0) {
TQRegExp tableClassRx(TQString::tqfromLatin1("<table\\s+class\\s*=\\s*\"cast\""), false);
- pos = castText.tqfind(tableClassRx);
+ pos = castText.find(tableClassRx);
if(pos < 0) {
- // fragile, the word "cast" appears in the title, but need to tqfind
+ // 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.tqfind(TQString::tqfromLatin1("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::tqfromLatin1("episodes"))) {
// find next cast list
- pos = castText.tqfind(TQString::tqfromLatin1("cast</"), pos+6, false);
+ pos = castText.find(TQString::tqfromLatin1("cast</"), pos+6, false);
}
}
}
@@ -921,10 +921,10 @@ void IMDBFetcher::doCast(const TQString& str_, Data::EntryPtr entry_, const KURL
TQStringList cast;
// loop until closing table tag
- const int endPos = castText.tqfind(TQString::tqfromLatin1("</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).tqfind(name) > -1) {
+ if(s_anchorRx->cap(1).find(name) > -1) {
// now search for <td> item with character name
// there's a column with ellipses then the character
const int pos2 = tdRx.search(castText, pos);
@@ -944,7 +944,7 @@ void IMDBFetcher::doCast(const TQString& str_, Data::EntryPtr entry_, const KURL
}
void IMDBFetcher::doRating(const TQString& str_, Data::EntryPtr entry_) {
- if(m_fields.tqfindIndex(TQString::tqfromLatin1("imdb-rating")) == -1) {
+ if(m_fields.findIndex(TQString::tqfromLatin1("imdb-rating")) == -1) {
return;
}
@@ -996,7 +996,7 @@ void IMDBFetcher::doCover(const TQString& str_, Data::EntryPtr entry_, const KUR
// didn't find the cover, IMDb also used to put "cover" inside the url
pos = imgRx.search(str_);
while(pos > -1) {
- if(imgRx.cap(0).tqfind(cover, 0, false) > -1) {
+ if(imgRx.cap(0).find(cover, 0, false) > -1) {
KURL u(baseURL_, imgRx.cap(1));
TQString id = ImageFactory::addImage(u, true);
if(!id.isEmpty()) {
@@ -1026,28 +1026,28 @@ void IMDBFetcher::doLists(const TQString& str_, Data::EntryPtr entry_) {
TQStringList genres, countries, langs, certs, tracks, studios;
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.tqfind(genre) > -1) {
- if(s_anchorRx->cap(2).tqfind(TQString::tqfromLatin1(" section"), 0, false) == -1) {
+ if(cap1.find(genre) > -1) {
+ if(s_anchorRx->cap(2).find(TQString::tqfromLatin1(" section"), 0, false) == -1) {
genres += s_anchorRx->cap(2).stripWhiteSpace();
}
- } else if(cap1.tqfind(country) > -1) {
- if(s_anchorRx->cap(2).tqfind(TQString::tqfromLatin1(" section"), 0, false) == -1) {
+ } else if(cap1.find(country) > -1) {
+ if(s_anchorRx->cap(2).find(TQString::tqfromLatin1(" section"), 0, false) == -1) {
countries += s_anchorRx->cap(2).stripWhiteSpace();
}
- } else if(cap1.tqfind(lang) > -1) {
+ } else if(cap1.find(lang) > -1) {
langs += s_anchorRx->cap(2).stripWhiteSpace();
- } else if(cap1.tqfind(colorInfo) > -1) {
+ } else if(cap1.find(colorInfo) > -1) {
// change "black and white" to "black & white"
entry_->setField(TQString::tqfromLatin1("color"),
- s_anchorRx->cap(2).tqreplace(TQString::tqfromLatin1("and"), TQChar('&')).stripWhiteSpace());
- } else if(cap1.tqfind(cert) > -1) {
+ 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.tqfind(soundMix) > -1) {
+ } else if(cap1.find(soundMix) > -1) {
tracks += s_anchorRx->cap(2).stripWhiteSpace();
- } else if(cap1.tqfind(company) > -1) {
+ } 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::tqfromLatin1("year")).isEmpty() && cap1.tqfind(year) > -1) {
+ } else if(entry_->field(TQString::tqfromLatin1("year")).isEmpty() && cap1.find(year) > -1) {
entry_->setField(TQString::tqfromLatin1("year"), s_anchorRx->cap(2).stripWhiteSpace());
}
}
@@ -1067,7 +1067,7 @@ void IMDBFetcher::doLists(const TQString& str_, Data::EntryPtr entry_) {
cert = TQChar('U');
}
cert += TQString::tqfromLatin1(" (") + country + ')';
- if(certsAllowed.tqfindIndex(cert) > -1) {
+ if(certsAllowed.findIndex(cert) > -1) {
entry_->setField(TQString::tqfromLatin1("certification"), cert);
break;
}
@@ -1075,7 +1075,7 @@ void IMDBFetcher::doLists(const TQString& str_, Data::EntryPtr entry_) {
// now add new field for all certifications
const TQString allc = TQString::tqfromLatin1("allcertification");
- if(m_fields.tqfindIndex(allc) > -1) {
+ if(m_fields.findIndex(allc) > -1) {
Data::FieldPtr f = entry_->collection()->fieldByName(allc);
if(!f) {
f = new Data::Field(allc, i18n("Certifications"), Data::Field::Table);