mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-25 08:56:00 +02:00
2016-07-22 Fred Gleason <fredg@paravelsystems.com>
* Implemented a 'deletelog' command for rdclilogedit(1).
This commit is contained in:
parent
d4e2b65796
commit
b41c243de9
@ -15396,3 +15396,5 @@
|
|||||||
* Fixed a bug in 'utils/rdclilogedit/operations.cpp' where attempting
|
* Fixed a bug in 'utils/rdclilogedit/operations.cpp' where attempting
|
||||||
to load a log with mismatched case in the name would generate a SQL
|
to load a log with mismatched case in the name would generate a SQL
|
||||||
error.
|
error.
|
||||||
|
2016-07-22 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Implemented a 'deletelog' command for rdclilogedit(1).
|
||||||
|
@ -131,6 +131,18 @@
|
|||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command>deletelog</command>
|
||||||
|
<arg choice="req"><replaceable>log-name</replaceable></arg>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Delete the log <replaceable>log-name</replaceable> from the
|
||||||
|
Rivendell database.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>
|
<term>
|
||||||
<command>exit</command>
|
<command>exit</command>
|
||||||
|
@ -27,10 +27,10 @@ void MainObject::Help(const QStringList &cmds) const
|
|||||||
if(cmds.size()==1) {
|
if(cmds.size()==1) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("The following commands are available:\n");
|
printf("The following commands are available:\n");
|
||||||
printf("?, addcart, addchain, addmarker, addtrack, bye, exit, header, help, list,\n");
|
printf("?, addcart, addchain, addmarker, addtrack, bye, deletelog, exit, header, help,\n");
|
||||||
printf("listlogs, listservices, load, new, quit, remove, save, saveas, setautorefresh,\n");
|
printf("list, listlogs, listservices, load, new, quit, remove, save, saveas,\n");
|
||||||
printf("setcart, setcomment, setdesc, setenddate, setlabel, setpurgedate, setservice,\n");
|
printf("setautorefresh, setcart, setcomment, setdesc, setenddate, setlabel,\n");
|
||||||
printf("setstartdate, settime, settrans, unload\n");
|
printf("setpurgedate, setservice, setstartdate, settime, settrans, unload\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("Enter \"? <cmd-name>\" for specific help.\n");
|
printf("Enter \"? <cmd-name>\" for specific help.\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -78,6 +78,14 @@ void MainObject::Help(const QStringList &cmds) const
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
processed=true;
|
processed=true;
|
||||||
}
|
}
|
||||||
|
if(verb=="deletelog") {
|
||||||
|
printf("\n");
|
||||||
|
printf(" deletelog <log-name>\n");
|
||||||
|
printf("\n");
|
||||||
|
printf("Delete log <log-name> from the Rivendell database.\n");
|
||||||
|
printf("\n");
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
if((verb=="?")||(verb=="help")) {
|
if((verb=="?")||(verb=="help")) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" %s <cmd-name>\n",(const char *)cmds[1]);
|
printf(" %s <cmd-name>\n",(const char *)cmds[1]);
|
||||||
|
@ -87,6 +87,43 @@ void MainObject::Addtrack(int line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainObject::Deletelog(QString logname)
|
||||||
|
{
|
||||||
|
QString sql;
|
||||||
|
RDSqlQuery *q;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Normalize log name case
|
||||||
|
//
|
||||||
|
// FIXME: This should really be handled by use of collations in the
|
||||||
|
// where clause.
|
||||||
|
//
|
||||||
|
sql=QString("select NAME from LOGS where ")+
|
||||||
|
"NAME=\""+RDEscapeString(logname)+"\"";
|
||||||
|
q=new RDSqlQuery(sql);
|
||||||
|
if(q->first()) {
|
||||||
|
logname=q->value(0).toString();
|
||||||
|
}
|
||||||
|
delete q;
|
||||||
|
|
||||||
|
if((edit_log==NULL)||(edit_log->name()!=logname)) {
|
||||||
|
RDLog *log=new RDLog(logname);
|
||||||
|
if(log->exists()) {
|
||||||
|
if(!log->remove(edit_station,edit_user,edit_config)) {
|
||||||
|
fprintf(stderr,"deletelog: audio deletion error, log not deleted\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,"deletelog: no such log\n");
|
||||||
|
}
|
||||||
|
delete log;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,"deletelog: log currently loaded (try \"unload\" first)\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainObject::Header() const
|
void MainObject::Header() const
|
||||||
{
|
{
|
||||||
printf(" Description: %s\n",(const char *)edit_description);
|
printf(" Description: %s\n",(const char *)edit_description);
|
||||||
|
@ -45,6 +45,21 @@ void MainObject::DispatchCommand(QString cmd)
|
|||||||
//
|
//
|
||||||
// No loaded log needed for these
|
// No loaded log needed for these
|
||||||
//
|
//
|
||||||
|
if(verb=="deletelog") {
|
||||||
|
if(edit_user->deleteLog()) {
|
||||||
|
if(cmds.size()==2) {
|
||||||
|
Deletelog(cmds[1]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,"deletelog: invalid command arguments\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,"deletelog: insufficient privileges [Delete Log]\n");
|
||||||
|
}
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
|
|
||||||
if((verb=="exit")||(verb=="quit")||(verb=="bye")) {
|
if((verb=="exit")||(verb=="quit")||(verb=="bye")) {
|
||||||
if(overwrite) {
|
if(overwrite) {
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -83,8 +83,9 @@ MainObject::MainObject(QObject *parent)
|
|||||||
new RDDbHeartbeat(edit_config->mysqlHeartbeatInterval(),this);
|
new RDDbHeartbeat(edit_config->mysqlHeartbeatInterval(),this);
|
||||||
|
|
||||||
//
|
//
|
||||||
// RDAirPlay Configuration
|
// Configuration Objects
|
||||||
//
|
//
|
||||||
|
edit_station=new RDStation(edit_config->stationName());
|
||||||
edit_airplay_conf=new RDAirPlayConf(edit_config->stationName(),"RDAIRPLAY");
|
edit_airplay_conf=new RDAirPlayConf(edit_config->stationName(),"RDAIRPLAY");
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -48,6 +48,7 @@ class MainObject : public QObject
|
|||||||
void Addchain(int line,const QString &logname);
|
void Addchain(int line,const QString &logname);
|
||||||
void Addmarker(int line);
|
void Addmarker(int line);
|
||||||
void Addtrack(int line);
|
void Addtrack(int line);
|
||||||
|
void Deletelog(QString logname);
|
||||||
void Header() const;
|
void Header() const;
|
||||||
void Help(const QStringList &cmds) const;
|
void Help(const QStringList &cmds) const;
|
||||||
void List();
|
void List();
|
||||||
@ -87,6 +88,7 @@ class MainObject : public QObject
|
|||||||
QDate edit_purge_date;
|
QDate edit_purge_date;
|
||||||
bool edit_auto_refresh;
|
bool edit_auto_refresh;
|
||||||
RDUser *edit_user;
|
RDUser *edit_user;
|
||||||
|
RDStation *edit_station;
|
||||||
RDRipc *edit_ripc;
|
RDRipc *edit_ripc;
|
||||||
RDAirPlayConf *edit_airplay_conf;
|
RDAirPlayConf *edit_airplay_conf;
|
||||||
RDConfig *edit_config;
|
RDConfig *edit_config;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user