/**************************************************************************
Copyright (C) 2020 Arnaud Champenois arthelion@free.fr
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
**************************************************************************/
#ifndef INFOPRINTER_H
#define INFOPRINTER_H
#include <QObject>
#include "LASTARProcessor.h"
#include "processparameters.h"
#include "settingsreader.h"
#include "filenamestring.h"
#include "sound_tools.h"
/**
* @brief The BatchProcessor class manages the commandline mode
*/
class BatchProcessor : public QObject
{
Q_OBJECT
public:
BatchProcessor();
bool setProcessParameters(QString presetName);
void setFileList(QStringList fileNameList);
void setOutputFileName(QString fileName);
void setFormat(QString format); // optional
SoundTools::Status process();
// ID Tags overload
void setCoverImage(QString fileName);
void setArtist(QString value) {
if(!value.isEmpty())
mParameters.mTags.mArtist = value.toStdString();
}
void setAlbum(QString value) {
if(!value.isEmpty())
mParameters.mTags.mAlbum = value.toStdString();
}
void setTitle(QString value) {
if(!value.isEmpty())
mParameters.mTags.mTitle = value.toStdString();
}
void setYear(QString value) {
if(!value.isEmpty())
mParameters.mTags.mYear = value.toStdString();
}
void setTrack(QString value) {
if(!value.isEmpty())
mParameters.mTags.mTrack = value.toStdString();
}
void setGenre(QString value) {
if(!value.isEmpty())
mParameters.mTags.mGenre = value.toStdString();
}
public slots:
void printMessage(QString message);
void printProgression(int percent);
void printError(QString message);
private:
void addToFileList(QString &fileIn,QStringList&fileListOut);
void updateOutput(FileNameString &input);
int mLastProgress = 0;
bool mOutputEmpty = true;
bool mOutputIsDir = true;
LASTARProcessor mProcessor;
ProcessParameters mParameters;
FileNameString mOutputFileName;
FileNameString mOutputBaseName;
QString mFormat;
QStringList mInputFileNames;
SettingsReader mSettingsReader;
bool mHasWrittenConsole = false;
};
#endif // INFOPRINTER_H