summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-11-02 02:41:04 (UTC)
committer llornkcor <llornkcor>2004-11-02 02:41:04 (UTC)
commite83e5bd3f26270d61a83b8b91e07b35d2657d060 (patch) (side-by-side diff)
treeeec1223a69d28cd684116976dc7e970bbf846054
parent51b7bdf260bc2b5b066c6594a6d0c507add682fd (diff)
downloadopie-e83e5bd3f26270d61a83b8b91e07b35d2657d060.zip
opie-e83e5bd3f26270d61a83b8b91e07b35d2657d060.tar.gz
opie-e83e5bd3f26270d61a83b8b91e07b35d2657d060.tar.bz2
new mirror site web page requiring new parsing
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp80
1 files changed, 39 insertions, 41 deletions
diff --git a/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp b/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp
index de9c72b..44ade8d 100644
--- a/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp
+++ b/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp
@@ -19,4 +19,2 @@
-/* OPIE */
-#include <opie2/odebug.h>
#include <qpe/config.h>
@@ -45,3 +43,3 @@ void optionsDialog::ftpSiteDlg( )
ListFile+="/ftpList";
- odebug << "opening "+ListFile << oendl;
+ qDebug( "opening "+ListFile );
if ( QFile(ListFile).exists() ) {
@@ -73,3 +71,4 @@ void optionsDialog::getSite()
outputFile = ListFile + "list.html";
- QString networkUrl= "http://www.gutenberg.org/www/mirror.sites.html";
+ QString networkUrl="http://www.gutenberg.net/catalog/world/selectpermanentmirror?fk_books=12962";
+// QString networkUrl= "http://www.gutenberg.org/www/mirror.sites.html";
//http://www.gutenberg.org/index.html";
@@ -83,3 +82,3 @@ void optionsDialog::getSite()
// { // use new, improved, *INSTANT* network-dialog-file-getterer
-// odebug << "gitcha!" << oendl;
+// qDebug( "gitcha!" );
// }
@@ -90,4 +89,4 @@ void optionsDialog::getSite()
- QString cmd="wget -T 15 -O " +outputFile + " " + networkUrl + " 2>&1" ;
- odebug << "Issuing the command "+cmd << oendl;
+ QString cmd="wget -T 15 -O " +outputFile + " " + networkUrl;// + " 2>&1" ;
+ qDebug( "Issuing the command "+cmd );
Output *outDlg;
@@ -120,3 +119,3 @@ bool optionsDialog::parseFtpList( QString outputFile)
// TODO: add locations!!
- odebug << "parse ftplist "+outputFile << oendl;
+ qDebug( "parse ftplist "+outputFile );
QString ftpList, s_location;
@@ -133,3 +132,3 @@ bool optionsDialog::parseFtpList( QString outputFile)
int end;
- if( s.find( "FTP mirror sites for Project Gutenberg:", 0, TRUE) !=-1) { //lower end of this file
+ if( s.find( "Select a Default Download Site - Project Gutenberg", 0, TRUE) !=-1) { //lower end of this file
b_gotchTest = true;
@@ -138,3 +137,5 @@ bool optionsDialog::parseFtpList( QString outputFile)
if(( start = s.find( "ftp://", 0, TRUE))!=-1 ) {
- end = s.find( "/\"", 0, TRUE);// ==-1)) {
+// qDebug(s);
+// qDebug("%d", start);
+ end = s.find( "</td></tr>", 0, TRUE);// ==-1)) {
if( end == -1) {
@@ -142,3 +143,5 @@ bool optionsDialog::parseFtpList( QString outputFile)
}
- ftpSite = s.mid( start, (end - start) );
+// qDebug("end %d", end);
+ start =start + 6;
+ ftpSite = s.mid( start , (end - start) );
if(ftpSite.right(1) != "/") {
@@ -146,30 +149,23 @@ bool optionsDialog::parseFtpList( QString outputFile)
}
- ftpSite=ftpSite.right( ftpSite.length()-6);
- if( ftpSite.find("\n", 0, TRUE) )
- ftpSite.remove( ftpSite.find("\n", 0, TRUE), 1);
-
- if( ftpSite.find("\"", 0, TRUE) )
- ftpSite.remove( ftpSite.find("\"", 0, TRUE), 1);
- if( ftpSite.find("a>", 0, TRUE) )
- ftpSite.remove( ftpSite.find("a>", 0, TRUE) -2, 4);
-
-
- s = t.readLine();
- s = t.readLine();
- if(( start=s.find("<BR>(", 0, TRUE) ) != -1) {
-// odebug << "" << s << "" << oendl;
- end = s.find( ")", 0, TRUE)+1;
- s_location= s.mid( start+4, (end - start) );
-
-// odebug << "" << s_location << "" << oendl;
-// ftpList += ftpSite + "\n";
-// ftp_QListBox_1->sort( TRUE );
- ftpList += s_location+ " "+ftpSite+"\n";
-
- ftp_QListBox_1->sort( TRUE );
- QString winbug=" ";
- ftp_QListBox_1->insertItem ( s_location.latin1() +winbug+ftpSite);
- // ftp_QListBox_1->insertItem ( ftpSite+" "+s_location.latin1());
- }
+// qDebug("ftpsite " + ftpSite);
+
+ for (int j = 0 ; j<3;j++) {
+ s = t.readLine();
+ QString finder="</td><td rowspan=\"3\">";
+ if(( start = s.find( finder, 0, TRUE) ) != -1) {
+ // qDebug( "%d" + s, start );
+ end = s.find( finder, start + 2, TRUE) ;
+// qDebug("end %d",end);
+ s_location = s.mid( start + finder.length() , (end - start)-finder.length() );
+//
+// qDebug("Location "+s_location );
+ ftpList += s_location+ " "+ftpSite+"\n";
+ ftp_QListBox_1->sort( TRUE );
+ QString winbug=" ";
+ ftp_QListBox_1->insertItem ( s_location.latin1() + winbug + ftpSite);
+ j=3;
+ // ftp_QListBox_1->insertItem ( ftpSite+" "+s_location.latin1());
+ }
+ }
// ftp_QListBox_1->insertItem ( ftpSite);
@@ -197,3 +193,3 @@ void optionsDialog::openSiteList() {
- odebug << " just opens the ftp site list" << oendl;
+ qDebug( " just opens the ftp site list" );
// ListFile = ( QDir::homeDirPath ()) +"/.gutenbrowser/ftpList";
@@ -237,3 +233,5 @@ void optionsDialog::select_site( const char *index )
s_site2=s_site.right( s_site.length()-(s_site.find(" ",0,TRUE)+4) );
-odebug << "Selected ftp site is "+ s_site2 << oendl;
+
+ qDebug( "Selected ftp site is "+ s_site2 );
+
int i_ftp = s_site2.find("/", 0, FALSE);
@@ -248,3 +246,3 @@ odebug << "Selected ftp site is "+ s_site2 << oendl;
// config->write();
- TextLabel3->setText( "Current ftp server:\n"+ftp_host /*+ ftp_base_dir*/ );
+ TextLabel3->setText( "Current ftp server:\n" + ftp_host /*+ ftp_base_dir*/ );
// optionsDialog::accept();