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