2023-05-062023-05-06 Fred Gleason <fredg@paravelsystems.com>

* Refactored the RSS reports in rdadmin(1) to include information on
	missing	items.
	* Modified the feed report in rdcastmanager to include information
	on missing items.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2023-05-06 11:17:44 -04:00
parent 3cf2fe1ce4
commit 47d30f803e
20 changed files with 881 additions and 287 deletions

View File

@@ -2,7 +2,7 @@
##
## Automake.am for rivendell/rdadmin
##
## (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
## (C) Copyright 2002-2023 Fred Gleason <fredg@paravelsystems.com>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License version 2 as
@@ -93,6 +93,7 @@ dist_rdadmin_SOURCES = add_feed.cpp add_feed.h\
edit_user_perms.cpp edit_user_perms.h\
edit_user_service_perms.cpp edit_user_service_perms.h\
edit_vguest_resource.cpp edit_vguest_resource.h\
feedlistview.cpp feedlistview.h\
globals.h\
help_audios.cpp help_audios.h\
importfields.cpp importfields.h\
@@ -176,6 +177,7 @@ nodist_rdadmin_SOURCES = global_credits.cpp\
moc_edit_user_perms.cpp\
moc_edit_user_service_perms.cpp\
moc_edit_vguest_resource.cpp\
moc_feedlistview.cpp\
moc_help_audios.cpp\
moc_importfields.cpp\
moc_info_dialog.cpp\

148
rdadmin/feedlistview.cpp Normal file
View File

@@ -0,0 +1,148 @@
// feedlistview.cpp
//
// RDTableView widget for RSS feeds
//
// (C) Copyright 2021-2023 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// 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, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <QDragEnterEvent>
#include <QHeaderView>
#include <QMessageBox>
#include "rdfeedlistmodel.h"
#include "rdreport.h"
#include "feedlistview.h"
#include "rdtextfile.h"
FeedListView::FeedListView(QWidget *parent)
:RDTableView(parent)
{
d_mouse_row=-1;
//
// Mouse menu
//
d_mouse_menu=new QMenu(this);
d_front_item_report_action=d_mouse_menu->
addAction(tr("Generate Item Report [Front]"),this,SLOT(generateFrontItemReportData()));
d_front_item_report_action->setCheckable(false);
d_back_item_report_action=d_mouse_menu->
addAction(tr("Generate Item Report [Back]"),this,SLOT(generateBackItemReportData()));
d_back_item_report_action->setCheckable(false);
connect(d_mouse_menu,SIGNAL(aboutToShow()),
this,SLOT(aboutToShowMenuData()));
}
FeedListView::~FeedListView()
{
for(int i=0;i<d_xslt_engines.size();i++) {
delete d_xslt_engines.at(i);
}
}
void FeedListView::aboutToShowMenuData()
{
RDFeedListModel *mod=(RDFeedListModel *)model();
if((d_mouse_row<0)||(d_mouse_row>=mod->rowCount())) {
d_front_item_report_action->setEnabled(false);
d_back_item_report_action->setEnabled(false);
}
else {
d_front_item_report_action->setEnabled(true);
d_back_item_report_action->setEnabled(true);
}
}
void FeedListView::generateFrontItemReportData()
{
QDateTime now=QDateTime::currentDateTime();
bool ok=false;
QList<unsigned> front_ids;
QString err_msg;
QString output_filename="report.html";
RDFeedListModel *m=(RDFeedListModel *)model();
QString keyname=m->data(m->index(d_mouse_row,0)).toString();
RDFeed *feed=new RDFeed(keyname,rda->config(),this);
if(feed->frontActiveCasts(&front_ids,&err_msg)) {
QString xml=feed->rssXml(&err_msg,now,&ok,&front_ids);
d_xslt_engines.
push_back(new RDXsltEngine("/usr/share/rivendell/rss-front-item-report.xsl",this));
if(d_xslt_engines.back()->transformXml(&output_filename,xml,&err_msg)) {
RDWebBrowser("file://"+output_filename);
}
else {
QMessageBox::warning(this,"RDAdmin - "+tr("Error"),err_msg);
}
}
else {
QMessageBox::warning(this,"RDAdmin - "+tr("Error"),
tr("Error accessing from XML data.")+"\n"+
"["+err_msg+"]");
}
}
void FeedListView::generateBackItemReportData()
{
QDateTime now=QDateTime::currentDateTime();
bool ok=false;
QList<unsigned> back_ids;
QString err_msg;
QString output_filename="report.html";
RDFeedListModel *m=(RDFeedListModel *)model();
QString keyname=m->data(m->index(d_mouse_row,0)).toString();
RDFeed *feed=new RDFeed(keyname,rda->config(),this);
if(feed->backActiveCasts(&back_ids,&err_msg)) {
QString xml=feed->rssXml(&err_msg,now,&ok,&back_ids);
d_xslt_engines.
push_back(new RDXsltEngine("/usr/share/rivendell/rss-back-item-report.xsl",this));
if(d_xslt_engines.back()->transformXml(&output_filename,xml,&err_msg)) {
RDWebBrowser("file://"+output_filename);
}
else {
QMessageBox::warning(this,"RDAdmin - "+tr("Error"),err_msg);
}
}
else {
QMessageBox::warning(this,"RDAdmin - "+tr("Error"),
tr("Error accessing from XML data.")+"\n"+
"["+err_msg+"]");
}
}
void FeedListView::mousePressEvent(QMouseEvent *e)
{
if(e->button()==Qt::RightButton) {
d_mouse_row=indexAt(e->pos()).row();
if((d_mouse_row>=0)&&(d_mouse_row<model()->rowCount())) {
d_mouse_menu->popup(e->globalPos());
}
else {
d_mouse_row=-1;
}
}
QTableView::mousePressEvent(e);
}

57
rdadmin/feedlistview.h Normal file
View File

@@ -0,0 +1,57 @@
// feedlistview.h
//
// RDTableView widget for RSS feeds
//
// (C) Copyright 2023 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// 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, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#ifndef FEEDLISTVIEW_H
#define FEEDLISTVIEW_H
#include <QAction>
#include <QList>
#include <QMenu>
#include <rdfeed.h>
#include <rdtableview.h>
#include <rdtempdirectory.h>
#include <rdxsltengine.h>
class FeedListView : public RDTableView
{
Q_OBJECT
public:
FeedListView(QWidget *parent=0);
~FeedListView();
private slots:
void aboutToShowMenuData();
void generateFrontItemReportData();
void generateBackItemReportData();
protected:
void mousePressEvent(QMouseEvent *e);
private:
int d_mouse_row;
QMenu *d_mouse_menu;
QAction *d_front_item_report_action;
QAction *d_back_item_report_action;
QList<RDXsltEngine *> d_xslt_engines;
};
#endif // FEEDLISTVIEW_H

View File

@@ -2,7 +2,7 @@
//
// List Rivendell Feeds
//
// (C) Copyright 2002-2022 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2023 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@@ -98,7 +98,7 @@ ListFeeds::ListFeeds(QWidget *parent)
//
// Feed List
//
list_feeds_view=new RDFeedListView(this);
list_feeds_view=new FeedListView(this);
list_feeds_model=new RDFeedListModel(true,false,this);
list_feeds_model->setFont(font());
list_feeds_model->setPalette(palette());

View File

@@ -2,7 +2,7 @@
//
// List Rivendell RSS Feeds
//
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2023 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@@ -25,9 +25,10 @@
#include <rddialog.h>
#include <rdfeedlistmodel.h>
#include <rdfeedlistview.h>
#include <rdtableview.h>
#include <feedlistview.h>
class ListFeeds : public RDDialog
{
Q_OBJECT
@@ -52,7 +53,7 @@ class ListFeeds : public RDDialog
private:
QLabel *list_box_label;
RDFeedListView *list_feeds_view;
FeedListView *list_feeds_view;
RDFeedListModel *list_feeds_model;
QPushButton *list_add_button;
QPushButton *list_edit_button;

View File

@@ -2,7 +2,9 @@
#
# The QMake project file for RDAdmin.
#
# (C) Copyright 2003-2021 Fred Gleason <fredg@paravelsystems.com>
# (C) Copyright 2003-2023 Fred Gleason <fredg@paravelsystems.com>
#
# NB - This data is used only by Qt's i18n tools!
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
@@ -59,6 +61,7 @@ x11 {
SOURCES += edit_user.cpp
SOURCES += edit_user_perms.cpp
SOURCES += edit_vguest_resource.cpp
SOURCES += feedlistview.cpp
SOURCES += info_dialog.cpp
SOURCES += license.cpp
SOURCES += list_dropboxes.cpp
@@ -129,6 +132,7 @@ x11 {
HEADERS += edit_user.h
HEADERS += edit_user_perms.h
HEADERS += edit_vguest_resource.h
HEADERS += feedlistview.h
HEADERS += info_dialog.h
HEADERS += license.h
HEADERS += list_dropboxes.h