-
Notifications
You must be signed in to change notification settings - Fork 0
/
youtubesearcher.h
65 lines (52 loc) · 1.45 KB
/
youtubesearcher.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef YOUTUBESEARCHER_H
#define YOUTUBESEARCHER_H
#include <QObject>
#include <QSettings>
#include <QProcess>
#include <QLoggingCategory>
#include <QThread>
Q_DECLARE_LOGGING_CATEGORY(youtube)
//class YtSearch : QObject
//{
// Q_OBJECT
//public:
// //explicit YtSearch(QString query, int count);
//public slots:
// void query(QString query, int count);
//signals:
// void queryResult(QByteArray jsonArr);
//};
class YoutubeService
{
};
#include <QFuture>
#include <QFutureWatcher>
// A class that invokes youtube-dl and passes results
class YoutubeDl : public QObject
{
Q_OBJECT
public:
explicit YoutubeDl(QObject *parent = nullptr);
QByteArray query(QString query, int max=10);
void getPythonVersion();
void getYoutubeDlVersion();
protected:
QByteArray _run(QString program, QStringList parameter);
QByteArray run_python(QStringList parameter);
QByteArray run_python_code(QString code);
std::function<QByteArray(QStringList)> run_ytdl;
QString m_python_interpreter{QSettings{}.value(
"python-interpreter",
"/home/ablepharus/.std/bin/python").toString()};
bool m_explicit_python{QSettings{}.value(
"explicit-python-interpreter",
true).toBool()};
QString m_ytdl{QSettings{}.value(
"ytdl-path",
"/home/ablepharus/.std/bin/youtube-dl").toString()};
QProcess m_process;
QString py_version;
QString ytdl_version;
signals:
};
#endif // YOUTUBESEARCHER_H