python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / applications / video / clipgrab / yt-dlp-path.patch
blob5a9a4b6dcc48dc9740164e67380788e5e054ad8b
1 --- a/main.cpp
2 +++ b/main.cpp
3 @@ -91,14 +91,5 @@ int main(int argc, char *argv[])
4 w.show();
7 - QTimer::singleShot(0, [=] {
8 - cg->getUpdateInfo();
9 - QObject::connect(cg, &ClipGrab::updateInfoProcessed, [cg] {
10 - bool force = QSettings().value("forceYoutubeDlDownload", false).toBool();
11 - if (force) QSettings().setValue("forceYoutubeDlDownload", false);
12 - cg->downloadYoutubeDl(force);
13 - });
14 - });
16 return app.exec();
18 --- a/youtube_dl.cpp
19 +++ b/youtube_dl.cpp
20 @@ -8,52 +8,16 @@ YoutubeDl::YoutubeDl()
21 QString YoutubeDl::path = QString();
23 QString YoutubeDl::find(bool force) {
24 - if (!force && !path.isEmpty()) return path;
26 - // Prefer downloaded youtube-dl
27 - QString localPath = QStandardPaths::locate(QStandardPaths::AppDataLocation, "yt-dlp");
28 - QProcess* process = instance(localPath, QStringList() << "--version");
29 - process->start();
30 - process->waitForFinished();
31 - process->deleteLater();
32 - if (process->state() != QProcess::NotRunning) process->kill();
33 - if (process->exitCode() == QProcess::ExitStatus::NormalExit) {
34 - path = localPath;
35 - return path;
36 - }
38 - // Try system-wide youtube-dlp installation
39 - QString globalPath = QStandardPaths::findExecutable("yt-dlp");
40 - process = instance(globalPath, QStringList() << "--version");
41 - process->start();
42 - process->waitForFinished();
43 - process->deleteLater();
44 - if (process->state() != QProcess::NotRunning) process->kill();
45 - if (process->exitCode() == QProcess::ExitStatus::NormalExit) {
46 - path = globalPath;
47 - return path;
48 - }
50 - return "";
51 + // We supply yt-dlp from nixpkgs, so the downloading
52 + // machinery is not needed anymore.
53 + (void)force;
54 + return path;
57 QProcess* YoutubeDl::instance(QStringList arguments) {
58 - return instance(find(), arguments);
61 -QProcess* YoutubeDl::instance(QString path, QStringList arguments) {
62 QProcess *process = new QProcess();
64 - QString execPath = QCoreApplication::applicationDirPath();
65 - QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
66 - env.insert("PATH", execPath + ":" + env.value("PATH"));
67 - process->setEnvironment(env.toStringList());
69 - #if defined Q_OS_WIN
70 - process->setProgram(execPath + "/python/python.exe");
71 - #else
72 - process->setProgram(QStandardPaths::findExecutable("python3"));
73 - #endif
74 + process->setProgram(path);
76 QSettings settings;
77 QStringList proxyArguments;
78 @@ -81,7 +45,7 @@ QProcess* YoutubeDl::instance(QString path, QStringList arguments) {
79 networkArguments << "--force-ipv4";
82 - process->setArguments(QStringList() << path << arguments << proxyArguments << networkArguments);
83 + process->setArguments(QStringList() << arguments << proxyArguments << networkArguments);
84 return process;