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

@@ -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);