Added overwrite_existing argument to Transcoder::AddJob
This commit is contained in:
parent
83d961f808
commit
5c8ca3754f
|
@ -319,7 +319,7 @@ Song::FileType Transcoder::PickBestFormat(QList<Song::FileType> supported) {
|
|||
}
|
||||
|
||||
void Transcoder::AddJob(const QString& input, const TranscoderPreset& preset,
|
||||
const QString& output) {
|
||||
const QString& output, bool overwrite_existing) {
|
||||
Job job;
|
||||
job.input = input;
|
||||
job.preset = preset;
|
||||
|
@ -331,8 +331,8 @@ void Transcoder::AddJob(const QString& input, const TranscoderPreset& preset,
|
|||
else
|
||||
job.output = input.section('.', 0, -2) + '.' + preset.extension_;
|
||||
|
||||
// Never overwrite existing files
|
||||
if (QFile::exists(job.output)) {
|
||||
// Don't overwrite existing files if overwrite_existing is not set
|
||||
if (!overwrite_existing && QFile::exists(job.output)) {
|
||||
for (int i = 0;; ++i) {
|
||||
QString new_filename = QString("%1.%2.%3")
|
||||
.arg(job.output.section('.', 0, -2))
|
||||
|
|
|
@ -71,7 +71,8 @@ class Transcoder : public QObject {
|
|||
void set_max_threads(int count) { max_threads_ = count; }
|
||||
|
||||
void AddJob(const QString& input, const TranscoderPreset& preset,
|
||||
const QString& output = QString());
|
||||
const QString& output = QString(),
|
||||
bool overwrite_existing = false);
|
||||
void AddTemporaryJob(const QString& input, const TranscoderPreset& preset);
|
||||
|
||||
QMap<QString, float> GetProgress() const;
|
||||
|
|
Loading…
Reference in New Issue