2020-08-11 Fred Gleason <fredg@paravelsystems.com>

* Dropped the 'ENCODERS', 'ENCODER_BITRATES', 'ENCODER_BITRATES'
	and 'ENCODER_CHANNELS' tables from the database.
	* Incremented the database version to 331.
	* Removed the 'RDSettings::customCommandLine()',
	'RDSettings::setCustomCommandLine()' and
	' RDSettings::resolvedCustomCommandLine()' methods.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2020-08-11 15:53:33 -04:00
parent 972b9c164e
commit 8ada6c0812
15 changed files with 91 additions and 189 deletions

View File

@ -20203,3 +20203,10 @@
attempting to post a log with no events selected.
2020-08-11 Fred Gleason <fredg@paravelsystems.com>
* Incremented the package version to 3.4.0rss3.
2020-08-11 Fred Gleason <fredg@paravelsystems.com>
* Dropped the 'ENCODERS', 'ENCODER_BITRATES', 'ENCODER_BITRATES'
and 'ENCODER_CHANNELS' tables from the database.
* Incremented the database version to 331.
* Removed the 'RDSettings::customCommandLine()',
'RDSettings::setCustomCommandLine()' and
' RDSettings::resolvedCustomCommandLine()' methods.

View File

@ -40,10 +40,6 @@ EXTRA_DIST = audio_cards.txt\
dropbox_paths.txt\
dropbox_sched_codes.txt\
elr_lines.txt\
encoder_bitrates.txt\
encoder_channels.txt\
encoder_samplerates.txt\
encoders.txt\
event_lines.txt\
event_perms.txt\
events.txt\

View File

@ -1,11 +0,0 @@
ENCODER_BITRATES Table Layout for Rivendell
The ENCODER_BITRATES table holds data concerning the allowed bit rates
in bits/sec for each custom encoder format on the system.
Following is the layout of a record in the ENCODER_BITRATES table:
FIELD NAME TYPE REMARKS
-------------------------------------------------------------------
ID int(11)
ENCODER_ID int(11) From ENCODERS.ID
BITRATE int(11)

View File

@ -1,11 +0,0 @@
ENCODER_CHANNELS Table Layout for Rivendell
The ENCODER_CHANNELS table holds data concerning the allowed channel
count for each custom encoder format on the system.
Following is the layout of a record in the ENCODER_CHANNELS table:
FIELD NAME TYPE REMARKS
-------------------------------------------------------------------
ID int(11)
ENCODER_ID int(11) From ENCODERS.ID
CHANNELS int(11)

View File

@ -1,11 +0,0 @@
ENCODER_SAMPLERATES Table Layout for Rivendell
The ENCODER_SAMPLERATES table holds data concerning the allowed
sample rates in samples/sec for each custom encoder format on the system.
Following is the layout of a record in the ENCODER_SAMPLERATES table:
FIELD NAME TYPE REMARKS
-------------------------------------------------------------------
ID int(11)
ENCODER_ID int(11) From ENCODERS.ID
SAMPLERATE int(11)

View File

@ -1,12 +0,0 @@
ENCODERS Table Layout for Rivendell
The EVENTS table holds data concerning each custom encoder format
on the system.
FIELD NAME TYPE REMARKS
-------------------------------------------------------------------
ID int(11)
NAME varchar(32)
STATION_NAME varchar(64) From STATIONS.NAME
COMMAND_LINE varchar(255)
DEFAULT_EXTENSION varchar(16)

View File

@ -24,7 +24,7 @@
/*
* Current Database Version
*/
#define RD_VERSION_DATABASE 330
#define RD_VERSION_DATABASE 331
#endif // DBVERSION_H

View File

@ -2,7 +2,7 @@
//
// Audio Format Settings
//
// (C) Copyright 2002-2015 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2020 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
@ -184,24 +184,6 @@ QString RDSettings::description()
case RDSettings::OggVorbis:
desc=QString().sprintf("OggVorbis, Qual %d, ",set_quality);
break;
default: // Custom format
if(set_format_name.isEmpty()) {
sql=QString().sprintf("select NAME from ENCODERS where ID=%d",
set_format);
q=new RDSqlQuery(sql);
if(q->first()) {
set_format_name=q->value(0).toString();
}
else {
set_format_name="Unknown";
}
delete q;
}
desc=set_format_name+" ";
if(set_bit_rate>0) {
desc+=" "+QString().sprintf("%d kbit/sec, ",set_bit_rate/1000);
}
}
if(set_sample_rate>0) {
desc+=QString().sprintf("%d samp/sec, ",set_sample_rate);
@ -223,42 +205,6 @@ QString RDSettings::description()
}
QString RDSettings::customCommandLine() const
{
return set_custom_command_line;
}
void RDSettings::setCustomCommandLine(const QString &str)
{
set_custom_command_line=str;
}
QString RDSettings::resolvedCustomCommandLine(const QString &destfile)
{
if(set_custom_command_line.isEmpty()) {
QString sql;
RDSqlQuery *q;
sql=QString().sprintf("select COMMAND_LINE from ENCODERS where ID=%d",
set_format);
q=new RDSqlQuery(sql);
if(q->first()) {
set_custom_command_line=q->value(0).toString();
}
delete q;
}
QString ret=set_custom_command_line;
ret.replace("%f",destfile);
ret.replace("%c",QString().sprintf("%u",set_channels));
ret.replace("%r",QString().sprintf("%u",set_sample_rate));
ret.replace("%b",QString().sprintf("%u",set_bit_rate));
return ret;
}
QString RDSettings::pathName(const QString &stationname,QString pathname,
RDSettings::Format fmt)
{
@ -336,23 +282,7 @@ QString RDSettings::defaultExtension(const QString &stationname,
return QString("ogg");
}
//
// Custom Format
//
QString sql;
RDSqlQuery *q;
QString ret;
sql=QString("select DEFAULT_EXTENSION from ENCODERS where ")+
QString().sprintf("ID=%d)&&",fmt)+
"(STATION_NAME=\""+RDEscapeString(stationname)+"\")";
q=new RDSqlQuery(sql);
if(q->first()) {
ret=q->value(0).toString();
}
delete q;
return ret;
return QString("dat");
}
@ -394,5 +324,5 @@ void RDSettings::clear()
set_quality=0;
set_normalization_level=0;
set_autotrim_level=0;
set_custom_command_line="";
// set_custom_command_line="";
}

View File

@ -2,7 +2,7 @@
//
// Audio Format Settings
//
// (C) Copyright 2002-2015 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2020 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
@ -48,9 +48,6 @@ class RDSettings
int autotrimLevel() const;
void setAutotrimLevel(int level);
QString description();
QString customCommandLine() const;
void setCustomCommandLine(const QString &str);
QString resolvedCustomCommandLine(const QString &destfile);
static QString pathName(const QString &stationname,QString pathname,
RDSettings::Format fmt);
static QString defaultExtension(RDSettings::Format fmt);
@ -70,9 +67,7 @@ class RDSettings
unsigned set_quality;
int set_normalization_level;
int set_autotrim_level;
QString set_custom_command_line;
};
#endif
#endif // RDSETTINGS_H

View File

@ -1978,28 +1978,6 @@ void RDStation::remove(const QString &name)
"OWNER=\""+RDEscapeString(name)+"\")";
q=new RDSqlQuery(sql);
delete q;
sql=QString("select ID from ENCODERS where ")+
"STATION_NAME=\""+RDEscapeString(name)+"\"";
q=new RDSqlQuery(sql);
while(q->next()) {
sql=QString().sprintf("delete from ENCODER_CHANNELS where ENCODER_ID=%d",
q->value(0).toInt());
q1=new RDSqlQuery(sql);
delete q1;
sql=QString().sprintf("delete from ENCODER_SAMPLERATES where ENCODER_ID=%d",
q->value(0).toInt());
q1=new RDSqlQuery(sql);
delete q1;
sql=QString().sprintf("delete from ENCODER_BITRATES where ENCODER_ID=%d",
q->value(0).toInt());
q1=new RDSqlQuery(sql);
delete q1;
}
delete q;
sql=QString("delete from ENCODERS where ")+
"STATION_NAME=\""+RDEscapeString(name)+"\"";
q=new RDSqlQuery(sql);
delete q;
sql=QString().sprintf("delete from RDHOTKEYS where ")+
"STATION_NAME=\""+RDEscapeString(name)+"\"";
q=new RDSqlQuery(sql);

View File

@ -206,8 +206,9 @@ ListCasts::ListCasts(unsigned feed_id,bool is_super,QWidget *parent)
connect(list_close_button,SIGNAL(clicked()),this,SLOT(closeData()));
RefreshList();
GetEncoderId();
connect(rda->ripc(),SIGNAL(userChanged()),this,SLOT(userChangedData()));
userChangedData();
}
@ -440,10 +441,8 @@ void ListCasts::userChangedData()
{
bool is_superfeed=list_feed->isSuperfeed();
list_cart_button->setEnabled(rda->user()->addPodcast()&&
(list_encoder_id>=0)&&(!is_superfeed));
list_file_button->setEnabled(rda->user()->addPodcast()&&
(list_encoder_id>=0)&&(!is_superfeed));
list_cart_button->setEnabled(rda->user()->addPodcast()&&(!is_superfeed));
list_file_button->setEnabled(rda->user()->addPodcast()&&(!is_superfeed));
list_edit_button->setEnabled(rda->user()->editPodcast()&&(!is_superfeed));
list_delete_button->
setEnabled(rda->user()->deletePodcast()&&(!is_superfeed));
@ -640,32 +639,3 @@ void ListCasts::RefreshItem(RDListViewItem *item)
}
delete q;
}
void ListCasts::GetEncoderId()
{
QString sql;
RDSqlQuery *q;
list_encoder_id=-1;
RDFeed *feed=new RDFeed(list_feed_id,rda->config());
int format=feed->uploadFormat();
delete feed;
if((format>0)&&(format<100)) { // Built-in format
list_encoder_id=format;
return;
}
sql=QString().sprintf("select NAME from ENCODERS where ID=%d",format);
q=new RDSqlQuery(sql);
if(q->first()) {
sql=QString("select ID from ENCODERS where ")+
"(NAME=\""+RDEscapeString(q->value(0).toString())+"\")&&"+
"(STATION_NAME=\""+RDEscapeString(rda->station()->name())+"\")";
delete q;
q=new RDSqlQuery(sql);
if(q->first()) {
list_encoder_id=q->value(0).toInt();
}
}
delete q;
}

View File

@ -73,7 +73,6 @@ class ListCasts : public RDDialog
QPixmap *list_redball_map;
QPixmap *list_whiteball_map;
unsigned list_feed_id;
int list_encoder_id;
QLabel *list_filter_label;
QLineEdit *list_filter_edit;
QLabel *list_unexpired_label;

View File

@ -40,6 +40,68 @@ bool MainObject::RevertSchema(int cur_schema,int set_schema,QString *err_msg)
// NEW SCHEMA REVERSIONS GO HERE...
//
// Revert 331
//
if((cur_schema==331)&&(set_schema<cur_schema)) {
sql=QString("create table if not exists ENCODER_CHANNELS (")+
"ID int not null auto_increment primary key,"+
"ENCODER_ID int not null,"+
"CHANNELS int not null,"+
"index ENCODER_ID_IDX(ENCODER_ID))"+
" charset utf8mb4 collate utf8mb4_general_ci"+
db_table_create_postfix;
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
sql=QString("create table if not exists ENCODER_BITRATES (")+
"ID int not null auto_increment primary key,"+
"ENCODER_ID int not null,"+
"BITRATES int not null,"+
"index ENCODER_ID_IDX(ENCODER_ID))"+
" charset utf8mb4 collate utf8mb4_general_ci"+
db_table_create_postfix;
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
sql=QString("create table if not exists ENCODER_SAMPLERATES (")+
"ID int not null auto_increment primary key,"+
"ENCODER_ID int not null,"+
"SAMPLERATES int not null,"+
"index ENCODER_ID_IDX(ENCODER_ID))"+
" charset utf8mb4 collate utf8mb4_general_ci"+
db_table_create_postfix;
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
sql=QString("create table if not exists ENCODERS (")+
"ID int not null auto_increment primary key,"+
"NAME char(32) not null,"+
"STATION_NAME char(64),"+
"COMMAND_LINE char(255),"+
"DEFAULT_EXTENSION char(16),"+
"index NAME_IDX(NAME,STATION_NAME))"+
" charset utf8mb4 collate utf8mb4_general_ci"+
db_table_create_postfix;
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
// Ensure that dynamic format IDs start after 100
sql=QString("insert into ENCODERS set ID=100,NAME=\"dummy\"");
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
sql=QString("delete from ENCODERS where ID=100");
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
WriteSchemaVersion(--cur_schema);
}
//
// Revert 330
//
@ -100,7 +162,7 @@ bool MainObject::RevertSchema(int cur_schema,int set_schema,QString *err_msg)
"ACCESS_DATE date not null,"+
"ACCESS_COUNT int unsigned not null default 0,"+
"unique index KEY_NAME_CAST_ID_DATE_IDX(FEED_KEY_NAME,CAST_ID,ACCESS_DATE))"+
" charset latin1 collate latin1_swedish_ci"+
" charset utf8mb4 collate utf8mb4_general_ci"+
db_table_create_postfix;
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;

View File

@ -161,7 +161,7 @@ void MainObject::InitializeSchemaMap() {
global_version_map["3.2"]=311;
global_version_map["3.3"]=314;
global_version_map["3.4"]=317;
global_version_map["4.0"]=330;
global_version_map["4.0"]=331;
}

View File

@ -10176,6 +10176,16 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg)
WriteSchemaVersion(++cur_schema);
}
if((cur_schema<331)&&(set_schema>cur_schema)) {
DropTable("ENCODER_SAMPLERATES");
DropTable("ENCODER_BITRATES");
DropTable("ENCODER_CHANNELS");
DropTable("ENCODERS");
WriteSchemaVersion(++cur_schema);
}
// NEW SCHEMA UPDATES GO HERE...