2021-06-21 Fred Gleason <fredg@paravelsystems.com>

* Removed the rddgimport(1) applet.
	* Removed vestigal bits of the rddiscimport(1) applet.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2021-06-21 11:55:37 -04:00
parent d19a16a8dd
commit 6dab5b341f
21 changed files with 3 additions and 1675 deletions

View File

@@ -21948,3 +21948,6 @@
* Added 'RDMainWindow' to rdselect(1).
2021-06-21 Fred Gleason <fredg@paravelsystems.com>
* Added 'RDMainWindow' to rdgpimon(1).
2021-06-21 Fred Gleason <fredg@paravelsystems.com>
* Removed the rddgimport(1) applet.
* Removed vestigal bits of the rddiscimport(1) applet.

View File

@@ -606,7 +606,6 @@ AC_CONFIG_FILES([rivendell.spec \
utils/rddbconfig/Makefile \
utils/rddbmgr/Makefile \
utils/rddelete/Makefile \
utils/rddgimport/Makefile \
utils/rdexport/Makefile \
utils/rdgen/Makefile \
utils/rdgpimon/Makefile \

1
debian/rules vendored
View File

@@ -29,7 +29,6 @@ binary:
mv debian/tmp/usr/bin/crc-unity4k.sh debian/rivendell-importers/usr/bin/
mv debian/tmp/usr/bin/rdcatch_copy debian/rivendell-importers/usr/bin/
mv debian/tmp/usr/bin/panel_copy debian/rivendell-importers/usr/bin/
mv debian/tmp/usr/bin/rddgimport debian/rivendell-importers/usr/bin/
#
# rivendell-opsguide

View File

@@ -454,9 +454,6 @@ rm -rf $RPM_BUILD_ROOT
%{_bindir}/crc-unity4k.sh
%{_bindir}/rdcatch_copy
%{_bindir}/panel_copy
%{_bindir}/rddgimport
%{_datadir}/applications/rivendell-rddgimport.desktop
%{_datadir}/applications/rivendell-rddiscimport.desktop
%files opsguide

View File

@@ -24,7 +24,6 @@ if ALSA_RD_AM
ALSACONFIG_RD_OPT = rdalsaconfig
endif
SUBDIRS = $(ALSACONFIG_RD_OPT)\
rddgimport\
rdcheckcuts\
rdcleandirs\
rdclilogedit\

View File

@@ -1,69 +0,0 @@
## Makefile.am
##
## (C) Copyright 2002-2021 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.
##
## Use automake to process this into a Makefile.in
AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -Wno-strict-aliasing -std=c++11 -fPIC -I$(top_srcdir)/lib @QT5_CFLAGS@ @MUSICBRAINZ_CFLAGS@
LIBS = -L$(top_srcdir)/lib
MOC = @QT_MOC@
LUPDATE = @QT_LUPDATE@
LRELEASE = @QT_LRELEASE@
# The dependency for qt's Meta Object Compiler (moc)
moc_%.cpp: %.h
$(MOC) $< -o $@
# I18N Stuff
install-exec-local:
mkdir -p $(DESTDIR)$(prefix)/share/rivendell
cp rddgimport_*.qm $(DESTDIR)$(prefix)/share/rivendell
uninstall-local:
rm -f $(DESTDIR)$(prefix)/share/rivendell/rddgimport_*.qm
all:
$(LUPDATE) rddgimport.pro
$(LRELEASE) rddgimport.pro
bin_PROGRAMS = rddgimport
dist_rddgimport_SOURCES = event.cpp event.h\
rddgimport.cpp rddgimport.h
nodist_rddgimport_SOURCES = moc_rddgimport.cpp
rddgimport_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT5_LIBS@ @MUSICBRAINZ_LIBS@
EXTRA_DIST = rddgimport.pro\
rddgimport_de.ts\
rddgimport_es.ts\
rddgimport_fr.ts\
rddgimport_nb.ts\
rddgimport_nn.ts\
rddgimport_pt_BR.ts
CLEANFILES = *~\
*.idb\
*ilk\
*.obj\
*.pdb\
*.qm\
moc_*
MAINTAINERCLEANFILES = *~\
Makefile.in\
moc_*

View File

@@ -1,86 +0,0 @@
// event.cpp
//
// Abstract a Dial Global Spot Event
//
// (C) Copyright 2012-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
// 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 "event.h"
Event::Event()
{
evt_length=0;
}
QTime Event::time() const
{
return evt_time;
}
void Event::setTime(const QTime &time)
{
evt_time=time;
}
int Event::length() const
{
return evt_length;
}
void Event::setLength(int msec)
{
evt_length=msec;
}
QString Event::isci() const
{
return evt_isci;
}
void Event::setIsci(const QString &str)
{
evt_isci=str;
}
QString Event::title() const
{
return evt_title;
}
void Event::setTitle(const QString &str)
{
evt_title=str;
}
QString Event::client() const
{
return evt_client;
}
void Event::setClient(const QString &str)
{
evt_client=str;
}

View File

@@ -1,51 +0,0 @@
// event.h
//
// Abstract a Dial Global Spot Event
//
// (C) Copyright 2012-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
// 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 EVENT_H
#define EVENT_H
#include <qstring.h>
#include <qdatetime.h>
class Event
{
public:
Event();
QTime time() const;
void setTime(const QTime &time);
int length() const;
void setLength(int msec);
QString isci() const;
void setIsci(const QString &str);
QString title() const;
void setTitle(const QString &str);
QString client() const;
void setClient(const QString &str);
private:
QTime evt_time;
int evt_length;
QString evt_isci;
QString evt_title;
QString evt_client;
};
#endif // EVENT_H

View File

@@ -1,662 +0,0 @@
// rddgimport.cpp
//
// A Qt-based application for importing Dial Global CDN downloads
//
// (C) Copyright 2012-2021 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 <errno.h>
#include <QApplication>
#include <QFileDialog>
#include <QMessageBox>
#include <QScrollBar>
#include <QTranslator>
#include <rdaudioimport.h>
#include <rdconf.h>
#include <rddatedecode.h>
#include <rddatedialog.h>
#include <rdescape_string.h>
#include "rddgimport.h"
//
// Icons
//
#include "../../icons/rivendell-22x22.xpm"
MainWidget::MainWidget(RDConfig *c,QWidget *parent)
: RDWidget(c,parent)
{
QString sql;
RDSqlQuery *q;
QString err_msg;
dg_group=NULL;
dg_svc=NULL;
//
// Create And Set Icon
//
setWindowIcon(QPixmap(rivendell_22x22_xpm));
//
// Open the Database
//
rda=new RDApplication("RDDgImport","rddgimport",RDDGIMPORT_USAGE,this);
if(!rda->open(&err_msg)) {
QMessageBox::critical(this,"RDDgImport - "+tr("Error"),err_msg);
exit(1);
}
//
// Read Command Options
//
for(unsigned i=0;i<rda->cmdSwitch()->keys();i++) {
if(!rda->cmdSwitch()->processed(i)) {
QMessageBox::critical(this,"RDDgImport - "+tr("Error"),
tr("Unknown command option")+": "+
rda->cmdSwitch()->key(i));
exit(2);
}
}
//
// Set Window Size
//
setMinimumSize(sizeHint());
SetCaption();
//
// Configuration Elements
//
connect(rda,SIGNAL(userChanged()),this,SLOT(userChangedData()));
rda->ripc()->connectHost("localhost",RIPCD_TCP_PORT,rda->config()->password());
//
// Service Selector
//
dg_service_box=new QComboBox(this);
connect(dg_service_box,SIGNAL(activated(int)),
this,SLOT(serviceActivatedData(int)));
dg_service_label=new QLabel(tr("Service:"),this);
dg_service_label->setFont(labelFont());
dg_service_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
//
// File Selector
//
dg_filename_edit=new QLineEdit(this);
connect(dg_filename_edit,SIGNAL(textChanged(const QString &)),
this,SLOT(filenameChangedData(const QString &)));
dg_filename_label=new QLabel(tr("Filename:"),this);
dg_filename_label->setFont(labelFont());
dg_filename_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
dg_filename_button=new QPushButton(tr("Select"),this);
dg_filename_button->setFont(subButtonFont());
connect(dg_filename_button,SIGNAL(clicked()),
this,SLOT(filenameSelectedData()));
//
// Date Selector
//
dg_date_edit=new QDateEdit(this);
dg_date_edit->setDisplayFormat("MM/dd/yyyy");
dg_date_edit->setDate(QDate::currentDate());
dg_date_label=new QLabel(tr("Date:"),this);
dg_date_label->setFont(labelFont());
dg_date_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
dg_date_button=new QPushButton(tr("Select"),this);
dg_date_button->setFont(subButtonFont());
connect(dg_date_button,SIGNAL(clicked()),
this,SLOT(dateSelectedData()));
//
// Progress Bar
//
dg_bar=new RDBusyBar(this);
dg_bar->setDisabled(true);
//
// Messages Area
//
dg_messages_text=new QTextEdit(this);
dg_messages_text->setReadOnly(true);
dg_messages_label=new QLabel(tr("Messages"),this);
dg_messages_label->setFont(labelFont());
dg_messages_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
//
// Process Button
//
dg_process_button=new QPushButton(tr("Process"),this);
dg_process_button->setFont(buttonFont());
dg_process_button->setDisabled(true);
connect(dg_process_button,SIGNAL(clicked()),this,SLOT(processData()));
//
// Close Button
//
dg_close_button=new QPushButton(tr("Close"),this);
dg_close_button->setFont(buttonFont());
connect(dg_close_button,SIGNAL(clicked()),this,SLOT(quitMainWidget()));
//
// Load Service List
//
sql="select NAME,AUTOSPOT_GROUP from SERVICES order by NAME";
q=new RDSqlQuery(sql);
while(q->next()) {
if(!q->value(1).toString().isEmpty()) {
dg_service_box->
insertItem(dg_service_box->count(),q->value(0).toString());
}
}
delete q;
if(dg_service_box->count()==0) {
QMessageBox::information(this,tr("RDDgImport"),
tr("No AutoSpot-enabled services found!"));
exit(0);
}
serviceActivatedData(0);
}
QSize MainWidget::sizeHint() const
{
return QSize(400,300);
}
void MainWidget::serviceActivatedData(int index)
{
if(dg_svc!=NULL) {
delete dg_svc;
}
dg_svc=new RDSvc(dg_service_box->currentText(),rda->station(),rda->config());
if(dg_group!=NULL) {
delete dg_group;
}
dg_group=new RDGroup(dg_svc->autospotGroup());
}
void MainWidget::filenameChangedData(const QString &str)
{
dg_process_button->setDisabled(str.isEmpty());
}
void MainWidget::filenameSelectedData()
{
QString filename=dg_filename_edit->text();
if(filename.isEmpty()) {
filename=RDGetHomeDir();
}
filename=
QFileDialog::getOpenFileName(this,"RDDgImport - "+tr("Open File"),filename,
tr("Text Files")+" (*.txt *.TXT);;"+
tr("All Files")+" (*.*)");
if(!filename.isEmpty()) {
dg_filename_edit->setText(filename);
filenameChangedData(filename);
}
}
void MainWidget::dateSelectedData()
{
QDate date=dg_date_edit->date();
QDate now=QDate::currentDate();
RDDateDialog *d=new RDDateDialog(now.year(),now.year()+1,this);
if(d->exec(&date)==0) {
dg_date_edit->setDate(date);
}
delete d;
}
void MainWidget::processData()
{
ActivateBar(true);
if(LoadEvents()) {
if(ImportAudio()) {
if(WriteTrafficFile()) {
QMessageBox::information(this,tr("RDDgImport"),
tr("Processing Complete!"));
}
}
}
ActivateBar(false);
}
void MainWidget::userChangedData()
{
SetCaption();
}
void MainWidget::quitMainWidget()
{
qApp->quit();
}
void MainWidget::resizeEvent(QResizeEvent *e)
{
dg_service_label->setGeometry(10,10,80,20);
dg_service_box->setGeometry(95,10,size().width()-180,20);
dg_filename_label->setGeometry(10,37,80,20);
dg_filename_edit->setGeometry(95,37,size().width()-180,20);
dg_filename_button->setGeometry(size().width()-70,35,60,25);
dg_date_label->setGeometry(10,67,80,20);
dg_date_edit->setGeometry(95,67,100,20);
dg_date_button->setGeometry(205,65,60,25);
dg_bar->setGeometry(10,102,size().width()-20,20);
dg_messages_label->setGeometry(10,129,size().width()-20,20);
dg_messages_text->setGeometry(10,151,size().width()-20,size().height()-197);
dg_process_button->setGeometry(10,size().height()-35,70,25);
dg_close_button->setGeometry(size().width()-60,size().height()-35,50,25);
}
void MainWidget::SetCaption()
{
QString username=tr("[unknown]");
username=rda->user()->name();
setWindowTitle(tr("RDDgImport")+" v"+VERSION+" "+tr("User")+": "+username);
}
bool MainWidget::LoadEvents()
{
FILE *f=NULL;
char data[1024];
QString line;
QTime time;
int length;
QString isci;
dg_events.clear();
if((f=fopen(dg_filename_edit->text().toUtf8(),"r"))==NULL) {
QMessageBox::warning(this,tr("RDDgImport"),
tr("Unable to open source file")+"["+
QString(strerror(errno))+"].");
return false;
}
while(fgets(data,1024,f)!=NULL) {
line=QString(data);
time=GetTime(line.left(8));
if(time.isValid()) {
length=GetLength(line.mid(80,3));
if(length>0) {
isci=GetIsci(line.mid(10,15));
if(!isci.isEmpty()) {
dg_events.push_back(new Event());
dg_events.back()->setTime(time);
switch(length) {
case 30000:
dg_events.back()->setLength(29000);
break;
case 60000:
dg_events.back()->setLength(58000);
break;
default:
LogMessage(tr("WARNING: Non-standard length for ISCI code")+
" \""+isci+"\".");
break;
}
dg_events.back()->setIsci(isci);
dg_events.back()->setTitle(line.mid(48,25));
dg_events.back()->setClient(line.mid(32,11));
dg_carts[isci]=0;
}
}
}
}
fclose(f);
return true;
}
bool MainWidget::ImportAudio()
{
QString err_msg;
for(std::map<QString,unsigned>::const_iterator it=dg_carts.begin();
it!=dg_carts.end();it++) {
Event *evt=GetEvent(it->first);
if(!CheckSpot(evt->isci())) {
if(!ImportSpot(evt,&err_msg)) {
QMessageBox::warning(this,"RDgImport - "+tr("Error"),err_msg);
return false;
}
}
}
return true;
}
bool MainWidget::WriteTrafficFile()
{
FILE *f=NULL;
QString outname;
//
// Open Output File
//
outname=RDDateDecode(dg_svc->importPath(RDSvc::Traffic),
dg_date_edit->date(),rda->station(),
rda->config(),dg_svc->name());
if((f=fopen(outname.toUtf8(),"w"))==NULL) {
LogMessage(tr("WARNING: Unable to open traffic output file")+" \""+
outname+"\" ["+QString(strerror(errno))+"].");
return false;
}
//
// Write Records
//
for(unsigned i=0;i<dg_events.size();i++) {
Event *evt=dg_events[i];
fprintf(f,"%s ",evt->time().toString("hh:mm:ss").toUtf8().constData());
fprintf(f,"%06u ",dg_carts[evt->isci()]);
fprintf(f,"%-34s ",evt->title().toUtf8().constData());
if(evt->length()<600000) {
fprintf(f,"0");
}
fprintf(f,"%s ",RDGetTimeLength(evt->length(),true,false).toUtf8().
constData());
fprintf(f,"%-32s ",evt->isci().toUtf8().constData());
fprintf(f,"%032u",i);
fprintf(f,"\n");
}
//
// Clean Up
//
fclose(f);
return true;
}
bool MainWidget::CheckSpot(const QString &isci)
{
QString sql;
RDSqlQuery *q;
bool ret=false;
QDate today=QDate::currentDate();
QDate killdate=dg_date_edit->date().addDays(RDDGIMPORT_KILLDATE_OFFSET);
QString endDateTimeSQL = "NULL";
if(killdate.isValid())
endDateTimeSQL = RDCheckDateTime(QDateTime(killdate,QTime(23,59,59)),
"yyyy-MM-dd hh:mm:ss");
sql=QString("select ")+
"`CUTS`.`CUT_NAME`,"+ // 00
"`CUTS`.`START_DATETIME`,"+ // 01
"`CUTS`.`END_DATETIME` "+ // 02
"from `CART` left join `CUTS` on "+
"`CART`.`NUMBER`=`CUTS`.`CART_NUMBER` "+
"where (`CART`.`GROUP_NAME`='"+RDEscapeString(dg_svc->autospotGroup())+"')&&"
"(`CUTS`.`ISCI`='"+RDEscapeString(isci)+"')";
q=new RDSqlQuery(sql);
while(q->next()) {
dg_carts[isci]=RDCut::cartNumber(q->value(0).toString());
if(q->value(2).isNull()||(q->value(2).toDateTime().date()<killdate)) {
sql="update `CUTS` set ";
if(q->value(1).isNull()) {
sql+="`START_DATETIME`='"+today.toString("yyyy-MM-dd")+" 00:00:00',";
}
sql+="`END_DATETIME`="+endDateTimeSQL+" ";
sql+="where `CUT_NAME`='"+q->value(0).toString()+"'";
RDSqlQuery::apply(sql);
}
ret=true;
}
delete q;
return ret;
}
bool MainWidget::ImportSpot(Event *evt,QString *err_msg)
{
RDCart *cart;
RDCut *cut;
unsigned cartnum;
int cutnum;
RDAudioImport *conv;
RDAudioImport::ErrorCode conv_err;
RDAudioConvert::ErrorCode audio_conv_err;
RDSettings settings;
QString dir=RDGetPathPart(dg_filename_edit->text());
QDateTime start=QDateTime(QDate::currentDate(),QTime(0,0,0));
QString audiofile;
//
// Find File
//
audiofile=dir+"/"+evt->isci()+"."+QString(RDDGIMPORT_FILE_EXTENSION).
toLower();
if(!QFile::exists(audiofile)) {
audiofile=dir+"/"+evt->isci()+"."+
QString(RDDGIMPORT_FILE_EXTENSION).toUpper();
if(!QFile::exists(audiofile)) {
LogMessage(tr("Missing audio for")+" "+evt->isci()+" ["+evt->title()+
" / "+evt->client()+"].");
return false;
}
}
//
// Initialize Audio Importer
//
settings.setNormalizationLevel(rda->libraryConf()->ripperLevel()/100);
settings.setChannels(rda->libraryConf()->defaultChannels());
if((dg_carts[evt->isci()]=dg_group->nextFreeCart())==0) {
LogMessage(tr("Unable to allocate new cart for")+" "+evt->isci()+" ["+
evt->title()+" / "+evt->client()+"].");
return false;
}
if(evt==NULL) {
LogMessage(tr("Unable to find event for ISCI code")+" \""+
evt->isci()+"\".");
return false;
}
if((cartnum=RDCart::create(dg_group->name(),RDCart::Audio,err_msg,
dg_carts[evt->isci()]))==0) {
return false;
}
cart=new RDCart(dg_carts[evt->isci()]);
if((cutnum=cart->addCut(rda->libraryConf()->defaultLayer(),
rda->libraryConf()->defaultBitrate(),
rda->libraryConf()->defaultChannels(),
evt->isci(),evt->title()))<0) {
LogMessage(tr("WARNING: Unable to create cut for cart")+" \""+
QString().sprintf("%u",dg_carts[evt->isci()])+"\".");
delete cart;
return false;
}
cut=new RDCut(dg_carts[evt->isci()],cutnum);
cut->setStartDatetime(start,true);
cut->setEndDatetime(QDateTime(dg_date_edit->date().
addDays(RDDGIMPORT_KILLDATE_OFFSET),
QTime(23,59,59)),true);
conv=new RDAudioImport(this);
conv->setCartNumber(dg_carts[evt->isci()]);
conv->setCutNumber(cutnum);
conv->setSourceFile(audiofile);
conv->setDestinationSettings(&settings);
conv->setUseMetadata(false);
conv_err=conv->
runImport(rda->user()->name(),rda->user()->password(),&audio_conv_err);
switch(conv_err) {
case RDAudioImport::ErrorOk:
break;
default:
LogMessage(tr("Importer error")+" ["+audiofile+"]: "+
RDAudioImport::errorText(conv_err,audio_conv_err));
}
cart->setTitle(evt->title());
cart->setArtist(evt->client());
cart->setForcedLength(evt->length());
cart->setEnforceLength(true);
delete conv;
delete cut;
delete cart;
return true;
}
void MainWidget::ActivateBar(bool state)
{
if(state) {
dg_messages_text->clear();
}
dg_bar->setEnabled(state);
dg_bar->activate(state);
dg_filename_edit->setDisabled(state);
dg_filename_button->setDisabled(state);
dg_date_edit->setDisabled(state);
dg_date_button->setDisabled(state);
dg_process_button->setDisabled(state);
dg_close_button->setDisabled(state);
qApp->processEvents();
}
Event *MainWidget::GetEvent(const QString &isci)
{
for(unsigned i=0;i<dg_events.size();i++) {
if(dg_events[i]->isci()==isci) {
return dg_events[i];
}
}
return NULL;
}
QTime MainWidget::GetTime(const QString &str) const
{
QStringList fields;
QTime ret;
bool ok=false;
fields=str.split(":");
if(fields.size()==3) {
int hour=fields[0].toInt(&ok);
if(ok&&(hour>=0)&&(hour<=23)) {
int minute=fields[1].toInt(&ok);
if(ok&&(minute>=0)&&(minute<=59)) {
int second=fields[2].toInt(&ok);
if(ok&&(second>=0)&&(second<=59)) {
ret=QTime(hour,minute,second);
}
}
}
}
return ret;
}
int MainWidget::GetLength(const QString &str) const
{
int ret=0;
int len;
bool ok=false;
if(str.left(1)==":") {
len=str.right(2).toInt(&ok);
if(ok&&(len>=0)&&(len<=60)) {
ret=len*1000;
}
}
return ret;
}
QString MainWidget::GetIsci(const QString &str) const
{
QString ret;
if(str.trimmed().length()==15) {
ret=str.trimmed();
}
return ret;
}
void MainWidget::LogMessage(const QString &str)
{
dg_messages_text->append(str+"\n");
dg_messages_text->verticalScrollBar()->
setValue(dg_messages_text->verticalScrollBar()->maximum());
}
int main(int argc,char *argv[])
{
QApplication::setStyle(RD_GUI_STYLE);
QApplication a(argc,argv);
//
// Load Translations
//
QString loc=RDApplication::locale();
if(!loc.isEmpty()) {
QTranslator qt(0);
qt.load(QString("/usr/share/qt4/translations/qt_")+loc,
".");
a.installTranslator(&qt);
QTranslator rd(0);
rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+loc,".");
a.installTranslator(&rd);
QTranslator rdhpi(0);
rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+loc,".");
a.installTranslator(&rdhpi);
QTranslator tr(0);
tr.load(QString(PREFIX)+QString("/share/rivendell/rdgpimon_")+loc,".");
a.installTranslator(&tr);
}
//
// Start Event Loop
//
RDConfig *config=new RDConfig();
config->load();
MainWidget *w=new MainWidget(config);
w->setGeometry(QRect(QPoint(0,0),w->sizeHint()));
w->show();
return a.exec();
}

View File

@@ -1,93 +0,0 @@
// rddgimport.h
//
// A Qt-based application for importing Dial Global CDN downloads
//
// (C) Copyright 2012-2021 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 RDDGIMPORT_H
#define RDDGIMPORT_H
#include <QComboBox>
#include <QDateTimeEdit>
#include <QLineEdit>
#include <QPushButton>
#include <QTextEdit>
#include <rdbusybar.h>
#include <rdgroup.h>
#include <rdsvc.h>
#include <rdwidget.h>
#include "event.h"
#define RDDGIMPORT_USAGE "\n"
#define RDDGIMPORT_KILLDATE_OFFSET 7
#define RDDGIMPORT_FILE_EXTENSION "mp3"
class MainWidget : public RDWidget
{
Q_OBJECT
public:
MainWidget(RDConfig *c,QWidget *parent=0);
QSize sizeHint() const;
private slots:
void serviceActivatedData(int index);
void filenameChangedData(const QString &str);
void filenameSelectedData();
void dateSelectedData();
void processData();
void userChangedData();
void quitMainWidget();
protected:
void resizeEvent(QResizeEvent *e);
private:
void SetCaption();
bool LoadEvents();
bool ImportAudio();
bool WriteTrafficFile();
bool CheckSpot(const QString &isci);
bool ImportSpot(Event *evt,QString *err_msg);
void ActivateBar(bool state);
Event *GetEvent(const QString &isci);
QTime GetTime(const QString &str) const;
int GetLength(const QString &str) const;
QString GetIsci(const QString &str) const;
void LogMessage(const QString &str);
QLabel *dg_service_label;
QComboBox *dg_service_box;
QLabel *dg_filename_label;
QLineEdit *dg_filename_edit;
QPushButton *dg_filename_button;
QLabel *dg_date_label;
QDateEdit *dg_date_edit;
QPushButton *dg_date_button;
QLabel *dg_messages_label;
QTextEdit *dg_messages_text;
RDBusyBar *dg_bar;
QPushButton *dg_process_button;
QPushButton *dg_close_button;
std::map<QString,unsigned> dg_carts;
std::vector<Event *> dg_events;
RDGroup *dg_group;
RDSvc *dg_svc;
};
#endif // RDDGIMPORT_H

View File

@@ -1,31 +0,0 @@
# utils.pro
#
# The utils/ QMake project file for Rivendell
#
# (C) Copyright 2003-2006,2016 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.
SOURCES += event.cpp
SOURCES += rddgimport.cpp
HEADERS += event.h
HEADERS += rddgimport.h
TRANSLATIONS += rddgimport_de.ts
TRANSLATIONS += rddgimport_es.ts
TRANSLATIONS += rddgimport_fr.ts
TRANSLATIONS += rddgimport_nb.ts
TRANSLATIONS += rddgimport_nn.ts
TRANSLATIONS += rddgimport_pt_BR.ts

View File

@@ -1,107 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>MainWidget</name>
<message>
<source>Close</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Process</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Filename:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Date:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>RDDgImport</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to open source file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to find event for ISCI code</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[unknown]</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>User</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Service:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No AutoSpot-enabled services found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Messages</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Missing audio for</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to allocate new cart for</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Importer error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Processing Complete!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING: Non-standard length for ISCI code</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING: Unable to open traffic output file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING: Unable to create cut for cart</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Text Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>All Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open File</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@@ -1,107 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>MainWidget</name>
<message>
<source>Close</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Process</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Filename:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Date:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>RDDgImport</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to open source file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to find event for ISCI code</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[unknown]</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>User</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Service:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No AutoSpot-enabled services found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Messages</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Missing audio for</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to allocate new cart for</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Importer error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Processing Complete!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING: Non-standard length for ISCI code</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING: Unable to open traffic output file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING: Unable to create cut for cart</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Text Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>All Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open File</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@@ -1,107 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>MainWidget</name>
<message>
<source>Close</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Process</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Filename:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Date:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>RDDgImport</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to open source file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to find event for ISCI code</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[unknown]</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>User</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Service:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No AutoSpot-enabled services found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Messages</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Missing audio for</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to allocate new cart for</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Importer error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Processing Complete!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING: Non-standard length for ISCI code</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING: Unable to open traffic output file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING: Unable to create cut for cart</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Text Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>All Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open File</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@@ -1,107 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>MainWidget</name>
<message>
<source>Close</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Process</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Filename:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Date:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>RDDgImport</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to open source file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to find event for ISCI code</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[unknown]</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>User</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Service:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No AutoSpot-enabled services found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Messages</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Missing audio for</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to allocate new cart for</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Importer error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Processing Complete!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING: Non-standard length for ISCI code</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING: Unable to open traffic output file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING: Unable to create cut for cart</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Text Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>All Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open File</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@@ -1,107 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>MainWidget</name>
<message>
<source>Close</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Process</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Filename:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Date:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>RDDgImport</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to open source file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to find event for ISCI code</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[unknown]</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>User</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Service:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No AutoSpot-enabled services found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Messages</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Missing audio for</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to allocate new cart for</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Importer error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Processing Complete!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING: Non-standard length for ISCI code</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING: Unable to open traffic output file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING: Unable to create cut for cart</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Text Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>All Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open File</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@@ -1,107 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>MainWidget</name>
<message>
<source>Close</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Process</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Filename:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Date:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>RDDgImport</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to open source file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to find event for ISCI code</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[unknown]</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>User</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Service:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No AutoSpot-enabled services found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Messages</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Missing audio for</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to allocate new cart for</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Importer error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Processing Complete!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING: Non-standard length for ISCI code</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING: Unable to open traffic output file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING: Unable to create cut for cart</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Text Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>All Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open File</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@@ -27,8 +27,6 @@ install-exec-am:
cp rivendell-rdcartslots.desktop $(DESTDIR)@prefix@/share/applications/
cp rivendell-rdcastmanager.desktop $(DESTDIR)@prefix@/share/applications/
cp rivendell-rdcatch.desktop $(DESTDIR)@prefix@/share/applications/
cp rivendell-rddgimport.desktop $(DESTDIR)@prefix@/share/applications/
cp rivendell-rddiscimport.desktop $(DESTDIR)@prefix@/share/applications/
cp rivendell-rdgpimon.desktop $(DESTDIR)@prefix@/share/applications/
cp rivendell-rdlibrary.desktop $(DESTDIR)@prefix@/share/applications/
cp rivendell-rdlogedit.desktop $(DESTDIR)@prefix@/share/applications/
@@ -59,13 +57,6 @@ uninstall-local:
rm -f $(DESTDIR)@prefix@/share/desktop-directories/rivendell-utilities.directory
rm -f $(DESTDIR)/etc/xdg/menus/applications-merged/rivendell-rivendell.menu
# rm -f $(DESTDIR)/etc/pam.d/rdalsaconfig-root
# rm -f $(DESTDIR)/etc/security/console.apps/rdalsaconfig-root
# rm -f $(DESTDIR)$(prefix)/bin/rdalsaconfig-root
# rm -f $(DESTDIR)/etc/pam.d/rddbconfig-root
# rm -f $(DESTDIR)/etc/security/console.apps/rddbconfig-root
# rm -f $(DESTDIR)$(prefix)/bin/rddbconfig-root
EXTRA_DIST = install_usermode.sh.in\
rdalsaconfig-root-consolehelper.in\
rdalsaconfig-root-pam\
@@ -85,8 +76,6 @@ EXTRA_DIST = install_usermode.sh.in\
rivendell-rddbconfig.desktop\
rivendell-rddbconfig-root.desktop\
rivendell-rddbconfig-sudo.desktop\
rivendell-rddgimport.desktop\
rivendell-rddiscimport.desktop\
rivendell-rdgpimon.desktop\
rivendell-rdlibrary.desktop\
rivendell-rdlogedit.desktop\

View File

@@ -1,11 +0,0 @@
[Desktop Entry]
Encoding=UTF-8
Terminal=false
Categories=Qt:KDE;Rivendell;
Name=RDDgImport
GenericName=Rivendell DG Spot Importer
Exec=rddgimport
Icon=rivendell
Type=Application
Terminal=false

View File

@@ -1,11 +0,0 @@
[Desktop Entry]
Encoding=UTF-8
Terminal=false
Categories=Qt:KDE;Rivendell;
Name=RDDiscImport
GenericName=Rivendell Batch CD Importer
Exec=rddiscimport
Icon=rivendell
Type=Application
Terminal=false

View File

@@ -49,8 +49,6 @@
<Filename>rivendell-rdgpimon.desktop</Filename>
<Filename>rivendell-rdsoftkeys.desktop</Filename>
<Filename>rivendell-rmlsend.desktop</Filename>
<Filename>rivendell-rddgimport.desktop</Filename>
<Filename>rivendell-rddiscimport.desktop</Filename>
</Include>
</Menu>
</Menu>