From 195394988a66cb9d30395e0dab6fb3bf3cd37782 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Thu, 29 Jul 2021 12:39:51 -0400 Subject: [PATCH] 2021-07-29 Fred Gleason * 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 --- ChangeLog | 4 ++++ utils/rdimport/rdimport.cpp | 28 ++++++++++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index d03885cb..7bd9c41f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22119,3 +22119,7 @@ ('RDMarkerDialog') dialog. 2021-07-29 Fred Gleason * Removed stale entries from 'lib/librd.pro'. +2021-07-29 Fred Gleason + * 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. diff --git a/utils/rdimport/rdimport.cpp b/utils/rdimport/rdimport.cpp index a260faaf..c35e4854 100644 --- a/utils/rdimport/rdimport.cpp +++ b/utils/rdimport/rdimport.cpp @@ -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); }