1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-02 08:39:46 +02:00

Revert "Extension" handling in ExportCL

This reverts commits:

  66661daa0519d97081fc20b7f24beeb1812a9440
  1c2ebfae946f73a802e1e9abc76531ec9a3a07dc
This commit is contained in:
Leland Lucius 2020-04-03 14:18:36 -05:00
parent 36e2c0d4b9
commit abf0f8157e

View File

@ -134,15 +134,10 @@ void ExportCLOptions::PopulateOrExchange(ShuttleGui & S)
cmds);
S.Id(ID_BROWSE).AddButton(XO("Browse..."),
wxALIGN_CENTER_VERTICAL);
S.TieTextBox(XO("Extension:"),
{ wxT("/FileFormats/ExternalProgramExtension"), wxT("wav") },
30);
S.AddFixedText( {} );
S.AddFixedText( {} );
S.TieCheckBox(XO("Show output"),
{wxT("/FileFormats/ExternalProgramShowOutput"),
false});
S.AddFixedText({});
}
S.EndMultiColumn();
}
@ -305,14 +300,11 @@ public:
// Optional
bool CheckFileName(wxFileName &filename, int format = 0) override;
FileExtension GetExtension(int index) override;
private:
void GetSettings();
std::vector<char> GetMetaChunk(const Tags *metadata);
wxString mCmd;
wxString mExt;
bool mShow;
struct ExtendPath
@ -383,17 +375,15 @@ ProgressResult ExportCL::Export(AudacityProject *project,
wxString output;
long rc;
const auto path = fName.GetFullPath();
GetSettings();
wxFileName fn = fName;
if (!fn.HasExt()) {
if (mCmd.find(wxT("%f.")) == wxNOT_FOUND) {
fn.SetExt(mExt);
}
}
const auto path = fn.GetFullPath();
// Bug 2178 - users who don't know what they are doing will
// now get a file extension of .wav appended to their ffmpeg filename
// and therefore ffmpeg will be able to choose a file type.
if( mCmd == wxT("ffmpeg -i - \"%f\"") && !fName.HasExt())
mCmd.Replace( "%f", "%f.wav" );
mCmd.Replace(wxT("%f"), path);
// Kick off the command
@ -805,19 +795,11 @@ bool ExportCL::CheckFileName(wxFileName &filename, int WXUNUSED(format))
return true;
}
FileExtension ExportCL::GetExtension(int index)
{
GetSettings();
return mExt;
}
void ExportCL::GetSettings()
{
// Retrieve settings
gPrefs->Read(wxT("/FileFormats/ExternalProgramShowOutput"), &mShow, false);
mCmd = gPrefs->Read(wxT("/FileFormats/ExternalProgramExportCommand"), wxT("lame - \"%f.mp3\""));
mExt = gPrefs->Read(wxT("/FileFormats/ExternalProgramExtension"), wxT("wav"));
}
static Exporter::RegisteredExportPlugin sRegisteredPlugin{ "CommandLine",