From 828d761f9c0c5036a669ee743d634f91bd35bb56 Mon Sep 17 00:00:00 2001 From: Patrick Linstruth Date: Tue, 22 Dec 2020 12:07:16 -0800 Subject: [PATCH 1/4] Fixed title separation in rdlogmanager(1) scheduler. Added a 'STACK_LINES.TITLE' field to the database. Incremented the database version to 347. --- ChangeLog | 4 ++++ docs/tables/stack_lines.txt | 1 + lib/dbversion.h | 2 +- lib/rdevent_line.cpp | 15 +++++++------ lib/rdschedcartlist.cpp | 12 +++++++++++ lib/rdschedcartlist.h | 4 ++++ utils/rddbmgr/rddbmgr.h | 1 + utils/rddbmgr/revertschema.cpp | 9 ++++++++ utils/rddbmgr/schemamap.cpp | 2 +- utils/rddbmgr/updateschema.cpp | 39 ++++++++++++++++++++++++++++++++++ 10 files changed, 80 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 47c885ae..03c828d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20686,3 +20686,7 @@ * Incremented the package version to 3.4.1int9. 2020-12-12 Fred Gleason * Incremented the package version to 3.5.0. +2020-12-22 Patrick Linstruth + * Fixed title separation in rdlogmanager(1) scheduler. + * Added a 'STACK_LINES.TITLE' field to the database. + * Incremented the database version to 347. diff --git a/docs/tables/stack_lines.txt b/docs/tables/stack_lines.txt index 630a174f..3ac16825 100644 --- a/docs/tables/stack_lines.txt +++ b/docs/tables/stack_lines.txt @@ -9,4 +9,5 @@ SCHED_STACK_ID int(10) unsigned SERVICE_NAME varchar(10) From SERVICES.NAME CART int(10) unsigned From CART.NUMBER ARTIST varchar(191) From CART.ARTIST +TITLE varchar(191) From CART.TITLE SCHEDULED_AT datetime diff --git a/lib/dbversion.h b/lib/dbversion.h index 62086b3f..b4cd10d0 100644 --- a/lib/dbversion.h +++ b/lib/dbversion.h @@ -24,7 +24,7 @@ /* * Current Database Version */ -#define RD_VERSION_DATABASE 346 +#define RD_VERSION_DATABASE 347 #endif // DBVERSION_H diff --git a/lib/rdevent_line.cpp b/lib/rdevent_line.cpp index 155c6be4..f6e2cf6f 100644 --- a/lib/rdevent_line.cpp +++ b/lib/rdevent_line.cpp @@ -591,7 +591,7 @@ bool RDEventLine::generateLog(QString logname,const QString &svcname, // // Load all carts in requested group into schedCL // - sql=QString("select NUMBER,ARTIST,")+ + sql=QString("select NUMBER,ARTIST,TITLE,")+ "CONCAT(GROUP_CONCAT(RPAD(SC.SCHED_CODE,11,' ') separator ''),'.') as SCHED_CODES"+ " from CART LEFT JOIN CART_SCHED_CODES AS SC on (NUMBER=SC.CART_NUMBER)"+ " where GROUP_NAME='"+RDEscapeString(schedGroup())+"'"+ @@ -599,12 +599,12 @@ bool RDEventLine::generateLog(QString logname,const QString &svcname, RDSchedCartList *schedCL=new RDSchedCartList(); q=new RDSqlQuery(sql); while(q->next()) { - QStringList codes=q->value(2).toString().split(" ",QString::SkipEmptyParts); + QStringList codes=q->value(3).toString().split(" ",QString::SkipEmptyParts); if((codes.size()>0)&&(codes.last()==".")) { codes.removeLast(); } schedCL-> - insertItem(q->value(0).toUInt(),0,0,q->value(1).toString(),codes); + insertItem(q->value(0).toUInt(),0,0,q->value(1).toString(),q->value(2).toString(),codes); } delete q; @@ -636,17 +636,17 @@ bool RDEventLine::generateLog(QString logname,const QString &svcname, // Title separation // // Iterate through schedCL and remove carts from schedCL that - // match cart number on the stack essentially removing matched titles. + // match title on the stack. // if(titlesep>=0) { schedCL->save(); - sql=QString("select CART from STACK_LINES where ")+ + sql=QString("select TITLE from STACK_LINES where ")+ "SERVICE_NAME=\""+RDEscapeString(svcname)+"\" && "+ QString().sprintf("SCHED_STACK_ID >= %d",stackid-titlesep); q=new RDSqlQuery(sql); while (q->next()) { for(counter=0;countergetNumberOfItems();counter++) { - if(q->value(0).toUInt()==schedCL->getItemCartNumber(counter)) { + if(q->value(0).toString()==schedCL->getItemTitle(counter)) { schedCL->removeItem(counter); counter--; } @@ -859,7 +859,8 @@ bool RDEventLine::generateLog(QString logname,const QString &svcname, "SCHEDULED_AT=now(),"+ QString().sprintf("SCHED_STACK_ID=%u,",stackid)+ QString().sprintf("CART=%u,",schedCL->getItemCartNumber(schedpos))+ - "ARTIST=\""+RDEscapeString(schedCL->getItemArtist(schedpos))+"\""; + "ARTIST=\""+RDEscapeString(schedCL->getItemArtist(schedpos))+"\","+ + "TITLE=\""+RDEscapeString(schedCL->getItemTitle(schedpos))+"\""; unsigned line_id=RDSqlQuery::run(sql).toUInt(); QStringList codes=schedCL->getItemSchedCodes(schedpos); for(int i=0;i list_stackid; QList list_savestackid; QStringList list_artist; + QStringList list_title; QStringList list_saveartist; + QStringList list_savetitle; QList list_schedcodes; QList list_saveschedcodes; }; diff --git a/utils/rddbmgr/rddbmgr.h b/utils/rddbmgr/rddbmgr.h index ef55cbe9..3620dd29 100644 --- a/utils/rddbmgr/rddbmgr.h +++ b/utils/rddbmgr/rddbmgr.h @@ -105,6 +105,7 @@ class MainObject : public QObject bool ConvertTimeField186(const QString &table,const QString &field, QString *err_msg) const; bool ConvertArtistSep307(QString *err_msg) const; + bool StackLineTitles347(QString *err_msg) const; // // revertschema.cpp diff --git a/utils/rddbmgr/revertschema.cpp b/utils/rddbmgr/revertschema.cpp index 5cf4c0bf..0d825909 100644 --- a/utils/rddbmgr/revertschema.cpp +++ b/utils/rddbmgr/revertschema.cpp @@ -40,6 +40,15 @@ bool MainObject::RevertSchema(int cur_schema,int set_schema,QString *err_msg) // NEW SCHEMA REVERSIONS GO HERE... + // + // Revert 347 + // + if((cur_schema==347)&&(set_schemacur_schema)) { + sql=QString("alter table STACK_LINES add column ")+ + "TITLE varchar(191) not null after ARTIST"; + if(!RDSqlQuery::apply(sql,err_msg)) { + return false; + } + + if (!StackLineTitles347(err_msg)) { + return false; + } + + WriteSchemaVersion(++cur_schema); + } // NEW SCHEMA UPDATES GO HERE... @@ -10714,3 +10727,29 @@ bool MainObject::ConvertArtistSep307(QString *err_msg) const return true; } + +bool MainObject::StackLineTitles347(QString *err_msg) const +{ + QString sql; + RDSqlQuery *q; + + // + // Add titles to STACK_LINES + // + q=new RDSqlQuery("select NUMBER,TITLE from CART",false); + while(q->next()) { + if(!q->value(1).isNull()) { + sql=QString("update STACK_LINES set ")+ + "TITLE=\""+RDEscapeString(q->value(1).toString().lower().replace(" ",""))+"\" "+ + "where CART=\""+RDEscapeString(q->value(0).toString())+"\""; + if(!RDSqlQuery::apply(sql,err_msg)) { + delete q; + return false; + } + } + } + delete q; + + return true; +} + From 0a54812cfa9a49b68ce14409fd1039fa03818c4c Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Thu, 24 Dec 2020 12:29:06 -0500 Subject: [PATCH 2/4] 2020-12-24 Fred Gleason * Modified rdimport(1) so as to send e-mail reports to the address of the current Rivendell user in addition to the group's Notification E-Mail Address. * Modified the Webget service so as to send e-mail reports to the address of the current Rivendell user in addition to the group's Notification E-Mail Address. Signed-off-by: Fred Gleason --- ChangeLog | 7 +++++++ utils/rdimport/journal.cpp | 14 ++++++++++++++ web/webget/webget.cpp | 20 +++++++++++++++++--- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 47c885ae..1901433e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20686,3 +20686,10 @@ * Incremented the package version to 3.4.1int9. 2020-12-12 Fred Gleason * Incremented the package version to 3.5.0. +2020-12-24 Fred Gleason + * Modified rdimport(1) so as to send e-mail reports to the address + of the current Rivendell user in addition to the group's + Notification E-Mail Address. + * Modified the Webget service so as to send e-mail reports to the + address of the current Rivendell user in addition to the group's + Notification E-Mail Address. diff --git a/utils/rdimport/journal.cpp b/utils/rdimport/journal.cpp index 92a01032..95d7840c 100644 --- a/utils/rdimport/journal.cpp +++ b/utils/rdimport/journal.cpp @@ -39,6 +39,9 @@ void Journal::addSuccess(const QString &groupname,QString filename, RDGroup *group=new RDGroup(groupname); QStringList addrs= group->notifyEmailAddress().split(",",QString::SkipEmptyParts); + if(!rda->user()->emailAddress().isEmpty()) { + addrs.push_back(rda->user()->emailAddress()); + } if(addrs.size()>0) { filename=filename.split("/",QString::SkipEmptyParts).last(); @@ -86,6 +89,9 @@ void Journal::addFailure(const QString &groupname,QString filename, RDGroup *group=new RDGroup(groupname); QStringList addrs= group->notifyEmailAddress().split(",",QString::SkipEmptyParts); + if(!rda->user()->emailAddress().isEmpty()) { + addrs.push_back(rda->user()->emailAddress()); + } if(addrs.size()>0) { filename=filename.split("/",QString::SkipEmptyParts).last(); @@ -142,6 +148,10 @@ void Journal::sendAll() QString from_addr; QStringList to_addrs; + if(!rda->user()->emailAddress().isEmpty()) { + to_addrs.push_back(rda->user()->emailAddress()); + } + from_addr=rda->system()->originEmailAddress(); to_addrs=it.key().split(",",QString::SkipEmptyParts); subject=QObject::tr("Rivendell import report")+"\n"; @@ -188,6 +198,10 @@ void Journal::sendAll() from_addr=rda->system()->originEmailAddress(); to_addrs=it.key().split(",",QString::SkipEmptyParts); + if(!rda->user()->emailAddress().isEmpty()) { + to_addrs.push_back(rda->user()->emailAddress()); + } + subject=QObject::tr("Rivendell import FAILURE report")+"\n"; body+=QObject::tr("Rivendell File Import FAILURE Report")+"\n"; diff --git a/web/webget/webget.cpp b/web/webget/webget.cpp index 7283f575..2fe39a7b 100644 --- a/web/webget/webget.cpp +++ b/web/webget/webget.cpp @@ -417,6 +417,17 @@ void MainObject::PutAudio() f1.removeLast(); QString title=f1.join("."); + // + // Generate destination e-mail addresses + // + QStringList to_addrs; + if(!group->notifyEmailAddress().isEmpty()) { + to_addrs.push_back(group->notifyEmailAddress()); + } + if(!rda->user()->emailAddress().isEmpty()) { + to_addrs.push_back(rda->user()->emailAddress()); + } + // // Validate title uniqueness // @@ -442,9 +453,12 @@ void MainObject::PutAudio() short_name.toUtf8().constData(), rda->user()->name().toUtf8().constData(), webget_post->clientAddress().toString().toUtf8().constData()); - RDSendMail(&err_msg,tr("Rivendell import FAILURE for file: ")+short_name, - body,rda->system()->originEmailAddress(), - group->notifyEmailAddress()); + if(to_addrs.size()>0) { + RDSendMail(&err_msg,tr("Rivendell import FAILURE for file: ")+ + short_name,body,rda->system()->originEmailAddress(), + to_addrs); + //group->notifyEmailAddress()); + } TextExit(tr("Audio import failed: title already exists!"),400, LINE_NUMBER); } From 80c6d96e2eeb7c64b5525cfabe118dde26cf930a Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Thu, 24 Dec 2020 12:35:22 -0500 Subject: [PATCH 3/4] 2020-12-24 Fred Gleason * Incremented the package version to 3.5.0int0. Signed-off-by: Fred Gleason --- ChangeLog | 2 ++ NEWS | 14 ++++++++++++++ PACKAGE_VERSION | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1901433e..f89a9c91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20693,3 +20693,5 @@ * Modified the Webget service so as to send e-mail reports to the address of the current Rivendell user in addition to the group's Notification E-Mail Address. +2020-12-24 Fred Gleason + * Incremented the package version to 3.5.0int0. diff --git a/NEWS b/NEWS index 24fbadcc..58ebc126 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,19 @@ The NEWS file for the Rivendell package. +------------------------------------------------------------------------------- +v3.5.0int0 -- 24 December 2020 + +Changes: + RDImport. Added the user's e-mail address to the set of addressees used + when the '--send-mail' switch is used. + +Database Update: + This version of Rivendell uses database schema version 346, and will + automatically upgrade any earlier versions. To see the current schema + version prior to upgrade, see RDAdmin->SystemInfo. + + Be sure to run 'rddbmgr --modify' (as root) immediately after upgrading + to allow any necessary changes to the database schema to be applied. ------------------------------------------------------------------------------- v3.5.0 -- 12 December 2020 diff --git a/PACKAGE_VERSION b/PACKAGE_VERSION index e5b82034..7630524e 100644 --- a/PACKAGE_VERSION +++ b/PACKAGE_VERSION @@ -1 +1 @@ -3.5.0 \ No newline at end of file +3.5.0int0 \ No newline at end of file From 4d602a589bad59252b55552064642a922a09ec62 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Thu, 24 Dec 2020 13:40:44 -0500 Subject: [PATCH 4/4] 2020-12-24 Fred Gleason * Modified the schema map in rddbmgr(8) to position schema update 347 as part of v3.6.x. Signed-off-by: Fred Gleason --- ChangeLog | 3 +++ utils/rddbmgr/schemamap.cpp | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9248e7d7..4205f993 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20699,3 +20699,6 @@ * Fixed title separation in rdlogmanager(1) scheduler. * Added a 'STACK_LINES.TITLE' field to the database. * Incremented the database version to 347. +2020-12-24 Fred Gleason + * Modified the schema map in rddbmgr(8) to position schema update + 347 as part of v3.6.x. diff --git a/utils/rddbmgr/schemamap.cpp b/utils/rddbmgr/schemamap.cpp index 7dbd8d53..e81cb07b 100644 --- a/utils/rddbmgr/schemamap.cpp +++ b/utils/rddbmgr/schemamap.cpp @@ -161,7 +161,8 @@ void MainObject::InitializeSchemaMap() { global_version_map["3.2"]=311; global_version_map["3.3"]=314; global_version_map["3.4"]=317; - global_version_map["3.5"]=347; + global_version_map["3.5"]=346; + global_version_map["3.6"]=347; }