From f680479965bf13285a955873c48db47bd0c935d3 Mon Sep 17 00:00:00 2001 From: llornkcor Date: Sun, 28 Aug 2005 19:53:11 +0000 Subject: podcast! support.. 1st installment. needs improvements --- (limited to 'core/multimedia/opieplayer/rssparser.h') diff --git a/core/multimedia/opieplayer/rssparser.h b/core/multimedia/opieplayer/rssparser.h new file mode 100644 index 0000000..669ece5 --- a/dev/null +++ b/core/multimedia/opieplayer/rssparser.h @@ -0,0 +1,122 @@ +/*************************************************************************** + * Copyright (C) 2004 by ljp * + * lpotter@trolltech.com * + * * + * This program may be distributed under the terms of the Q Public * + * License as defined by Trolltech AS of Norway and appearing in the * + * file LICENSE.QPL included in the packaging of this file. * + * * + * 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. * + ***************************************************************************/ + +/* RSS required tags: + title,link,description +*/ +/* RSS optional tags: + language,copyright,managingEditor,webMaster,pubDate,lastBuildDate,category,generator,docs,cloud,ttl, + image,rating,textInput,skipHours,skipDays +*/ +/* + podcast tags + + title,link,copyright,pubDate,enclosure,guid,itunes:author,itunes:block,itunes:category,itunes:duration,itunes:explicit,itunes:keywords,itunes:owner,itunes:subtitle,itunes:summary +*/ + +#ifndef RSSPARSER_H +#define RSSPARSER_H + +#include +#include +#include +#include +#include + +class QString; + +class rssImage { +public: + QString url; + QString title; + int width; + int height; + QString description; +}; + +class rssItem { + public: + QString title; + QString description; + QString link; + QString pubdate; + QVector rssImageTags; + QList attributes; //tags with atttributes +}; + +class rssChannel { + public: + QString title; + QString description; + QString link; + QString pubdate; + QString copyright; + QString language; + QVector rssImageTags; + QVector rssItems; + QList attributes; //tags with atttributes +}; + +class RssParser : public QXmlDefaultHandler +{ +public: + RssParser(); + ~RssParser(); + QString errorMessage; + + QVector &getItems(); + QStringList getChannelInfo(); + int getSize(); + +private: + + enum Tag { + NoneTag = 0, + TitleTag = 1, + NewItemTag = 2, + DescriptionTag = 3, + LinkTag = 4, + pubDateTag = 5, +/* + ImageTag = 6, + UrlTag = 7, + WidthTag = 8, + HeightTag = 9, + */ + }; + Tag tag; + +// QVector rssItems; + QStringList channelInfo; + rssItem *Item; + rssChannel *channel; + rssImage *image; + + bool isItem; + QStringList tokenNames; + QString htmlString; + +protected: + + bool startElement( const QString&, const QString&, const QString& ,const QXmlAttributes& ); + bool endElement( const QString&, const QString&, const QString& ); + bool characters( const QString &); + + bool warning(const QXmlParseException &); + bool error(const QXmlParseException &); + bool fatalError(const QXmlParseException &); + + QString itemTitle, itemLink, itemDescription; +}; + +#endif -- cgit v0.9.0.2