mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-06 19:12:30 +01:00
Fix sentry and ffmpeg
This commit is contained in:
parent
e118fa235c
commit
30d05aa5e9
@ -158,14 +158,8 @@ void App::init()
|
|||||||
|
|
||||||
sentry_options_t* options = sentry_options_new();
|
sentry_options_t* options = sentry_options_new();
|
||||||
sentry_options_set_dsn(options, "https://425ea0b77def4f91a5a9decc01b36ff4@o428218.ingest.sentry.io/5373419");
|
sentry_options_set_dsn(options, "https://425ea0b77def4f91a5a9decc01b36ff4@o428218.ingest.sentry.io/5373419");
|
||||||
|
sentry_options_set_handler_path(options, QString(QGuiApplication::applicationDirPath() + "/crashpad_handler" + ScreenPlayUtil::executableBinEnding()).toStdString().c_str());
|
||||||
const QString appPath = QGuiApplication::applicationDirPath();
|
sentry_options_set_database_path(options, QGuiApplication::applicationDirPath().toStdString().c_str());
|
||||||
QString exectuableFileEnding = "";
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
exectuableFileEnding = ".exe";
|
|
||||||
#endif
|
|
||||||
sentry_options_set_handler_path(options, QString(appPath + "/crashpad_handler" + exectuableFileEnding).toStdString().c_str());
|
|
||||||
sentry_options_set_database_path(options, appPath.toStdString().c_str());
|
|
||||||
const int sentryInitStatus = sentry_init(options);
|
const int sentryInitStatus = sentry_init(options);
|
||||||
if (sentryInitStatus != 0) {
|
if (sentryInitStatus != 0) {
|
||||||
qWarning() << "Unable to inti sentry crashhandler with statuscode: " << sentryInitStatus;
|
qWarning() << "Unable to inti sentry crashhandler with statuscode: " << sentryInitStatus;
|
||||||
|
@ -33,18 +33,19 @@ CreateImportVideo::CreateImportVideo(const QString& videoPath, const QString& ex
|
|||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_quality(quality)
|
, m_quality(quality)
|
||||||
{
|
{
|
||||||
|
|
||||||
m_videoPath = videoPath;
|
m_videoPath = videoPath;
|
||||||
m_exportPath = exportPath;
|
m_exportPath = exportPath;
|
||||||
m_codec = codec;
|
m_codec = codec;
|
||||||
m_process = std::make_unique<QProcess>(this);
|
m_ffprobeExecutable = QApplication::applicationDirPath() + "/ffprobe" + ScreenPlayUtil::executableBinEnding();
|
||||||
|
m_ffmpegExecutable = QApplication::applicationDirPath() + "/ffmpeg" + ScreenPlayUtil::executableBinEnding();
|
||||||
|
|
||||||
QString fileEnding ;
|
if (!QFileInfo::exists(m_ffprobeExecutable)) {
|
||||||
#ifdef Q_OS_WIN
|
qFatal("FFPROBE executable not found!");
|
||||||
fileEnding = ScreenPlayUtil::executableEnding();
|
}
|
||||||
#endif
|
|
||||||
m_ffprobeExecutable = QApplication::applicationDirPath() + "/ffprobe" + fileEnding;
|
if (!QFileInfo::exists(m_ffmpegExecutable)) {
|
||||||
m_ffmpegExecutable = QApplication::applicationDirPath() + "/ffmpeg" + fileEnding ;
|
qFatal("FFMPEG executable not found!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -62,7 +63,7 @@ CreateImportVideo::CreateImportVideo(const QString& videoPath, const QString& ex
|
|||||||
void CreateImportVideo::process()
|
void CreateImportVideo::process()
|
||||||
{
|
{
|
||||||
|
|
||||||
qInfo() << "createWallpaperInfo()";
|
qInfo() << "createWallpaperInfo()" << m_videoPath << m_exportPath << m_codec << m_ffmpegExecutable << m_ffprobeExecutable;
|
||||||
if (!createWallpaperInfo() || QThread::currentThread()->isInterruptionRequested()) {
|
if (!createWallpaperInfo() || QThread::currentThread()->isInterruptionRequested()) {
|
||||||
emit abortAndCleanup();
|
emit abortAndCleanup();
|
||||||
return;
|
return;
|
||||||
@ -268,7 +269,7 @@ bool CreateImportVideo::analyzeVideo(const QJsonObject& obj)
|
|||||||
|
|
||||||
QJsonObject videoStream;
|
QJsonObject videoStream;
|
||||||
|
|
||||||
for (const auto stream : arrayStream) {
|
for (const auto& stream : arrayStream) {
|
||||||
QString codec_type = stream.toObject().value("codec_type").toString();
|
QString codec_type = stream.toObject().value("codec_type").toString();
|
||||||
if (codec_type == "video") {
|
if (codec_type == "video") {
|
||||||
videoStream = stream.toObject();
|
videoStream = stream.toObject();
|
||||||
@ -751,19 +752,42 @@ QString CreateImportVideo::waitForFinished(
|
|||||||
const Executable executable)
|
const Executable executable)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
m_process = std::make_unique<QProcess>();
|
||||||
|
QObject::connect(m_process.get(), &QProcess::errorOccurred, [=](QProcess::ProcessError error) {
|
||||||
|
qDebug() << "error enum val = " << error << m_process->errorString();
|
||||||
|
emit createWallpaperStateChanged(ImportVideoState::AnalyseVideoError);
|
||||||
|
m_process->terminate();
|
||||||
|
if (!m_process->waitForFinished(1000)) {
|
||||||
|
m_process->kill();
|
||||||
|
}
|
||||||
|
});
|
||||||
if (executable == Executable::FFMPEG) {
|
if (executable == Executable::FFMPEG) {
|
||||||
m_process->setProgram(m_ffmpegExecutable);
|
m_process->setProgram(m_ffmpegExecutable);
|
||||||
} else {
|
} else {
|
||||||
m_process->setProgram(m_ffprobeExecutable);
|
m_process->setProgram(m_ffprobeExecutable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef Q_OS_OSX
|
||||||
|
QProcess changeChmod;
|
||||||
|
changeChmod.setProgram("chmod");
|
||||||
|
changeChmod.setArguments({ "+x", m_process->program() });
|
||||||
|
changeChmod.start();
|
||||||
|
if (!changeChmod.waitForFinished()) {
|
||||||
|
qCritical() << "Unable to change permission " << m_process->program() << " to be exectuable";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
m_process->setProcessChannelMode(processChannelMode);
|
m_process->setProcessChannelMode(processChannelMode);
|
||||||
m_process->setArguments(args);
|
m_process->setArguments(args);
|
||||||
|
m_process->setWorkingDirectory(QApplication::applicationDirPath());
|
||||||
m_process->start();
|
m_process->start();
|
||||||
|
|
||||||
while (!m_process->waitForFinished(100)) //Wake up every 10ms and check if we must exit
|
qInfo() << m_process->workingDirectory() << m_process->program() << m_process->arguments();
|
||||||
|
|
||||||
|
while (!m_process->waitForFinished(10)) //Wake up every 10ms and check if we must exit
|
||||||
{
|
{
|
||||||
if (QThread::currentThread()->isInterruptionRequested()) {
|
if (QThread::currentThread()->isInterruptionRequested()) {
|
||||||
qDebug() << "Interrupt thread";
|
qInfo() << "Interrupt thread";
|
||||||
m_process->terminate();
|
m_process->terminate();
|
||||||
if (!m_process->waitForFinished(1000)) {
|
if (!m_process->waitForFinished(1000)) {
|
||||||
m_process->kill();
|
m_process->kill();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
#include "ScreenPlayUtil/util.h"
|
#include "ScreenPlayUtil/util.h"
|
||||||
|
#include <QFileInfo>
|
||||||
|
|
||||||
namespace ScreenPlay {
|
namespace ScreenPlay {
|
||||||
|
|
||||||
@ -140,8 +141,8 @@ void Settings::setupWidgetAndWindowPaths()
|
|||||||
{
|
{
|
||||||
QDir workingDir(QGuiApplication::applicationDirPath());
|
QDir workingDir(QGuiApplication::applicationDirPath());
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
m_globalVariables->setWidgetExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWidget" + ScreenPlayUtil::executableEnding()));
|
m_globalVariables->setWidgetExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWidget" + ScreenPlayUtil::executableBinEnding()));
|
||||||
m_globalVariables->setWallpaperExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWallpaper" + ScreenPlayUtil::executableEnding()));
|
m_globalVariables->setWallpaperExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWallpaper" + ScreenPlayUtil::executableBinEnding()));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_OSX
|
#ifdef Q_OS_OSX
|
||||||
@ -152,7 +153,15 @@ void Settings::setupWidgetAndWindowPaths()
|
|||||||
|
|
||||||
m_globalVariables->setWidgetExecutablePath(QUrl::fromUserInput(workingDir.path() + "/ScreenPlayWidget.app/Contents/MacOS/ScreenPlayWidget").toLocalFile());
|
m_globalVariables->setWidgetExecutablePath(QUrl::fromUserInput(workingDir.path() + "/ScreenPlayWidget.app/Contents/MacOS/ScreenPlayWidget").toLocalFile());
|
||||||
m_globalVariables->setWallpaperExecutablePath(QUrl::fromUserInput(workingDir.path() + "/ScreenPlayWallpaper.app/Contents/MacOS/ScreenPlayWallpaper").toLocalFile());
|
m_globalVariables->setWallpaperExecutablePath(QUrl::fromUserInput(workingDir.path() + "/ScreenPlayWallpaper.app/Contents/MacOS/ScreenPlayWallpaper").toLocalFile());
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (!QFileInfo::exists(m_globalVariables->widgetExecutablePath().toString())) {
|
||||||
|
qFatal("widget executable not found!");
|
||||||
|
}
|
||||||
|
if (!QFileInfo::exists(m_globalVariables->wallpaperExecutablePath().toString())) {
|
||||||
|
qFatal("wallpaper executable not found!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -56,7 +56,8 @@ bool copyPreviewThumbnail(QJsonObject& obj, const QString& previewThumbnail, con
|
|||||||
QString toString(const QStringList& list);
|
QString toString(const QStringList& list);
|
||||||
QString toLocal(const QString& url);
|
QString toLocal(const QString& url);
|
||||||
QString generateRandomString(quint32 length = 32);
|
QString generateRandomString(quint32 length = 32);
|
||||||
QString executableEnding();
|
QString executableAppEnding();
|
||||||
|
QString executableBinEnding();
|
||||||
QStringList getAvailableWallpaper();
|
QStringList getAvailableWallpaper();
|
||||||
QStringList getAvailableWidgets();
|
QStringList getAvailableWidgets();
|
||||||
QStringList getAvailableTypes();
|
QStringList getAvailableTypes();
|
||||||
|
@ -114,7 +114,18 @@ QString generateRandomString(quint32 length)
|
|||||||
/*!
|
/*!
|
||||||
\brief Return .exe on windows otherwise empty string.
|
\brief Return .exe on windows otherwise empty string.
|
||||||
*/
|
*/
|
||||||
QString executableEnding()
|
QString executableBinEnding()
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
return ".exe";
|
||||||
|
#endif
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Return .exe on windows, .app on osx otherwise empty string.
|
||||||
|
*/
|
||||||
|
QString executableAppEnding()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
return ".exe";
|
return ".exe";
|
||||||
|
Loading…
Reference in New Issue
Block a user