File indexing completed on 2024-04-21 04:48:15

0001 /* AUDEX CDDA EXTRACTOR
0002  * SPDX-FileCopyrightText: Copyright (C) 2007 Marco Nelles
0003  * <https://userbase.kde.org/Audex>
0004  *
0005  * SPDX-License-Identifier: GPL-3.0-or-later
0006  */
0007 
0008 #ifndef ENCODERWRAPPER_HEADER
0009 #define ENCODERWRAPPER_HEADER
0010 
0011 #include <QImage>
0012 #include <QRegularExpression>
0013 #include <QString>
0014 
0015 #include <KLocalizedString>
0016 #include <KProcess>
0017 
0018 #include "utils/schemeparser.h"
0019 
0020 class EncoderWrapper : public QObject
0021 {
0022     Q_OBJECT
0023 
0024 public:
0025     explicit EncoderWrapper(QObject *parent = nullptr,
0026                             const QString &commandScheme = "",
0027                             const QString &encoderName = "",
0028                             const bool deleteFractionFiles = true);
0029     ~EncoderWrapper() override;
0030 
0031     bool isProcessing();
0032     const QStringList &log();
0033 
0034 public Q_SLOTS:
0035     bool encode(int n,
0036                 int cdno,
0037                 int trackoffset,
0038                 int nooftracks,
0039                 const QString &artist,
0040                 const QString &album,
0041                 const QString &tartist,
0042                 const QString &ttitle,
0043                 const QString &genre,
0044                 const QString &date,
0045                 const QString &isrc,
0046                 const QString &suffix,
0047                 const QImage &cover,
0048                 const QString &tmppath,
0049                 const QString &input,
0050                 const QString &output);
0051     void cancel();
0052 
0053 private Q_SLOTS:
0054     void parseOutput();
0055     void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
0056     void processError(QProcess::ProcessError err);
0057 
0058 Q_SIGNALS:
0059     void progress(int percent_of_track);
0060     void finished();
0061 
0062     void error(const QString &message, const QString &details = QString());
0063     void warning(const QString &message);
0064     void info(const QString &message);
0065 
0066 private:
0067     QString command_scheme;
0068     QString encoder_name;
0069     bool delete_fraction_files;
0070 
0071     QString encoder;
0072     QStringList p_log;
0073 
0074     QString processing_filename;
0075 
0076     bool termination;
0077     int processing;
0078 
0079     KProcess proc;
0080 
0081     int not_found_counter;
0082 };
0083 
0084 #endif