Git commit 128f9135d5aa7a740b4823c415a9d6dcf14d9759 by Robby Stephenson. Committed on 16/01/2018 at 01:29. Pushed by rstephenson into branch '3.1'.
Remove deprecated Wine.com data source M +4 -0 ChangeLog M +2 -11 doc/configuration.docbook M +0 -1 src/fetch/CMakeLists.txt M +0 -2 src/fetch/fetcherinitializer.cpp D +0 -346 src/fetch/winecomfetcher.cpp D +0 -106 src/fetch/winecomfetcher.h M +2 -2 src/main.cpp M +0 -8 src/tests/CMakeLists.txt D +0 -79 src/tests/winecomfetchertest.cpp D +0 -46 src/tests/winecomfetchertest.h M +0 -1 xslt/CMakeLists.txt D +0 -110 xslt/winecom2tellico.xsl https://commits.kde.org/tellico/128f9135d5aa7a740b4823c415a9d6dcf14d9759 diff --git a/ChangeLog b/ChangeLog index 8105b3d1..b287c039 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-01-15 Robby Stephenson <[email protected]> + + * Removed deprecated Wine.com data source. + 2018-01-14 Robby Stephenson <[email protected]> * Updated Kino.de data source. diff --git a/doc/configuration.docbook b/doc/configuration.docbook index 6691db7c..dec8710c 100644 --- a/doc/configuration.docbook +++ b/doc/configuration.docbook @@ -169,7 +169,6 @@ in the Data Sources Dialog. There are many available types and sources. A few of <listitem><para><link linkend="bib-sources">bibsonomy.org</link>,</para></listitem> <listitem><para><link linkend="bib-sources">crossref.org</link>,</para></listitem> <listitem><para><link linkend="discogs">Discogs.com</link>,</para></listitem> -<listitem><para><link linkend="winecom">Wine.com</link>,</para></listitem> <listitem><para><link linkend="tmdb">TheMovieDB.org</link>,</para></listitem> <listitem><para><link linkend="tgdb">TheGamesDB.net</link>,</para></listitem> <listitem><para><link linkend="omdb">OMDBAPI.com</link>,</para></listitem> @@ -373,17 +372,10 @@ The <ulink url="http://www.imdb.com">Internet Movie Database</ulink> provides in </sect2> <!-- start of wine sources --> -<sect2 id="wine-sources"> +<!--<sect2 id="wine-sources"> <title>Wine Data Sources</title> -<sect3 id="winecom"> -<title>Wine.com</title> -<para> -<ulink url="http://wine.com">Wine.com</ulink> is an online wine seller, and offers access to a database information on wine varietals. Registration for a free account is required. -</para> -</sect3> - -</sect2> +</sect2>--> <!-- start of video game sources --> <sect2 id="videogame-sources"> @@ -405,7 +397,6 @@ The <ulink url="http://www.imdb.com">Internet Movie Database</ulink> provides in </sect2> -<!-- start of wine sources --> <sect2 id="variety-type-sources"> <title>Data Sources for Multiple Collection Types</title> diff --git a/src/fetch/CMakeLists.txt b/src/fetch/CMakeLists.txt index 1ca9fbaa..c91d6614 100644 --- a/src/fetch/CMakeLists.txt +++ b/src/fetch/CMakeLists.txt @@ -55,7 +55,6 @@ SET(fetch_STAT_SRCS themoviedbfetcher.cpp videogamegeekfetcher.cpp vndbfetcher.cpp - winecomfetcher.cpp xmlfetcher.cpp z3950connection.cpp z3950fetcher.cpp diff --git a/src/fetch/fetcherinitializer.cpp b/src/fetch/fetcherinitializer.cpp index 1c1c7421..ddf11939 100644 --- a/src/fetch/fetcherinitializer.cpp +++ b/src/fetch/fetcherinitializer.cpp @@ -42,7 +42,6 @@ #include "bibsonomyfetcher.h" #include "googlescholarfetcher.h" #include "discogsfetcher.h" -#include "winecomfetcher.h" #include "themoviedbfetcher.h" #include "musicbrainzfetcher.h" #include "giantbombfetcher.h" @@ -95,7 +94,6 @@ Tellico::Fetch::FetcherInitializer::FetcherInitializer() { RegisterFetcher<Fetch::ArxivFetcher> registerArxiv(Arxiv); RegisterFetcher<Fetch::BibsonomyFetcher> registerBibsonomy(Bibsonomy); RegisterFetcher<Fetch::GoogleScholarFetcher> registerGoogle(GoogleScholar); - RegisterFetcher<Fetch::WineComFetcher> registerWine(WineCom); RegisterFetcher<Fetch::MusicBrainzFetcher> registerMB(MusicBrainz); RegisterFetcher<Fetch::GiantBombFetcher> registerBomb(GiantBomb); RegisterFetcher<Fetch::OpenLibraryFetcher> registerOpenLibrary(OpenLibrary); diff --git a/src/fetch/winecomfetcher.cpp b/src/fetch/winecomfetcher.cpp deleted file mode 100644 index eb3ccac7..00000000 --- a/src/fetch/winecomfetcher.cpp +++ /dev/null @@ -1,346 +0,0 @@ -/*************************************************************************** - Copyright (C) 2009 Robby Stephenson <[email protected]> - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see <http://www.gnu.org/licenses/>. * - * * - ***************************************************************************/ - -#include "winecomfetcher.h" -#include "../translators/xslthandler.h" -#include "../translators/tellicoimporter.h" -#include "../utils/guiproxy.h" -#include "../utils/string_utils.h" -#include "../collection.h" -#include "../entry.h" -#include "../images/imagefactory.h" -#include "../utils/datafileregistry.h" -#include "../tellico_debug.h" - -#include <KLocalizedString> -#include <KIO/Job> -#include <KJobUiDelegate> -#include <KConfigGroup> -#include <KJobWidgets/KJobWidgets> - -#include <QLineEdit> -#include <QDomDocument> -#include <QLabel> -#include <QFile> -#include <QTextStream> -#include <QVBoxLayout> -#include <QTextCodec> -#include <QUrlQuery> - -namespace { - static const int WINECOM_RETURNS_PER_REQUEST = 25; - static const int WINECOM_MAX_RETURNS_TOTAL = 100; - static const char* WINECOM_BASE_URL = "http://services.wine.com"; -} - -using namespace Tellico; -using Tellico::Fetch::WineComFetcher; - -WineComFetcher::WineComFetcher(QObject* parent_) - : Fetcher(parent_), m_xsltHandler(nullptr), - m_limit(WINECOM_MAX_RETURNS_TOTAL), m_page(1), m_total(-1), m_numResults(0), m_offset(0), - m_job(nullptr), m_started(false) { -} - -WineComFetcher::~WineComFetcher() { - delete m_xsltHandler; - m_xsltHandler = nullptr; -} - -QString WineComFetcher::source() const { - return m_name.isEmpty() ? defaultName() : m_name; -} - -QString WineComFetcher::attribution() const { - // per https://api.wine.com/wiki - return QLatin1String("<a href=\"http://www.wine.com/\" title=\"Wine.com the destination for Wine and Wine Gifts\">" - "<img src=\"http://cache.wine.com/images/logos/80x20_winecom_logo.png\" alt=\"Wine.com the destination for Wine and Wine Gifts\" /></a>"); -} - -bool WineComFetcher::canFetch(int type) const { - return type == Data::Collection::Wine; -} - -void WineComFetcher::readConfigHook(const KConfigGroup& config_) { - QString k = config_.readEntry("API Key", QString()); - if(!k.isEmpty()) { - m_apiKey = k; - } -} - -void WineComFetcher::search() { - m_started = true; - m_page = 1; - m_total = -1; - m_numResults = 0; - m_offset = 0; - - doSearch(); -} - -void WineComFetcher::continueSearch() { - m_started = true; - doSearch(); -} - -void WineComFetcher::doSearch() { - if(m_apiKey.isEmpty()) { - myDebug() << "No API key"; - message(i18n("An access key is required to use this data source.") - + QLatin1Char(' ') + - i18n("Those values must be entered in the data source settings."), MessageHandler::Error); - stop(); - return; - } - -// myDebug() << "value = " << value_; - - QUrl u(QString::fromLatin1(WINECOM_BASE_URL)); - u.setPath(QLatin1String("/api/beta2/service.svc/XML/catalog")); - QUrlQuery q; - q.addQueryItem(QLatin1String("apikey"), m_apiKey); - q.addQueryItem(QLatin1String("offset"), QString::number((m_page-1) * WINECOM_RETURNS_PER_REQUEST)); - q.addQueryItem(QLatin1String("size"), QString::number(WINECOM_RETURNS_PER_REQUEST)); - - switch(request().key) { - case Keyword: - q.addQueryItem(QLatin1String("search"), request().value); - break; - - default: - myWarning() << "key not recognized: " << request().key; - stop(); - return; - } - u.setQuery(q); -// myDebug() << "url: " << u.url(); - - m_job = KIO::storedGet(u, KIO::NoReload, KIO::HideProgressInfo); - KJobWidgets::setWindow(m_job, GUI::Proxy::widget()); - connect(m_job, SIGNAL(result(KJob*)), - SLOT(slotComplete(KJob*))); -} - -void WineComFetcher::stop() { - if(!m_started) { - return; - } -// myDebug(); - if(m_job) { - m_job->kill(); - m_job = nullptr; - } - - m_started = false; - emit signalDone(this); -} - -void WineComFetcher::slotComplete(KJob*) { -// myDebug(); - - if(m_job->error()) { - m_job->uiDelegate()->showErrorMessage(); - stop(); - return; - } - - QByteArray data = m_job->data(); - if(data.isEmpty()) { - myDebug() << "no data"; - stop(); - return; - } - - // since the fetch is done, don't worry about holding the job pointer - m_job = nullptr; -#if 0 - myWarning() << "Remove debug from winecomfetcher.cpp"; - QFile f(QLatin1String("/tmp/test.xml")); - if(f.open(QIODevice::WriteOnly)) { - QTextStream t(&f); - t.setCodec("UTF-8"); - t << data; - } - f.close(); -#endif - - QDomDocument dom; - if(!dom.setContent(data, false)) { - myWarning() << "server did not return valid XML."; - return; - } - - if(m_total == -1) { - QDomNode n = dom.documentElement().namedItem(QLatin1String("Catalog")) - .namedItem(QLatin1String("Products")) - .namedItem(QLatin1String("Total")); - QDomElement e = n.toElement(); - if(!e.isNull()) { - m_total = e.attribute(QLatin1String("total_results"), QString::number(-1)).toInt(); - myDebug() << m_total; - } - } - - if(!m_xsltHandler) { - initXSLTHandler(); - if(!m_xsltHandler) { // probably an error somewhere in the stylesheet loading - stop(); - return; - } - } - - // assume result is always utf-8 - QString str = m_xsltHandler->applyStylesheet(QString::fromUtf8(data.constData(), data.size())); - Import::TellicoImporter imp(str); - // be quiet when loading images - imp.setOptions(imp.options() ^ Import::ImportShowImageErrors); - Data::CollPtr coll = imp.collection(); - - int count = 0; - foreach(Data::EntryPtr entry, coll->entries()) { - if(m_numResults >= m_limit) { - break; - } - if(!m_started) { - // might get aborted - break; - } - - FetchResult* r = new FetchResult(Fetcher::Ptr(this), entry); - m_entries.insert(r->uid, Data::EntryPtr(entry)); - emit signalResultFound(r); - ++m_numResults; - ++count; - } - - // are there any additional results to get? - m_hasMoreResults = m_page * WINECOM_RETURNS_PER_REQUEST < m_total; - - const int currentTotal = qMin(m_total, m_limit); - if(m_page * WINECOM_RETURNS_PER_REQUEST < currentTotal) { - int foundCount = (m_page-1) * WINECOM_RETURNS_PER_REQUEST + coll->entryCount(); - message(i18n("Results from %1: %2/%3", source(), foundCount, m_total), MessageHandler::Status); - ++m_page; - doSearch(); - } else { - ++m_page; // need to go to next page - stop(); // required - } -} - -Tellico::Data::EntryPtr WineComFetcher::fetchEntryHook(uint uid_) { - Data::EntryPtr entry = m_entries[uid_]; - if(!entry) { - myWarning() << "no entry in dict"; - return Data::EntryPtr(); - } - - return entry; -} - -void WineComFetcher::initXSLTHandler() { - QString xsltfile = DataFileRegistry::self()->locate(QLatin1String("winecom2tellico.xsl")); - if(xsltfile.isEmpty()) { - myWarning() << "can not locate winecom2tellico.xsl."; - return; - } - - QUrl u = QUrl::fromLocalFile(xsltfile); - - delete m_xsltHandler; - m_xsltHandler = new XSLTHandler(u); - if(!m_xsltHandler->isValid()) { - myWarning() << "error in winecom2tellico.xsl."; - delete m_xsltHandler; - m_xsltHandler = nullptr; - return; - } -} - -Tellico::Fetch::FetchRequest WineComFetcher::updateRequest(Data::EntryPtr entry_) { - // optimistically try searching for title and rely on Collection::sameEntry() to figure things out - QString t = entry_->field(QLatin1String("title")); - if(!t.isEmpty()) { - return FetchRequest(Fetch::Keyword, t); - } - return FetchRequest(); -} - -Tellico::Fetch::ConfigWidget* WineComFetcher::configWidget(QWidget* parent_) const { - return new WineComFetcher::ConfigWidget(parent_, this); -} - -QString WineComFetcher::defaultName() { - return QLatin1String("Wine.com"); // no translation -} - -QString WineComFetcher::defaultIcon() { - return favIcon("http://www.wine.com"); -} - -WineComFetcher::ConfigWidget::ConfigWidget(QWidget* parent_, const WineComFetcher* fetcher_) - : Fetch::ConfigWidget(parent_) { - QGridLayout* l = new QGridLayout(optionsWidget()); - l->setSpacing(4); - l->setColumnStretch(1, 10); - - int row = -1; - QLabel* al = new QLabel(i18n("Registration is required for accessing the %1 data source. " - "If you agree to the terms and conditions, <a href='%2'>sign " - "up for an account</a>, and enter your information below.", - preferredName(), - QLatin1String("https://api.wine.com")), - optionsWidget()); - al->setOpenExternalLinks(true); - al->setWordWrap(true); - ++row; - l->addWidget(al, row, 0, 1, 2); - // richtext gets weird with size - al->setMinimumWidth(al->sizeHint().width()); - - QLabel* label = new QLabel(i18n("Access key: "), optionsWidget()); - l->addWidget(label, ++row, 0); - - m_apiKeyEdit = new QLineEdit(optionsWidget()); - connect(m_apiKeyEdit, SIGNAL(textChanged(const QString&)), SLOT(slotSetModified())); - l->addWidget(m_apiKeyEdit, row, 1); - label->setBuddy(m_apiKeyEdit); - - l->setRowStretch(++row, 10); - - if(fetcher_) { - m_apiKeyEdit->setText(fetcher_->m_apiKey); - } -} - -void WineComFetcher::ConfigWidget::saveConfigHook(KConfigGroup& config_) { - QString apiKey = m_apiKeyEdit->text().trimmed(); - if(!apiKey.isEmpty()) { - config_.writeEntry("API Key", apiKey); - } -} - -QString WineComFetcher::ConfigWidget::preferredName() const { - return WineComFetcher::defaultName(); -} diff --git a/src/fetch/winecomfetcher.h b/src/fetch/winecomfetcher.h deleted file mode 100644 index b1a5c0e2..00000000 --- a/src/fetch/winecomfetcher.h +++ /dev/null @@ -1,106 +0,0 @@ -/*************************************************************************** - Copyright (C) 2009 Robby Stephenson <[email protected]> - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see <http://www.gnu.org/licenses/>. * - * * - ***************************************************************************/ - -#ifndef TELLICO_FETCH_WINECOMFETCHER_H -#define TELLICO_FETCH_WINECOMFETCHER_H - -#include "fetcher.h" -#include "configwidget.h" - -#include <QPointer> - -class QLineEdit; - -class KJob; -namespace KIO { - class StoredTransferJob; -} - -namespace Tellico { - class XSLTHandler; - namespace Fetch { - -/** - * @author Robby Stephenson - */ -class WineComFetcher : public Fetcher { -Q_OBJECT - -public: - WineComFetcher(QObject* parent = nullptr); - ~WineComFetcher(); - - virtual QString source() const Q_DECL_OVERRIDE; - virtual QString attribution() const Q_DECL_OVERRIDE; - virtual bool isSearching() const Q_DECL_OVERRIDE { return m_started; } - virtual void continueSearch() Q_DECL_OVERRIDE; - virtual bool canSearch(FetchKey k) const Q_DECL_OVERRIDE { return k == Keyword; } - virtual void stop() Q_DECL_OVERRIDE; - virtual Data::EntryPtr fetchEntryHook(uint uid) Q_DECL_OVERRIDE; - virtual Type type() const Q_DECL_OVERRIDE { return WineCom; } - virtual bool canFetch(int type) const Q_DECL_OVERRIDE; - virtual void readConfigHook(const KConfigGroup& config) Q_DECL_OVERRIDE; - - virtual Fetch::ConfigWidget* configWidget(QWidget* parent) const Q_DECL_OVERRIDE; - - class ConfigWidget : public Fetch::ConfigWidget { - public: - explicit ConfigWidget(QWidget* parent_, const WineComFetcher* fetcher = nullptr); - virtual void saveConfigHook(KConfigGroup&) Q_DECL_OVERRIDE; - virtual QString preferredName() const Q_DECL_OVERRIDE; - private: - QLineEdit* m_apiKeyEdit; - }; - friend class ConfigWidget; - - static QString defaultName(); - static QString defaultIcon(); - static StringHash allOptionalFields() { return StringHash(); } - -private Q_SLOTS: - void slotComplete(KJob* job); - -private: - virtual void search() Q_DECL_OVERRIDE; - virtual FetchRequest updateRequest(Data::EntryPtr entry) Q_DECL_OVERRIDE; - void initXSLTHandler(); - void doSearch(); - - XSLTHandler* m_xsltHandler; - int m_limit; - int m_page; - int m_total; - int m_numResults; - int m_offset; - - QHash<int, Data::EntryPtr> m_entries; - QPointer<KIO::StoredTransferJob> m_job; - - bool m_started; - QString m_apiKey; -}; - - } -} -#endif diff --git a/src/main.cpp b/src/main.cpp index adf8b63c..51e113b3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - Copyright (C) 2001-2017 Robby Stephenson <[email protected]> + Copyright (C) 2001-2018 Robby Stephenson <[email protected]> ***************************************************************************/ /*************************************************************************** @@ -119,7 +119,7 @@ int main(int argc, char* argv[]) { KAboutData aboutData(QLatin1String("tellico"), QLatin1String("Tellico"), QLatin1String(TELLICO_VERSION), i18n("Tellico - a KDE collection manager"), KAboutLicense::GPL_V2, - i18n("(c) 2001-2017, Robby Stephenson"), + i18n("(c) 2001-2018, Robby Stephenson"), QString(), QLatin1String("http://tellico-project.org")); aboutData.addAuthor(QLatin1String("Robby Stephenson"), QString(), QLatin1String("[email protected]")); diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index ecacdc78..9353acaa 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -795,14 +795,6 @@ add_test(vndbfetchertest vndbfetchertest) ecm_mark_as_test(vndbfetchertest) TARGET_LINK_LIBRARIES(vndbfetchertest fetcherstest ${TELLICO_TEST_LIBS}) -add_executable(winecomfetchertest winecomfetchertest.cpp abstractfetchertest.cpp - ../fetch/winecomfetcher.cpp -) -ecm_mark_nongui_executable(winecomfetchertest) -add_test(winecomfetchertest winecomfetchertest) -ecm_mark_as_test(winecomfetchertest) -TARGET_LINK_LIBRARIES(winecomfetchertest fetcherstest ${TELLICO_TEST_LIBS}) - IF( Yaz_FOUND ) add_executable(z3950fetchertest z3950fetchertest.cpp abstractfetchertest.cpp ../fetch/z3950fetcher.cpp diff --git a/src/tests/winecomfetchertest.cpp b/src/tests/winecomfetchertest.cpp deleted file mode 100644 index 6e5692f1..00000000 --- a/src/tests/winecomfetchertest.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/*************************************************************************** - Copyright (C) 2011 Robby Stephenson <[email protected]> - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see <http://www.gnu.org/licenses/>. * - * * - ***************************************************************************/ - -#undef QT_NO_CAST_FROM_ASCII - -#include "winecomfetchertest.h" - -#include "../fetch/winecomfetcher.h" -#include "../collections/winecollection.h" -#include "../collectionfactory.h" -#include "../entry.h" -#include "../images/imagefactory.h" -#include "../utils/datafileregistry.h" - -#include <KConfig> -#include <KConfigGroup> - -#include <QTest> - -QTEST_GUILESS_MAIN( WineComFetcherTest ) - -WineComFetcherTest::WineComFetcherTest() : AbstractFetcherTest(), m_hasConfigFile(false) - , m_config(QFINDTESTDATA("tellicotest_private.config"), KConfig::SimpleConfig) { -} - -void WineComFetcherTest::initTestCase() { - Tellico::RegisterCollection<Tellico::Data::WineCollection> registerWine(Tellico::Data::Collection::Wine, "wine"); - // since we use the importer - Tellico::DataFileRegistry::self()->addDataLocation(QFINDTESTDATA("../../xslt/winecom2tellico.xsl")); - Tellico::ImageFactory::init(); - - m_hasConfigFile = QFile::exists(QFINDTESTDATA("tellicotest_private.config")); -} - -void WineComFetcherTest::testKeyword() { - const QString groupName = QLatin1String("WineCom"); - if(!m_hasConfigFile || !m_config.hasGroup(groupName)) { - QSKIP("This test requires a config file with Wine.com settings.", SkipAll); - } - KConfigGroup cg(&m_config, groupName); - - Tellico::Fetch::FetchRequest request(Tellico::Data::Collection::Wine, Tellico::Fetch::Keyword, - QLatin1String("1999 Eola Hills Pinot Noir")); - Tellico::Fetch::Fetcher::Ptr fetcher(new Tellico::Fetch::WineComFetcher(this)); - fetcher->readConfig(cg, cg.name()); - - Tellico::Data::EntryList results = DO_FETCH1(fetcher, request, 1); - - QCOMPARE(results.size(), 1); - - Tellico::Data::EntryPtr entry = results.at(0); - QCOMPARE(entry->field(QLatin1String("producer")), QLatin1String("Eola Hills")); - QCOMPARE(entry->field(QLatin1String("appellation")), QLatin1String("Willamette Valley")); - QCOMPARE(entry->field(QLatin1String("vintage")), QLatin1String("1999")); - QCOMPARE(entry->field(QLatin1String("varietal")), QLatin1String("Pinot Noir")); - QCOMPARE(entry->field(QLatin1String("type")), QLatin1String("Red Wine")); - QVERIFY(!entry->field(QLatin1String("label")).isEmpty()); -} diff --git a/src/tests/winecomfetchertest.h b/src/tests/winecomfetchertest.h deleted file mode 100644 index 7256c21c..00000000 --- a/src/tests/winecomfetchertest.h +++ /dev/null @@ -1,46 +0,0 @@ -/*************************************************************************** - Copyright (C) 2011 Robby Stephenson <[email protected]> - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License or (at your option) version 3 or any later version * - * accepted by the membership of KDE e.V. (or its successor approved * - * by the membership of KDE e.V.), which shall act as a proxy * - * defined in Section 14 of version 3 of the license. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see <http://www.gnu.org/licenses/>. * - * * - ***************************************************************************/ - -#ifndef WINECOMFETCHERTEST_H -#define WINECOMFETCHERTEST_H - -#include "abstractfetchertest.h" - -#include <KConfig> - -class WineComFetcherTest : public AbstractFetcherTest { -Q_OBJECT -public: - WineComFetcherTest(); - -private Q_SLOTS: - void initTestCase(); - void testKeyword(); - -private: - bool m_hasConfigFile; - KConfig m_config; -}; - -#endif diff --git a/xslt/CMakeLists.txt b/xslt/CMakeLists.txt index 3af20cc6..666585a7 100644 --- a/xslt/CMakeLists.txt +++ b/xslt/CMakeLists.txt @@ -47,7 +47,6 @@ SET(XSLT_FILES vhs-logo.png vinoxml2tellico.xsl welcome.html - winecom2tellico.xsl xmp2tellico.xsl yahoo2tellico.xsl ) diff --git a/xslt/winecom2tellico.xsl b/xslt/winecom2tellico.xsl deleted file mode 100644 index 00566c29..00000000 --- a/xslt/winecom2tellico.xsl +++ /dev/null @@ -1,110 +0,0 @@ -<?xml version="1.0"?> -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns="http://periapsis.org/tellico/" - xmlns:str="http://exslt.org/strings" - xmlns:exsl="http://exslt.org/common" - extension-element-prefixes="str exsl" - version="1.0"> - -<!-- - =================================================================== - Tellico XSLT file - used for importing data from wine.com - - Copyright (C) 2009 Robby Stephenson <[email protected]> - - This XSLT stylesheet is designed to be used with the 'Tellico' - application, which can be found at http://tellico-project.org - - =================================================================== ---> - -<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" - doctype-public="-//Robby Stephenson/DTD Tellico V11.0//EN" - doctype-system="http://periapsis.org/tellico/dtd/v11/tellico.dtd"/> - -<xsl:template match="/"> - <tellico syntaxVersion="11"> - <collection title="Wine.com Import" type="7"> - <fields> - <field name="_default"/> - <field flags="0" title="URL" category="General" format="4" type="7" name="url" i18n="true"/> - </fields> - <xsl:apply-templates select="Catalog/Products/List/Product[Type='Wine']"/> - </collection> - </tellico> -</xsl:template> - -<xsl:template match="Product"> - <entry> - - <appellation> - <xsl:value-of select="Appellation/Name"/> - </appellation> - - <url> - <xsl:value-of select="Url"/> - </url> - - <vintage> - <xsl:value-of select="Vintage"/> - <xsl:if test="string-length(Vintage) = 0"> - <!-- guess and grab first 4 digits in name --> - <xsl:value-of select="substring(translate(Name, translate(Name, '0123456789', ''), ''), 0, 5)"/> - </xsl:if> - </vintage> - - <producer> - <xsl:value-of select="Vineyard/Name"/> - </producer> - - <varietal> - <xsl:value-of select="Varietal/Name"/> - </varietal> - - <description> - <xsl:value-of select="Description"/> - </description> - - <type i18n="true"> - <xsl:choose> - <xsl:when test="Varietal/WineType/Id = 123"> - <xsl:text>Sparkling Wine</xsl:text> - </xsl:when> - <xsl:when test="Varietal/WineType/Id = 124"> - <xsl:text>Red Wine</xsl:text> - </xsl:when> - <xsl:when test="Varietal/WineType/Id = 125"> - <xsl:text>White Wine</xsl:text> - </xsl:when> - </xsl:choose> - </type> - - <keywords> - <xsl:for-each select="ProductAttributes/ProductAttribute"> - <keyword> - <xsl:value-of select="Name"/> - </keyword> - </xsl:for-each> - </keywords> - - <label> - <xsl:value-of select="Labels/Label[1]/Url"/> - </label> - - </entry> -</xsl:template> - -<xsl:template name="token-union"> - <xsl:param name="tokens"/> - <xsl:choose> - <xsl:when test="not($tokens)"/> - <xsl:otherwise> - <xsl:copy-of select="exsl:node-set(str:tokenize($tokens[1], ','))"/> - <xsl:call-template name="token-union"> - <xsl:with-param name="tokens" select="$tokens[position() > 1]"/> - </xsl:call-template> - </xsl:otherwise> - </xsl:choose> -</xsl:template> - -</xsl:stylesheet>
