2021-07-29 Fred Gleason <fredg@paravelsystems.com>

* Fixed a bug in rdimport(1) that caused the cart title
	uniqueness check to be applied to the incorrect string when
	the '--set-string-title=' switch was used.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-07-29 12:39:51 -04:00
parent 0434cdb191
commit 195394988a
2 changed files with 22 additions and 10 deletions

View File

@ -22119,3 +22119,7 @@
('RDMarkerDialog') dialog.
2021-07-29 Fred Gleason <fredg@paravelsystems.com>
* Removed stale entries from 'lib/librd.pro'.
2021-07-29 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in rdimport(1) that caused the cart title
uniqueness check to be applied to the incorrect string when
the '--set-string-title=' switch was used.

View File

@ -1097,6 +1097,19 @@ MainObject::Result MainObject::ImportFile(const QString &filename,
if(*cartnum!=0) {
cart_exists=RDCart::exists(*cartnum);
}
if(import_string_title.isEmpty()) {
//
// If the cart already exists and no title was found in metadata,
// then keep the existing title. Otherwise, generate a default title.
//
if((!cart_exists)&&wavedata->metadataFound()&&wavedata->title().isEmpty()) {
wavedata->setTitle(effective_group->generateTitle(filename));
}
}
else { // Use specified title
wavedata->setTitle(import_string_title);
}
//
// If the cart already exists and no title was found in metadata,
// then keep the existing title. Otherwise, generate a default title.
@ -1221,13 +1234,11 @@ MainObject::Result MainObject::ImportFile(const QString &filename,
settings->setAutotrimLevel(import_autotrim_level/100);
conv->setDestinationSettings(settings);
conv->setUseMetadata(false);
if(import_string_title.isNull()) {
Log(LOG_INFO,QString().
sprintf(" Importing file \"%s\" [%s] to cart %06u ... ",
RDGetBasePart(filename).toUtf8().constData(),
wavedata->title().trimmed().toUtf8().constData(),
*cartnum));
}
Log(LOG_INFO,QString().
sprintf(" Importing file \"%s\" [%s] to cart %06u ... ",
RDGetBasePart(filename).toUtf8().constData(),
wavedata->title().trimmed().toUtf8().constData(),
*cartnum));
switch(conv_err=conv->runImport(rda->user()->name(),rda->user()->password(),
&audio_conv_err)) {
case RDAudioImport::ErrorOk:
@ -1356,9 +1367,6 @@ MainObject::Result MainObject::ImportFile(const QString &filename,
if(!import_string_song_id.isNull()) {
cart->setSongId(import_string_song_id);
}
if(!import_string_title.isNull()) {
cart->setTitle(import_string_title);
}
if(!import_set_user_defined.isEmpty()) {
cart->setUserDefined(import_set_user_defined);
}