Fixed conflict in 'ChangeLog'

This commit is contained in:
Fred Gleason 2019-06-03 18:30:01 -04:00
commit 0161a2e48a
14 changed files with 826 additions and 0 deletions

2
.gitignore vendored
View File

@ -111,6 +111,7 @@ tests/db_charset_test
tests/getpids_test
tests/log_unlink_test
tests/mcast_recv_test
tests/notification_test
tests/rdxml_parse_test
tests/reserve_carts_test
tests/sas_switch_torture
@ -128,6 +129,7 @@ utils/rddgimport/rddgimport
utils/rddiscimport/rddiscimport
utils/rdcheckcuts/rdcheckcuts
utils/rdmarkerset/rdmarkerset
utils/rdmetadata/rdmetadata
utils/rmlsend/rmlsend
utils/rdpurgecasts/rdpurgecasts
utils/rdchunk/rdchunk

View File

@ -18713,3 +18713,7 @@
2019-06-02 Patrick Linstruth <patrick@deltecent.com>
* Added '--orphaned-audio', '--orphaned-carts', '--orphaned-cuts',
and '--orphaned-tracks' command line switches to rddbmgr(8).
2019-06-02 Patrick Linstruth <patrick@deltecent.com>
* Added a 'notification_test' test harness.
* Added rdmetadata(8) utility for setting cart metadata from the
command line.

View File

@ -552,6 +552,7 @@ AC_CONFIG_FILES([rivendell.spec \
utils/rdimport/Makefile \
utils/rdmaint/Makefile \
utils/rdmarkerset/Makefile \
utils/rdmetadata/Makefile \
utils/rdpopup/Makefile \
utils/rdpurgecasts/Makefile \
utils/rdrender/Makefile \

View File

@ -37,6 +37,7 @@ all-local: rdclilogedit.1\
rdexport.1\
rdimport.1\
rdmarkerset.8\
rdmetadata.8\
rdrender.1\
rmlsend.1\
rdservice.8
@ -47,6 +48,7 @@ man_MANS = rdclilogedit.1\
rdexport.1\
rdimport.1\
rdmarkerset.8\
rdmetadata.8\
rdrender.1\
rmlsend.1\
rdservice.8
@ -63,6 +65,8 @@ EXTRA_DIST = rdclilogedit.1\
rdimport.xml\
rdmarkerset.8\
rdmarkerset.xml\
rdmetadata.8\
rdmetadata.xml\
rdrender.1\
rdrender.xml\
rmlsend.1\

View File

@ -0,0 +1,240 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<refentry id="stdin" xmlns="http://docbook.org/ns/docbook" version="5.0">
<!--
Header
-->
<refmeta>
<refentrytitle>rdmetadata</refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo class='source'>May 2019</refmiscinfo>
<refmiscinfo class='manual'>Linux Audio Manual</refmiscinfo>
</refmeta>
<refnamediv>
<refname>rdmetadata</refname>
<refpurpose>Tool for altering Rivendell cart metadata</refpurpose>
</refnamediv>
<info>
<author>
<personname>
<firstname>Patrick</firstname>
<surname>Linstruth</surname>
<email>patrick@deltecent.com</email>
</personname>
<contrib>Application Author</contrib>
</author>
</info>
<!--
Body
-->
<refsynopsisdiv id='synopsis'>
<cmdsynopsis>
<command>rdmetadata --cart-number=<replaceable>cart</replaceable></command>
<arg choice='opt'><replaceable>OPTIONS</replaceable></arg>
<sbr/>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1 id='description'><title>Description</title>
<para>
<command>rdmetadata</command><manvolnum>8</manvolnum> is a command-line
tool for setting or altering cart metadata in the Rivendell Radio
Automation System.
</para>
</refsect1>
<refsect1 id='options'><title>Options</title>
<variablelist remap='TP'>
<varlistentry>
<term>
<option>--add-schedcode=</option><replaceable>schedcode</replaceable>
</term>
<listitem>
<para>
Add scheduler code <replaceable>schedcode</replaceable> to
<replaceable>cart</replaceable>.
Default action is to leave the scheduler codes unaltered.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--agency=</option><replaceable>agency</replaceable>
</term>
<listitem>
<para>
Set <replaceable>cart</replaceable> agency metadata
to <replaceable>agency</replaceable>.
Default action is to leave the agency unaltered.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--album=</option><replaceable>album</replaceable>
</term>
<listitem>
<para>
Set <replaceable>cart</replaceable> album metadata
to <replaceable>album</replaceable>.
Default action is to leave the album unaltered.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--artist=</option><replaceable>artist</replaceable>
</term>
<listitem>
<para>
Set <replaceable>cart</replaceable> artist metadata
to <replaceable>artist</replaceable>.
Default action is to leave the artist unaltered.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--bpm=</option><replaceable>bpm</replaceable>
</term>
<listitem>
<para>
Set <replaceable>cart</replaceable> BPM metadata
to <replaceable>bpm</replaceable>.
Default action is to leave the BPM unaltered.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--composer=</option><replaceable>composer</replaceable>
</term>
<listitem>
<para>
Set <replaceable>cart</replaceable> composer metadata
to <replaceable>composer</replaceable>.
Default action is to leave the composer unaltered.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--conductor=</option><replaceable>conductor</replaceable>
</term>
<listitem>
<para>
Set <replaceable>cart</replaceable> conductor metadata
to <replaceable>conductor</replaceable>.
Default action is to leave the conductor unaltered.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--label=</option><replaceable>label</replaceable>
</term>
<listitem>
<para>
Set <replaceable>cart</replaceable> label metadata
to <replaceable>label</replaceable>.
Default action is to leave the label unaltered.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--publisher=</option><replaceable>publisher</replaceable>
</term>
<listitem>
<para>
Set <replaceable>cart</replaceable> publisher metadata
to <replaceable>publisher</replaceable>.
Default action is to leave the publisher unaltered.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--rem-schedcode=</option><replaceable>schedcode</replaceable>
</term>
<listitem>
<para>
Remove scheduler code <replaceable>schedcode</replaceable> from
<replaceable>cart</replaceable>.
Default action is to leave the scheduler codes unaltered.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--songid=</option><replaceable>songid</replaceable>
</term>
<listitem>
<para>
Set <replaceable>cart</replaceable> song ID metadata
to <replaceable>songid</replaceable>.
Default action is to leave the song ID unaltered.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--title=</option><replaceable>title</replaceable>
</term>
<listitem>
<para>
Set <replaceable>cart</replaceable> title metadata
to <replaceable>title</replaceable>.
Default action is to leave the title unaltered.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--year=</option><replaceable>year</replaceable>
</term>
<listitem>
<para>
Set <replaceable>cart</replaceable> year metadata
to <replaceable>year</replaceable>.
Default action is to leave the year unaltered.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--verbose</option>
</term>
<listitem>
<para>
Print messages to STDOUT describing progress.
</para>
</listitem>
</varlistentry>
</variablelist>
<refsect1 id='see_also'><title>See Also</title>
<para>
<citerefentry>
<refentrytitle>rdlibrary</refentrytitle><manvolnum>1</manvolnum>
</citerefentry>
</para>
</refsect1>
</refsect1>
</refentry>

View File

@ -27,6 +27,14 @@
RDSchedCode::RDSchedCode(const QString &code)
{
sched_code=code;
//
// Get proper case for code
//
if(exists()) {
sched_code=RDGetSqlValue("SCHED_CODES","CODE",code,"CODE").
toString();
}
}

View File

@ -387,6 +387,7 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/rmlsend.1.gz
%{_mandir}/man8/rddbmgr.8.gz
%{_mandir}/man8/rdmarkerset.8.gz
%{_mandir}/man8/rdmetadata.8.gz
%{_mandir}/man8/rdservice.8.gz
@DOC_PATH@/*
@LOCAL_PREFIX@/@RD_LIB_PATH@/librd-@VERSION@.so
@ -403,6 +404,7 @@ rm -rf $RPM_BUILD_ROOT
@LOCAL_PREFIX@/sbin/rdpadengined
@LOCAL_PREFIX@/sbin/sas_shim
@LOCAL_PREFIX@/sbin/rdmarkerset
@LOCAL_PREFIX@/sbin/rdmetadata
@LOCAL_PREFIX@/sbin/rdcleandirs
@LOCAL_PREFIX@/sbin/rddbmgr
@HPI_FILE1@

View File

@ -37,6 +37,7 @@ noinst_PROGRAMS = audio_convert_test\
getpids_test\
log_unlink_test\
mcast_recv_test\
notification_test\
rdxml_parse_test\
reserve_carts_test\
stringcode_test\
@ -81,6 +82,10 @@ dist_mcast_recv_test_SOURCES = mcast_recv_test.cpp mcast_recv_test.h
nodist_mcast_recv_test_SOURCES = moc_mcast_recv_test.cpp
mcast_recv_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
dist_notification_test_SOURCES = notification_test.cpp notification_test.h
nodist_notification_test_SOURCES = moc_notification_test.cpp
notification_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
dist_rdxml_parse_test_SOURCES = rdxml_parse_test.cpp rdxml_parse_test.h
rdxml_parse_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support

View File

@ -0,0 +1,70 @@
// upload_test.cpp
//
// Test Rivendell file uploading.
//
// (C) Copyright 2019 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 <stdlib.h>
#include <QApplication>
#include <QDebug>
#include <rdapplication.h>
#include "notification_test.h"
MainObject::MainObject(QObject *parent)
:QObject(parent)
{
QString err_msg;
rda=new RDApplication("notification_test","notification_test",NOTIFICATION_TEST_USAGE,this);
if(!rda->open(&err_msg)) {
fprintf(stderr,"notification_test: %s\n",(const char *)err_msg);
exit(1);
}
for(unsigned i=0;i<rda->cmdSwitch()->keys();i++) {
if(!rda->cmdSwitch()->processed(i)) {
fprintf(stderr,"rdrepld: unknown command option \"%s\"\n",
(const char *)rda->cmdSwitch()->key(i));
exit(2);
}
}
//
// Run the Test
//
connect(rda->ripc(),SIGNAL(notificationReceived(RDNotification *)),
this,SLOT(notificationReceivedData(RDNotification *)));
rda->ripc()->
connectHost("localhost",RIPCD_TCP_PORT,rda->config()->password());
}
void MainObject::notificationReceivedData(RDNotification *notify)
{
printf("%s\n",(const char *)notify->write());
}
int main(int argc,char *argv[])
{
QApplication a(argc,argv,false);
new MainObject();
return a.exec();
}

43
tests/notification_test.h Normal file
View File

@ -0,0 +1,43 @@
// upload_test.h
//
// Test Rivendell Notifications
//
// (C) Copyright 2019 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 NOTIFICATION_TEST_H
#define NOTIFICATION_TEST_H
#include <QObject>
#include <rdripc.h>
#define NOTIFICATION_TEST_USAGE ""
class MainObject : public QObject
{
Q_OBJECT
public:
MainObject(QObject *parent=0);
private slots:
void notificationReceivedData(RDNotification *notify);
private:
};
#endif // NOTIFICATION_TEST_H

View File

@ -40,6 +40,7 @@ SUBDIRS = $(ALSACONFIG_RD_OPT)\
rdimport\
rdmaint\
rdmarkerset\
rdmetadata\
rdpopup\
rdpurgecasts\
rdrender\

View File

@ -0,0 +1,48 @@
## Makefile.am
##
## (C) Copyright 2002-2014,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
## 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)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support
LIBS = -L$(top_srcdir)/lib
MOC = @QT_MOC@
# The dependency for qt's Meta Object Compiler (moc)
moc_%.cpp: %.h
$(MOC) $< -o $@
sbin_PROGRAMS = rdmetadata
dist_rdmetadata_SOURCES = rdmetadata.cpp rdmetadata.h
nodist_rdmetadata_SOURCES = moc_rdmetadata.cpp
rdmetadata_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
EXTRA_DIST =
CLEANFILES = *~\
*.idb\
*ilk\
*.obj\
*.pdb\
*.qm\
moc_*
MAINTAINERCLEANFILES = *~\
Makefile.in\
moc_*

View File

@ -0,0 +1,315 @@
// rdmetadata.cpp
//
// Command-line tool for setting Rivendell Cart Metadata
//
// Patrick Linstruth <patrick@deltecent.com>
// (C) Copyright 2019 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 <limits.h>
#include <glob.h>
#include <signal.h>
#include <math.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <QApplication>
#include <QDir>
#include <QFileInfo>
#include <QSqlQuery>
#include "rd.h"
#include "rdapplication.h"
#include "rdcart.h"
#include "rdschedcode.h"
#include "rdmetadata.h"
MainObject::MainObject(QObject *parent)
:QObject(parent)
{
QString err_msg;
verbose=false;
cartnum=0;
year=0;
bpm=0;
//
// Open the Database
//
rda=new RDApplication("rdmetadata","rdmetadata",RDMETADATA_USAGE,this);
if(!rda->open(&err_msg)) {
fprintf(stderr,"rdmetadata: %s\n",(const char *)err_msg);
exit(1);
}
//
// Read Command Options
//
for(unsigned i=0;i<rda->cmdSwitch()->keys();i++) {
if(rda->cmdSwitch()->key(i)=="--cart-number") {
cartnum=rda->cmdSwitch()->value(i).toUInt();
cartstring=QString().sprintf("%06u",cartnum);
rda->cmdSwitch()->setProcessed(i,true);
}
if(rda->cmdSwitch()->key(i)=="--artist") {
artist=rda->cmdSwitch()->value(i);
rda->cmdSwitch()->setProcessed(i,true);
}
if(rda->cmdSwitch()->key(i)=="--title") {
title=rda->cmdSwitch()->value(i);
rda->cmdSwitch()->setProcessed(i,true);
}
if(rda->cmdSwitch()->key(i)=="--album") {
album=rda->cmdSwitch()->value(i);
rda->cmdSwitch()->setProcessed(i,true);
}
if(rda->cmdSwitch()->key(i)=="--year") {
year=rda->cmdSwitch()->value(i).toInt();
rda->cmdSwitch()->setProcessed(i,true);
}
if(rda->cmdSwitch()->key(i)=="--conductor") {
conductor=rda->cmdSwitch()->value(i);
rda->cmdSwitch()->setProcessed(i,true);
}
if(rda->cmdSwitch()->key(i)=="--label") {
label=rda->cmdSwitch()->value(i);
rda->cmdSwitch()->setProcessed(i,true);
}
if(rda->cmdSwitch()->key(i)=="--agency") {
agency=rda->cmdSwitch()->value(i);
rda->cmdSwitch()->setProcessed(i,true);
}
if(rda->cmdSwitch()->key(i)=="--publisher") {
publisher=rda->cmdSwitch()->value(i);
rda->cmdSwitch()->setProcessed(i,true);
}
if(rda->cmdSwitch()->key(i)=="--composer") {
composer=rda->cmdSwitch()->value(i);
rda->cmdSwitch()->setProcessed(i,true);
}
if(rda->cmdSwitch()->key(i)=="--songid") {
songid=rda->cmdSwitch()->value(i);
rda->cmdSwitch()->setProcessed(i,true);
}
if(rda->cmdSwitch()->key(i)=="--bpm") {
bpm=rda->cmdSwitch()->value(i).toInt();
rda->cmdSwitch()->setProcessed(i,true);
}
if(rda->cmdSwitch()->key(i)=="--add-schedcode") {
add_schedcode=rda->cmdSwitch()->value(i);
rda->cmdSwitch()->setProcessed(i,true);
}
if(rda->cmdSwitch()->key(i)=="--rem-schedcode") {
rem_schedcode=rda->cmdSwitch()->value(i);
rda->cmdSwitch()->setProcessed(i,true);
}
if(rda->cmdSwitch()->key(i)=="--verbose") {
verbose=true;
rda->cmdSwitch()->setProcessed(i,true);
}
if(!rda->cmdSwitch()->processed(i)) {
fprintf(stderr,"rdmetadata: unknown command option \"%s\"\n",
(const char *)rda->cmdSwitch()->key(i));
exit(2);
}
}
//
// Sanity Checks
//
if(!cartnum) {
fprintf(stderr,"rdmetadata: --cart-number must be specified\n");
exit(256);
}
if(!add_schedcode.isEmpty()) {
RDSchedCode *sched=new RDSchedCode(add_schedcode);
if (!sched->exists()) {
fprintf(stderr,"rdmetadata: scheduler code '%s' does not exist\n",
qPrintable(sched->code()));
exit(256);
}
else {
// Get proper case
add_schedcode=sched->code();
}
delete sched;
}
if(!rem_schedcode.isEmpty()) {
RDSchedCode *sched=new RDSchedCode(rem_schedcode);
if (!sched->exists()) {
fprintf(stderr,"rdmetadata: scheduler code '%s' does not exist\n",
qPrintable(sched->code()));
exit(256);
}
else {
// Get proper case
rem_schedcode=sched->code();
}
delete sched;
}
//
// RIPCD Connection
//
connect(rda,SIGNAL(userChanged()),this,SLOT(userChangedData()));
rda->ripc()->connectHost("localhost",RIPCD_TCP_PORT,rda->config()->password());
}
void MainObject::userChangedData()
{
//
// Get User Context
//
disconnect(rda->ripc(),SIGNAL(userChanged()),this,SLOT(userChangedData()));
//
// Verify Permissions
//
if(!rda->user()->modifyCarts()) {
fprintf(stderr,"%s",
qPrintable(QString("rdmetadata: user \"%1\" has no modify carts permission\n")
.arg(rda->user()->name())));
rda->log(RDConfig::LogErr,
QString("rdmetadata: user \"%1\" has no modify carts permission\n")
.arg(rda->user()->name()));
exit(256);
}
updateMetadata();
exit(0);
}
void MainObject::updateMetadata()
{
RDCart *cart;
QStringList schedcodes;
cart=new RDCart(cartnum);
if(!cart->exists()) {
fprintf(stderr,"rdmetadata: cart %06u does not exist.\n",cartnum);
exit(1);
}
schedcodes=cart->schedCodesList();
if(!artist.isEmpty()) {
cart->setArtist(artist);
Print(QString("rdmetadata: Set cart %1 artist to '%2'").arg(cartstring).arg(artist));
}
if(!title.isEmpty()) {
cart->setTitle(title);
Print(QString("rdmetadata: Set cart %1 title to '%2'").arg(cartstring).arg(title));
}
if(!album.isEmpty()) {
cart->setAlbum(album);
Print(QString("rdmetadata: Set cart %1 album to '%2'").arg(cartstring).arg(album));
}
if(year) {
cart->setYear(year);
Print(QString("rdmetadata: Set cart %1 year to '%2'").arg(cartstring).arg(year));
}
if(!conductor.isEmpty()) {
cart->setConductor(conductor);
Print(QString("rdmetadata: Set cart %1 conductor to '%2'").arg(cartstring).arg(conductor));
}
if(!label.isEmpty()) {
cart->setLabel(label);
Print(QString("rdmetadata: Set cart %1 label to '%2'").arg(cartstring).arg(label));
}
if(!agency.isEmpty()) {
cart->setAgency(agency);
Print(QString("rdmetadata: Set cart %1 agency to '%2'").arg(cartstring).arg(agency));
}
if(!publisher.isEmpty()) {
cart->setPublisher(publisher);
Print(QString("rdmetadata: Set cart %1 publisher to '%2'").arg(cartstring).arg(publisher));
}
if(!composer.isEmpty()) {
cart->setComposer(composer);
Print(QString("rdmetadata: Set cart %1 composer to '%2'").arg(cartstring).arg(composer));
}
if(!songid.isEmpty()) {
cart->setSongId(songid);
Print(QString("rdmetadata: Set cart %1 songid to '%2'").arg(cartstring).arg(songid));
}
if(bpm) {
cart->setBeatsPerMinute(bpm);
Print(QString("rdmetadata: Set cart %1 bpm to '%2'").arg(cartstring).arg(bpm));
}
if(!add_schedcode.isEmpty()&&!schedcodes.contains(add_schedcode)) {
cart->addSchedCode(add_schedcode);
Print(QString("rdmetadata: Added scheduler code '%1' to cart %2").arg(add_schedcode).arg(cartstring));
}
if(!rem_schedcode.isEmpty()&&schedcodes.contains(rem_schedcode)) {
cart->removeSchedCode(rem_schedcode);
Print(QString("rdmetadata: Removed scheduler code '%1' from cart %2").arg(rem_schedcode).arg(cartstring));
}
delete cart;
SendNotification(RDNotification::ModifyAction,cartnum);
}
void MainObject::SendNotification(RDNotification::Action action,unsigned cartnum)
{
RDNotification *notify=
new RDNotification(RDNotification::CartType,action,QVariant(cartnum));
rda->ripc()->sendNotification(*notify);
delete notify;
//
// Allow the notification to be processed
//
qApp->processEvents();
}
void MainObject::Print(const QString &msg)
{
if(verbose) {
printf("%s\n",(const char *)msg);
}
}
int main(int argc,char *argv[])
{
QApplication a(argc,argv,false);
new MainObject();
return a.exec();
}

View File

@ -0,0 +1,83 @@
// rdmarkerset.h
//
// Command-line tool for setting Rivendell Cart Metadata
//
// Patrick Linstruth <patrick@deltecent.com>
// (C) Copyright 2019 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 RDMETADATA_H
#define RDMETADATA_H
#include <stdlib.h>
#include <vector>
#include <QObject>
#include "rdnotification.h"
#define RDMETADATA_USAGE "--cart-number=<cart number> [options]\n\nThe following options are recognized:\n\n\
--add_schedcode=<schedcode>\n\
--agency=<agency>\n\
--album=<album>\n\
--artist=<artist>\n\
--bpm=<bpm>\n\
--composer=<composer>\n\
--conductor=<conductor>\n\
--label=<label>\n\
--publisher=<publisher>\n\
--rem-schedcode=<schedcode>\n\
--songid=<songid>\n\
--title=<title>\n\
--year=<year>\n\
--verbose\n\
\n"
class MainObject : public QObject
{
Q_OBJECT;
public:
MainObject(QObject *parent=0);
private slots:
void userChangedData();
private:
void updateMetadata();
void SendNotification(RDNotification::Action action,unsigned cartnum);
void Print(const QString &msg);
bool verbose;
unsigned cartnum;
QString cartstring;
QString artist;
QString title;
QString album;
int year;
QString conductor;
QString label;
QString agency;
QString publisher;
QString composer;
QString songid;
int bpm;
QString add_schedcode;
QString rem_schedcode;
};
#endif // RDMETADATA_H