Index: corsair.control =================================================================== RCS file: /cvsroot/corsair/corsair/corsair.control,v retrieving revision 1.6 diff -u -u -r1.6 corsair.control --- corsair/corsair.control 10 Sep 2005 20:05:51 -0000 1.6 +++ corsair/corsair.control 31 Oct 2005 20:00:43 -0000 @@ -1,9 +1,9 @@ -Files: bin/corsair apps/Applications/corsair.desktop pics/Corsair.png pics/newfeed.png pics/get.png pics/reload.png pics/play.png help/html/corsair.html help/html/corsair_usage.html help/html/corsair_intro.html help/html/gpl.html +Files: bin/corsair apps/Applications/corsair.desktop pics/Corsair.png pics/newfeed.png pics/get.png pics/reload.png pics/play.png pics/details.png pics/UtilsIcon.png pics/list.png pics/volume.png pics/mute.png pics/fileopen.png pics/txt.xpm help/html/corsair.html help/html/corsair_usage.html help/html/corsair_intro.html help/html/gpl.html Priority: optional Section: qpe/applications Maintainer: Joe Rumsey Architecture: $CPU_ARCH Arch: $DEVICE_ARCH -Version: 0.2.0 +Version: 0.2.4 License: GPL Description: Corsair RSS/Podcast Aggregator Index: corsair.cpp =================================================================== RCS file: /cvsroot/corsair/corsair/corsair.cpp,v retrieving revision 1.7 diff -u -u -r1.7 corsair.cpp --- corsair/corsair.cpp 10 Sep 2005 20:05:51 -0000 1.7 +++ corsair/corsair.cpp 31 Oct 2005 20:00:44 -0000 @@ -35,13 +35,13 @@ #include #include #include +#include #include #include #include #include - #include "download.h" #include "info.h" @@ -105,11 +105,15 @@ QPopupMenu *file = new QPopupMenu(m_menuPopup); file->insertItem("&Load", this, SLOT(loadNewFile())); file->insertItem("E&xit", this, SLOT(close())); - QPopupMenu *view = new QPopupMenu(m_menuPopup); view->insertItem("&Downloads", this, SLOT(viewDownloads())); view->insertItem("&Preferences", this, SLOT(preferences())); + // bind Zaurus cancel key (escape) to close + QAccel *a = new QAccel( this ); + a->connectItem( a->insertItem(Key_Escape), + this, + SLOT(close()) ); QPopupMenu *help = new QPopupMenu(m_menuPopup); help->insertItem("&Help", this, SLOT(help())); help->insertItem("&About", this, SLOT(about())); @@ -211,8 +215,10 @@ FeedShow *show = m_feeds.GetShow(item); if(show && show->m_haveLocalCopy) { play(show); - } else { + } else if (show && show->m_haveEnclosure) { grabItem(item); + } else { + view(item); } } } @@ -637,11 +643,12 @@ void CorsairWindow::play(FeedShow *show) { if(show->m_haveLocalCopy) { - QCString player = (const char *)QString("QPE/Application/" + option("audioplayer", "player")); + QCString player = (const char *)QString("QPE/Application/" + option("audioplayer", "kino2")); QCopEnvelope e(player, "setDocument(QString)"); QString sub; - e << show->fullLocalPath(sub); - + QString filename = show->fullLocalPath(sub); + e << filename; + LOG(4, "filename=%s\n", (const char *)filename); QCopEnvelope r(player, "raise()"); } } Index: download.cpp =================================================================== RCS file: /cvsroot/corsair/corsair/download.cpp,v retrieving revision 1.7 diff -u -u -r1.7 download.cpp --- corsair/download.cpp 10 Sep 2005 20:05:51 -0000 1.7 +++ corsair/download.cpp 31 Oct 2005 20:00:44 -0000 @@ -27,8 +27,10 @@ { m_parent = parent; m_url = url; + m_host = url.host(); m_param = param; m_complete = false; + m_redirectCount = 0; init(); @@ -67,10 +69,10 @@ if(port < 0) port = 80; - LOG(2, "connecting to %s:%d\n", (const char *)m_url.host(), port); - connectToHost(m_url.host(), port); + LOG(2, "connecting to %s:%d\n", (const char *)m_host, port); + connectToHost(m_host, port); - emit statusUpdate("Connecting to " + m_url.host()); + emit statusUpdate("Connecting to " + m_host); } void Download::openFile() @@ -144,8 +146,8 @@ m_file.writeBlock((const char *)line, line.length()); m_totalRead += line.length(); } else if(!m_gotResponse) { - LOG(2, "%s", (const char *)line); - if(line.contains("302 Found") || line.contains("301 Moved Permanently")) { + LOG(2, "Response=%s", (const char *)line); + if(line.contains("302 Found") || line.contains("301 Moved Permanently") || line.contains("302 Redirect")) { m_redirect = true; } else if(!line.contains("200 OK")) { complete(Error); @@ -153,7 +155,7 @@ } m_gotResponse = true; } else { - LOG(2, "%s", (const char *)line); + LOG(2, "Response Line=%s", (const char *)line); QString lower = line.lower(); if(lower.startsWith("transfer-encoding: ") && line.contains("chunked")) { m_chunked = true; @@ -166,9 +168,15 @@ m_redirectLocation = line.right(line.length() - (QString("location: ").length())).stripWhiteSpace(); } else if(line.length() < 1 || line[0] == '\r' || line[0] == '\n') { if(m_redirect) { + if (m_redirectCount > REDIRECT_MAX || + m_redirectLocation.isNull()) { + error(RedirectError); + } init(); close(); + m_redirectCount++; m_url = QUrl(m_redirectLocation); + m_host = m_url.host(); go(); } else { m_headersComplete = true; @@ -194,14 +202,14 @@ void Download::connected() { - emit statusUpdate("Connected to " + m_url.host()); + emit statusUpdate("Connected to " + m_host); LOG(2, "connected\n"); QString get = m_url.encodedPathAndQuery(); QString req; req = "GET " + get + " HTTP/1.1\r\n"; - req += "Host: " + m_url.host() + "\r\n"; + req += "Host: " + m_host + "\r\n"; req += "\r\n"; LOG(2, "Grabbing %s with '%s'\n", (const char *)get, (const char *)req); @@ -212,16 +220,17 @@ void Download::hostFound() { - emit statusUpdate("Host " + m_url.host() + " found"); + emit statusUpdate("Host " + m_host + " found"); LOG(2, "hostFound\n"); } void Download::connectionClosed() { + LOG(2, "connectionClosed to %s",(const char*)m_host); readyRead(); - emit statusUpdate(m_url.host() + "Done"); - LOG(2, "connectionClosed\n"); + statusUpdate(m_host + "done"); + m_file.close(); complete(Error); } Index: download.h =================================================================== RCS file: /cvsroot/corsair/corsair/download.h,v retrieving revision 1.4 diff -u -u -r1.4 download.h --- corsair/download.h 4 Sep 2005 16:52:22 -0000 1.4 +++ corsair/download.h 31 Oct 2005 20:00:44 -0000 @@ -23,6 +23,8 @@ #include #include +#define REDIRECT_MAX 5 // max redirects + class CorsairWindow; class Download : public QSocket { @@ -43,6 +45,8 @@ bool m_redirect; QString m_redirectLocation; bool m_complete; + QString m_host; + int m_redirectCount; void *m_param; @@ -54,6 +58,7 @@ NoData, CantConnect, NotFound, + RedirectError, Error }; Index: feedparser.h =================================================================== RCS file: /cvsroot/corsair/corsair/feedparser.h,v retrieving revision 1.3 diff -u -u -r1.3 feedparser.h --- corsair/feedparser.h 10 Sep 2005 20:05:51 -0000 1.3 +++ corsair/feedparser.h 31 Oct 2005 20:00:44 -0000 @@ -66,6 +66,7 @@ m_elemTitle[m_level] = ""; m_enclosure = ""; m_description = ""; + m_elemLink[m_level] = ""; } else if(name == "enclosure") { m_enclosure = attr.value("url"); } @@ -84,14 +85,14 @@ { LOG(3, "endElement %s\n", (const char *)name); if(m_elementName[m_level] == "item") { - m_feed->addShow(m_elemTitle[m_level], + m_feed->addShow(m_elemTitle[m_level].simplifyWhiteSpace(), m_enclosure, m_description, m_elemLink[m_level]); } else if(m_elementName[m_level] == "channel") { - m_feed->setName(m_elemTitle[m_level]); + m_feed->setName(m_elemTitle[m_level].simplifyWhiteSpace()); } else if(m_elementName[m_level] == "title") { - m_elemTitle[m_level - 1] = m_elementData[m_level]; + m_elemTitle[m_level - 1] = m_elementData[m_level].simplifyWhiteSpace(); } else if(m_elementName[m_level] == "description") { m_description = m_elementData[m_level]; } else if(m_elementName[m_level] == "link") { Index: feeds.cpp =================================================================== RCS file: /cvsroot/corsair/corsair/feeds.cpp,v retrieving revision 1.7 diff -u -u -r1.7 feeds.cpp --- corsair/feeds.cpp 10 Sep 2005 20:05:51 -0000 1.7 +++ corsair/feeds.cpp 31 Oct 2005 20:00:44 -0000 @@ -213,19 +213,26 @@ m_isNew(isNew), m_index(index), m_haveLocalCopy(false) , + m_haveEnclosure(false), m_listItem(NULL) { QString sub; QFile f(fullLocalPath(sub)); - if(enclosure.length() > 0 && f.exists()) - m_haveLocalCopy = true; + QString filename = fileName(); + if(enclosure.length() > 0) { + m_haveEnclosure = true; + if (f.exists()) { + LOG(1,"Show file exists: (%s) (%s) \n",(const char *)sub, (const char *) filename); + m_haveLocalCopy = true; + } + } } QString FeedShow::fullLocalPath(QString &sub) { sub = m_feed->m_list->owner()->showsDir() + "/" + m_feed->dirName() + "/"; - return sub + fileName(); + return sub + cleanfileName(); } void FeedShow::setHaveLocalCopy(bool haveit) @@ -292,8 +299,9 @@ FeedShow *i; for(i = m_shows.first(); i; i = m_shows.next()) { if(link.length() > 0) { - if(i->m_link == link) + if(i->m_link == link) { return; + } } else if(enclosure.length() > 0) { if(i->m_enclosure == enclosure) { return; Index: feeds.h =================================================================== RCS file: /cvsroot/corsair/corsair/feeds.h,v retrieving revision 1.5 diff -u -u -r1.5 feeds.h --- corsair/feeds.h 10 Sep 2005 20:05:51 -0000 1.5 +++ corsair/feeds.h 31 Oct 2005 20:00:45 -0000 @@ -74,6 +74,7 @@ int m_index; bool m_haveLocalCopy; + bool m_haveEnclosure; ShowListViewItem *m_listItem; @@ -83,6 +84,13 @@ return f; } + QString cleanfileName() { + QString f = fileName(); + int loc = f.findRev('?'); + f = f.left(loc); + return f; + } + QString fullLocalPath(QString &subDir); void setHaveLocalCopy(bool haveit); Index: main.cpp =================================================================== RCS file: /cvsroot/corsair/corsair/main.cpp,v retrieving revision 1.3 diff -u -u -r1.3 main.cpp --- corsair/main.cpp 10 Sep 2005 20:05:51 -0000 1.3 +++ corsair/main.cpp 31 Oct 2005 20:00:45 -0000 @@ -23,7 +23,7 @@ #include "corsair.h" -int g_debug = 2; +int g_debug = 3; #ifndef GOOD_MACROS void LOG(int l, const char *fmt, ...)