# HG changeset patch # User Chris Cannam # Date 1225193923 0 # Node ID 0dc158c1a6c9e232d0f2f7996783061a4edf9155 # Parent dddd4ab7706832ac9cdfadb8ccf8eabb92a751b9 * tidy up uses of CachedFile diff -r dddd4ab77068 -r 0dc158c1a6c9 rdf/PluginRDFDescription.cpp --- a/rdf/PluginRDFDescription.cpp Tue Oct 28 11:37:33 2008 +0000 +++ b/rdf/PluginRDFDescription.cpp Tue Oct 28 11:38:43 2008 +0000 @@ -30,7 +30,6 @@ using std::endl; PluginRDFDescription::PluginRDFDescription(QString pluginId) : -//!!! m_source(0), m_pluginId(pluginId), m_haveDescription(false) { @@ -51,7 +50,6 @@ PluginRDFDescription::~PluginRDFDescription() { -//!!! delete m_source; } bool @@ -167,25 +165,12 @@ if (FileSource::isRemote(url) && FileSource::canHandleScheme(url)) { - //!!! persistent with expiry - CachedFile cf(url); if (!cf.isOK()) { return false; } local = QUrl::fromLocalFile(cf.getLocalFilename()).toString(); -/*!!! - m_source = new FileSource(url, 0, FileSource::PersistentCache); - - if (!m_source->isAvailable()) { - delete m_source; - m_source = 0; - return false; - } - m_source->waitForData(); - local = QUrl::fromLocalFile(m_source->getLocalFilename()).toString(); -*/ } if (!indexMetadata(local, label)) success = false; diff -r dddd4ab77068 -r 0dc158c1a6c9 rdf/PluginRDFDescription.h --- a/rdf/PluginRDFDescription.h Tue Oct 28 11:37:33 2008 +0000 +++ b/rdf/PluginRDFDescription.h Tue Oct 28 11:38:43 2008 +0000 @@ -20,8 +20,6 @@ #include #include -//!!!class FileSource; - class PluginRDFDescription { public: @@ -56,7 +54,6 @@ typedef std::map OutputDispositionMap; typedef std::map OutputStringMap; -//!!! FileSource *m_source; QString m_pluginId; bool m_haveDescription; QString m_pluginName; diff -r dddd4ab77068 -r 0dc158c1a6c9 rdf/PluginRDFIndexer.cpp --- a/rdf/PluginRDFIndexer.cpp Tue Oct 28 11:37:33 2008 +0000 +++ b/rdf/PluginRDFIndexer.cpp Tue Oct 28 11:38:43 2008 +0000 @@ -17,8 +17,8 @@ #include "SimpleSPARQLQuery.h" -//!!!#include "data/fileio/FileSource.h" #include "data/fileio/CachedFile.h" +#include "data/fileio/FileSource.h" #include "data/fileio/PlaylistFileReader.h" #include "plugin/PluginIdentifier.h" @@ -101,12 +101,6 @@ PluginRDFIndexer::~PluginRDFIndexer() { QMutexLocker locker(&m_mutex); -/*!!! - while (!m_sources.empty()) { - delete *m_sources.begin(); - m_sources.erase(m_sources.begin()); - } -*/ } bool @@ -127,14 +121,6 @@ std::cerr << "PluginRDFIndexer::indexConfiguredURLs: index url is " << index.toStdString() << std::endl; -/*!!! - expireCacheMaybe(index); - - FileSource indexSource(index, 0, FileSource::PersistentCache); - if (!indexSource.isAvailable()) continue; - indexSource.waitForData(); -*/ - CachedFile cf(index); if (!cf.isOK()) continue; @@ -239,43 +225,7 @@ QString urlString = url.toString(); return indexURL(urlString); } -/*!!! -void -PluginRDFIndexer::expireCacheMaybe(QString urlString) -{ - QString cacheFile = FileSource::getPersistentCacheFilePath(urlString); - QSettings settings; - settings.beginGroup("RDF"); - - QString key("rdf-expiry-times"); - - QMap expiryMap = settings.value(key).toMap(); - QDateTime lastExpiry = expiryMap[urlString].toDateTime(); - - if (!QFileInfo(cacheFile).exists()) { - expiryMap[urlString] = QDateTime::currentDateTime(); - settings.setValue(key, expiryMap); - settings.endGroup(); - return; - } - - if (!lastExpiry.isValid() || - (lastExpiry.addDays(2) < QDateTime::currentDateTime())) { - - std::cerr << "Expiring old cache file " << cacheFile.toStdString() - << std::endl; - - if (QFile(cacheFile).remove()) { - - expiryMap[urlString] = QDateTime::currentDateTime(); - settings.setValue(key, expiryMap); - } - } - - settings.endGroup(); -} -*/ bool PluginRDFIndexer::indexURL(QString urlString) { @@ -290,28 +240,12 @@ if (FileSource::isRemote(urlString) && FileSource::canHandleScheme(urlString)) { - //!!! how do we avoid hammering the server if it doesn't have - //!!! the file, and/or the network if it can't get through? - CachedFile cf(urlString); if (!cf.isOK()) { return false; } localString = cf.getLocalFilename(); -/*!!! - expireCacheMaybe(urlString); - - FileSource *source = new FileSource - (urlString, 0, FileSource::PersistentCache); - if (!source->isAvailable()) { - delete source; - return false; - } - source->waitForData(); - localString = QUrl::fromLocalFile(source->getLocalFilename()).toString(); - m_sources.insert(source); -*/ } // cerr << "PluginRDFIndexer::indexURL: url = <" << urlString.toStdString() << ">" << endl;