File indexing completed on 2024-05-12 04:52:21

0001 /*
0002  * xmltv.h
0003  *
0004  * Copyright (C) 2019 Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
0005  *
0006  * This program is free software; you can redistribute it and/or modify
0007  * it under the terms of the GNU General Public License as published by
0008  * the Free Software Foundation; either version 2 of the License, or
0009  * (at your option) any later version.
0010  *
0011  * This program is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  * GNU General Public License for more details.
0015  */
0016 
0017 #ifndef XMLTV_H
0018 #define XMLTV_H
0019 
0020 #include <QFileSystemWatcher>
0021 #include <QThread>
0022 
0023 class DvbChannelModel;
0024 class DvbManager;
0025 class QXmlStreamReader;
0026 
0027 class XmlTv : public QObject
0028 {
0029 Q_OBJECT
0030 
0031 private:
0032     DvbManager *manager;
0033     DvbChannelModel *channelModel;
0034     DvbEpgModel *epgModel;
0035     QXmlStreamReader *r;
0036 
0037     // Maps display name into XmlTV channel name
0038     QHash<QString, QList<QString>> channelMap;
0039 
0040     bool parseChannel(void);
0041     bool parseProgram(void);
0042     QString parseCredits(void);
0043     void ignoreTag(void);
0044     void parseKeyValues(QHash<QString, QString> &keyValues);
0045     QString getValue(QHash<QString, QString> &keyValues, QString key);
0046     DvbEpgLangEntry *getLangEntry(DvbEpgEntry &epgEntry,
0047                       QString &code,
0048                           bool add_code);
0049 
0050 
0051     QFileSystemWatcher watcher;
0052 
0053 private slots:
0054     bool load(QString file);
0055 
0056 public:
0057     explicit XmlTv(DvbManager *manager);
0058     void addFile(QString file);
0059     void clear();
0060 };
0061 
0062 #endif