2018-01-31 Fred Gleason <fredg@paravelsystems.com>

* Converted rdcastmanager(1) to use RDApplication.
This commit is contained in:
Fred Gleason 2018-01-30 22:36:54 -05:00
parent fea158708a
commit e179bea9d7
13 changed files with 110 additions and 135 deletions

View File

@ -16603,3 +16603,5 @@
* Converted rdairplay(1) to use RDApplication.
2018-01-31 Fred Gleason <fredg@paravelsystems.com>
* Converted rdcartslots(1) to use RDApplication.
2018-01-31 Fred Gleason <fredg@paravelsystems.com>
* Converted rdcastmanager(1) to use RDApplication.

View File

@ -2,7 +2,7 @@
//
// Edit a Rivendell Cast
//
// (C) Copyright 2002-2004,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2004,2016-2018 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
@ -27,15 +27,16 @@
#include <qdatetime.h>
#include <qradiobutton.h>
#include <rdapplication.h>
#include <rddb.h>
#include <rddatedialog.h>
#include <rdfeed.h>
#include <rdescape_string.h>
#include <pick_report_dates.h>
#include <rdconf.h>
#include <globals.h>
#include <edit_cast.h>
#include "edit_cast.h"
#include "globals.h"
#include "pick_report_dates.h"
EditCast::EditCast(unsigned cast_id,QWidget *parent)
: QDialog(parent,"",true)
@ -45,8 +46,8 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent)
RDSqlQuery *q1;
int ypos=0;
cast_cast=new RDPodcast(config,cast_id);
cast_feed=new RDFeed(cast_cast->feedId(),config);
cast_cast=new RDPodcast(rda->config(),cast_id);
cast_feed=new RDFeed(cast_cast->feedId(),rda->config());
cast_status=cast_cast->status();
setCaption(tr("Editing PodCast"));

View File

@ -2,7 +2,7 @@
//
// Global Variable Declarations for RDCastManager
//
// (C) Copyright 2007,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2007,2016-2018 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
@ -22,11 +22,6 @@
#define GLOBALS_H
#include <qstring.h>
#include <rduser.h>
#include <rdripc.h>
#include <rdstation.h>
#include <rdconfig.h>
#include <rdsystem.h>
//
// Global Resources
@ -34,11 +29,6 @@
extern QString cast_filter;
extern QString cast_group;
extern QString cast_schedcode;
extern RDUser *cast_user;
extern RDRipc *cast_ripc;
extern RDConfig *config;
extern RDStation *rdstation_conf;
extern RDSystem *cast_system;
#endif // GLOBALS_H

View File

@ -2,7 +2,7 @@
//
// List Rivendell Casts
//
// (C) Copyright 2002-2007,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2007,2016-2018 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
@ -37,23 +37,24 @@
#include <qapplication.h>
#include <qfiledialog.h>
#include <rddb.h>
#include <rdpodcast.h>
#include <rdtextfile.h>
#include <rdcut_dialog.h>
#include <rdapplication.h>
#include <rdcastsearch.h>
#include <rdconf.h>
#include <rdcut.h>
#include <rdwavefile.h>
#include <rdcut_dialog.h>
#include <rddb.h>
#include <rdescape_string.h>
#include <rdurl.h>
#include <rdfeedlog.h>
#include <rdpodcast.h>
#include <rdsettings.h>
#include <rdcastsearch.h>
#include <rdtextfile.h>
#include <rdwavefile.h>
#include <rdurl.h>
#include <list_casts.h>
#include <edit_cast.h>
#include <globals.h>
#include <pick_report_dates.h>
#include "edit_cast.h"
#include "globals.h"
#include "list_casts.h"
#include "pick_report_dates.h"
//
// Icons
@ -95,7 +96,7 @@ ListCasts::ListCasts(unsigned feed_id,QWidget *parent)
//
// The Feed
//
list_feed=new RDFeed(feed_id,config,this);
list_feed=new RDFeed(feed_id,rda->config(),this);
//
// Progress Dialog
@ -219,7 +220,7 @@ ListCasts::ListCasts(unsigned feed_id,QWidget *parent)
RefreshList();
GetEncoderId();
connect(cast_ripc,SIGNAL(userChanged()),this,SLOT(userChangedData()));
connect(rda->ripc(),SIGNAL(userChanged()),this,SLOT(userChangedData()));
userChangedData();
}
@ -246,17 +247,17 @@ QSizePolicy ListCasts::sizePolicy() const
void ListCasts::addCartData()
{
QString cutname;
RDCutDialog *cd=new RDCutDialog(&cutname,rdstation_conf,cast_system,
RDCutDialog *cd=new RDCutDialog(&cutname,rda->station(),rda->system(),
&cast_filter,&cast_group,&cast_schedcode,
cast_ripc->user());
rda->ripc()->user());
if(cd->exec()!=0) {
delete cd;
return;
}
delete cd;
RDFeed::Error err;
unsigned cast_id=list_feed->postCut(cast_user,rdstation_conf,cutname,&err,
config->logXloadDebugData(),config);
unsigned cast_id=list_feed->postCut(rda->user(),rda->station(),cutname,&err,
rda->config()->logXloadDebugData(),rda->config());
if(err!=RDFeed::ErrorOk) {
QMessageBox::warning(this,tr("Posting Error"),RDFeed::errorString(err));
return;
@ -279,8 +280,8 @@ void ListCasts::addFileData()
return;
}
RDFeed::Error err;
unsigned cast_id=list_feed->postFile(rdstation_conf,srcfile,&err,
config->logXloadDebugData(),config);
unsigned cast_id=list_feed->postFile(rda->station(),srcfile,&err,
rda->config()->logXloadDebugData(),rda->config());
if(err!=RDFeed::ErrorOk) {
QMessageBox::warning(this,tr("Posting Error"),RDFeed::errorString(err));
return;
@ -335,8 +336,8 @@ void ListCasts::deleteData()
qApp->processEvents();
sleep(1);
qApp->processEvents();
RDPodcast *cast=new RDPodcast(config,item->id());
if(!cast->removeAudio(list_feed,&err_text,config->logXloadDebugData())) {
RDPodcast *cast=new RDPodcast(rda->config(),item->id());
if(!cast->removeAudio(list_feed,&err_text,rda->config()->logXloadDebugData())) {
if(QMessageBox::warning(this,tr("Remote Error"),
tr("Unable to delete remote audio!\n")+
tr("The server said: \"")+err_text+"\".\n\n"+
@ -384,10 +385,10 @@ void ListCasts::doubleClickedData(QListViewItem *item,const QPoint &pt,
void ListCasts::userChangedData()
{
list_cart_button->setEnabled(cast_user->addPodcast()&&(list_encoder_id>=0));
list_file_button->setEnabled(cast_user->addPodcast()&&(list_encoder_id>=0));
list_edit_button->setEnabled(cast_user->editPodcast());
list_delete_button->setEnabled(cast_user->deletePodcast());
list_cart_button->setEnabled(rda->user()->addPodcast()&&(list_encoder_id>=0));
list_file_button->setEnabled(rda->user()->addPodcast()&&(list_encoder_id>=0));
list_edit_button->setEnabled(rda->user()->editPodcast());
list_delete_button->setEnabled(rda->user()->deletePodcast());
}
@ -513,7 +514,7 @@ void ListCasts::GetEncoderId()
RDSqlQuery *q;
list_encoder_id=-1;
RDFeed *feed=new RDFeed(list_feed_id,config);
RDFeed *feed=new RDFeed(list_feed_id,rda->config());
int format=feed->uploadFormat();
delete feed;
if((format>0)&&(format<100)) { // Built-in format
@ -526,7 +527,7 @@ void ListCasts::GetEncoderId()
sql=QString().sprintf("select ID from ENCODERS \
where (NAME=\"%s\")&&(STATION_NAME=\"%s\")",
(const char *)RDEscapeString(q->value(0).toString()),
(const char *)RDEscapeString(rdstation_conf->name()));
(const char *)RDEscapeString(rda->station()->name()));
delete q;
q=new RDSqlQuery(sql);
if(q->first()) {

View File

@ -2,7 +2,7 @@
//
// Select a Set of Dates for a Rivendell Report
//
// (C) Copyright 2002-2006,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2006,2016-2017 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
@ -23,16 +23,17 @@
#include <qmessagebox.h>
#include <qfile.h>
#include <rddatedialog.h>
#include <rdreport.h>
#include <rddatedecode.h>
#include <rdapplication.h>
#include <rddb.h>
#include <rdtextfile.h>
#include <rddatedecode.h>
#include <rddatedialog.h>
#include <rdfeed.h>
#include <rdpodcast.h>
#include <rdreport.h>
#include <rdtextfile.h>
#include <globals.h>
#include <pick_report_dates.h>
#include "globals.h"
#include "pick_report_dates.h"
PickReportDates::PickReportDates(unsigned feed_id,unsigned cast_id,
QWidget *parent)
@ -191,7 +192,7 @@ void PickReportDates::GenerateSubscriptionReport(const QString &keyname,
QString sql;
RDSqlQuery *q;
RDFeed *feed=new RDFeed(keyname,config,this);
RDFeed *feed=new RDFeed(keyname,rda->config(),this);
unsigned total=0;
unsigned rss_total=0;
unsigned audio_total=0;
@ -253,8 +254,8 @@ void PickReportDates::GenerateEpisodeReport(const QString &keyname,
QString sql;
RDSqlQuery *q;
RDFeed *feed=new RDFeed(keyname,config,this);
RDPodcast *cast=new RDPodcast(config,cast_id);
RDFeed *feed=new RDFeed(keyname,rda->config(),this);
RDPodcast *cast=new RDPodcast(rda->config(),cast_id);
//
// Header

View File

@ -2,7 +2,7 @@
//
// A PodCast Management Utility for Rivendell.
//
// (C) Copyright 2002-2005,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2005,2016-2018 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
@ -35,18 +35,18 @@
#include <qpainter.h>
#include <qmessagebox.h>
#include <rd.h>
#include <rdconf.h>
#include <rduser.h>
#include <rdripc.h>
#include <rdcastmanager.h>
#include <rdcmd_switch.h>
#include <rddb.h>
#include <rdpodcast.h>
#include <dbversion.h>
#include <rd.h>
#include <rdapplication.h>
#include <rdcmd_switch.h>
#include <rdconf.h>
#include <rddb.h>
#include <rdescape_string.h>
#include <rdpodcast.h>
#include <list_casts.h>
#include <globals.h>
#include "globals.h"
#include "list_casts.h"
#include "rdcastmanager.h"
//
// Icons
@ -61,19 +61,13 @@
QString cast_filter;
QString cast_group;
QString cast_schedcode;
RDUser *cast_user;
RDRipc *cast_ripc;
RDStation *rdstation_conf;
RDConfig *config;
RDSystem *cast_system=NULL;
MainWidget::MainWidget(QWidget *parent)
:QMainWindow(parent)
{
QString str1;
QString str2;
bool skip_db_check=false;
unsigned schema=0;
QString err_msg;
//
// Read Command Options
@ -82,7 +76,6 @@ MainWidget::MainWidget(QWidget *parent)
new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdcastmanager","\n");
for(unsigned i=0;i<cmd->keys();i++) {
if(cmd->key(i)=="--skip-db-check") {
skip_db_check=true;
}
}
delete cmd;
@ -93,59 +86,29 @@ MainWidget::MainWidget(QWidget *parent)
setMinimumWidth(sizeHint().width());
setMinimumHeight(sizeHint().height());
//
// Load Local Configs
//
config=new RDConfig(RD_CONF_FILE);
config->load();
config->setModuleName("RDCastManager");
rda=new RDApplication("RDCastManager",this);
if(!rda->open(&err_msg)) {
QMessageBox::critical(this,"RDCastManager - "+tr("Error"),err_msg);
exit(1);
}
str1=QString("RDCastManager")+" v"+VERSION+" - "+tr("Host");
str2=QString(tr("User: [Unknown]"));
setCaption(QString().sprintf("%s: %s, %s",(const char *)str1,
(const char *)config->stationName(),
(const char *)str2));
//
// Open Database
//
QString err;
QSqlDatabase *db=RDInitDb(&schema,&err);
if(!db) {
QMessageBox::warning(this,tr("Can't Connect"),err);
exit(0);
}
if((schema!=RD_VERSION_DATABASE)&&(!skip_db_check)) {
fprintf(stderr,
"rdcastmanager: database version mismatch, should be %u, is %u\n",
RD_VERSION_DATABASE,schema);
exit(256);
}
//
// Station Configuration
//
rdstation_conf=new RDStation(config->stationName(),this);
cast_system=new RDSystem();
setCaption(str1+": "+rda->config()->stationName()+" "+str2);
//
// RIPC Connection
//
#ifndef WIN32
cast_ripc=new RDRipc(rdstation_conf,config,this);
connect(cast_ripc,SIGNAL(userChanged()),this,SLOT(userChangedData()));
cast_ripc->connectHost("localhost",RIPCD_TCP_PORT,config->password());
#else
cast_ripc=NULL;
connect(rda->ripc(),SIGNAL(userChanged()),this,SLOT(userChangedData()));
rda->ripc()->connectHost("localhost",RIPCD_TCP_PORT,rda->config()->password());
#endif // WIN32
//
// User
//
#ifndef WIN32
cast_user=NULL;
#else
cast_user=new RDUser(RD_USER_LOGIN_NAME);
#ifdef WIN32
rda->user()->setName(RD_USER_LOGIN_NAME);
#endif // WIN32
//
@ -222,16 +185,10 @@ void MainWidget::userChangedData()
QString str1;
QString str2;
if(cast_user!=NULL) {
delete cast_user;
}
rda->user()->setName(rda->ripc()->user());
str1=QString("RDCastManager")+" v"+VERSION+" - "+tr("Host");
str2=QString(tr("User"));
setCaption(QString().sprintf("%s: %s, %s: %s",(const char *)str1,
(const char *)config->stationName(),
(const char *)str2,
(const char *)cast_ripc->user()));
cast_user=new RDUser(cast_ripc->user());
setCaption(str1+": "+rda->config()->stationName()+" "+str2+" "+rda->ripc()->user());
RefreshList();
}
@ -323,9 +280,8 @@ void MainWidget::RefreshList()
id=item->id();
}
cast_feed_list->clear();
sql=QString().sprintf("select KEY_NAME from FEED_PERMS \
where USER_NAME=\"%s\"",
(const char *)cast_user->name());
sql=QString("select KEY_NAME from FEED_PERMS where ")+
"USER_NAME=\""+RDEscapeString(rda->user()->name())+"\"";
q=new RDSqlQuery(sql);
if(q->size()<=0) { // No valid feeds!
delete q;

View File

@ -299,7 +299,7 @@ Podcast trotzdem löschen?</translation>
</message>
<message>
<source>Can&apos;t Connect</source>
<translation>Nelze spojit</translation>
<translation type="obsolete">Nelze spojit</translation>
</message>
<message>
<source>Key Name</source>
@ -335,6 +335,10 @@ přívod</translation>
<source>Host</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PickReportDates</name>

View File

@ -288,7 +288,7 @@ Podcast trotzdem löschen?</translation>
</message>
<message>
<source>Can&apos;t Connect</source>
<translation>Kann mich nicht verbinden</translation>
<translation type="obsolete">Kann mich nicht verbinden</translation>
</message>
<message>
<source>Key Name</source>
@ -324,6 +324,10 @@ Feed</translation>
<source>Host</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PickReportDates</name>

View File

@ -239,7 +239,7 @@ Suscripción</translation>
</message>
<message>
<source>Can&apos;t Connect</source>
<translation>No puedo conectarme</translation>
<translation type="obsolete">No puedo conectarme</translation>
</message>
<message>
<source>Key Name</source>
@ -274,6 +274,10 @@ Feed</source>
<source>Host</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PickReportDates</name>

View File

@ -228,10 +228,6 @@ Car&amp;t/Cut</source>
<source>User: [Unknown]</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Can&apos;t Connect</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Key Name</source>
<translation type="unfinished"></translation>
@ -265,6 +261,10 @@ Feed</source>
<source>Host</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PickReportDates</name>

View File

@ -287,7 +287,7 @@ Vil du halda fram med å sletta podkasten?</translation>
</message>
<message>
<source>Can&apos;t Connect</source>
<translation>Greier ikkje kopla til</translation>
<translation type="obsolete">Greier ikkje kopla til</translation>
</message>
<message>
<source>Key Name</source>
@ -323,6 +323,10 @@ straum</translation>
<source>Host</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PickReportDates</name>

View File

@ -287,7 +287,7 @@ Vil du halda fram med å sletta podkasten?</translation>
</message>
<message>
<source>Can&apos;t Connect</source>
<translation>Greier ikkje kopla til</translation>
<translation type="obsolete">Greier ikkje kopla til</translation>
</message>
<message>
<source>Key Name</source>
@ -323,6 +323,10 @@ straum</translation>
<source>Host</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PickReportDates</name>

View File

@ -253,7 +253,7 @@ Continuar deletando cast?</translation>
</message>
<message>
<source>Can&apos;t Connect</source>
<translation>Não foi possível conectar</translation>
<translation type="obsolete">Não foi possível conectar</translation>
</message>
<message>
<source>Key Name</source>
@ -289,6 +289,10 @@ Feed</translation>
<source>Host</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PickReportDates</name>