Skip to content

Commit

Permalink
2021-07-29 Fred Gleason <[email protected]>
Browse files Browse the repository at this point in the history
	* 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 <[email protected]>
  • Loading branch information
ElvishArtisan committed Jul 29, 2021
1 parent e15c964 commit 0b401e3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -20775,3 +20775,7 @@
2021-07-20 Fred Gleason <[email protected]>
* Fixed a bug in rdlogedit(1) that could cause a segfault when
attempting to play a non-audio event in the 'Voice Tracker' dialog.
2021-07-29 Fred Gleason <[email protected]>
* 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.
40 changes: 20 additions & 20 deletions utils/rdimport/rdimport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// A Batch Importer for Rivendell.
//
// (C) Copyright 2002-2020 Fred Gleason <[email protected]>
// (C) Copyright 2002-2021 Fred Gleason <[email protected]>
//
// 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
Expand Down Expand Up @@ -1076,16 +1076,21 @@ MainObject::Result MainObject::ImportFile(const QString &filename,
//
// Ensure that we have a valid title
//
bool cart_exists=false;
if(*cartnum!=0) {
cart_exists=RDCart::exists(*cartnum);
if(import_string_title.isEmpty()) {
bool cart_exists=false;
if(*cartnum!=0) {
cart_exists=RDCart::exists(*cartnum);
}
//
// 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));
}
}
//
// 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);
}

//
Expand Down Expand Up @@ -1204,13 +1209,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().stripWhiteSpace().toUtf8().constData(),
*cartnum));
}
Log(LOG_INFO,QString().
sprintf(" Importing file \"%s\" [%s] to cart %06u ... ",
RDGetBasePart(filename).toUtf8().constData(),
wavedata->title().stripWhiteSpace().toUtf8().constData(),
*cartnum));
switch(conv_err=conv->runImport(rda->user()->name(),rda->user()->password(),
&audio_conv_err)) {
case RDAudioImport::ErrorOk:
Expand Down Expand Up @@ -1340,9 +1343,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);
}
Expand Down

0 comments on commit 0b401e3

Please sign in to comment.