From d7566665d88bdc46df532d9ca4dffe5f6173be69 Mon Sep 17 00:00:00 2001 From: Confuseh Date: Tue, 14 Aug 2018 16:36:20 +0100 Subject: [PATCH] minor streamlink quality option fix (#664) --- src/util/StreamLink.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/util/StreamLink.cpp b/src/util/StreamLink.cpp index aa2db55c0..3cf639b6c 100644 --- a/src/util/StreamLink.cpp +++ b/src/util/StreamLink.cpp @@ -4,6 +4,7 @@ #include "Helpers.hpp" #include "singletons/Settings.hpp" #include "widgets/dialogs/QualityPopup.hpp" +#include "debug/Log.hpp" #include #include @@ -83,7 +84,7 @@ QProcess *createStreamlinkProcess() if (err == QProcess::FailedToStart) { showStreamlinkNotFoundError(); } else { - qDebug() << "Error occured: " << err; // + log("Error occured {}", err); } p->deleteLater(); @@ -109,7 +110,7 @@ void getStreamQualities(const QString &channelURL, p, static_cast(&QProcess::finished), [=](int res) { if (res != 0) { - qDebug() << "Got error code" << res; + log("Got error code {}", res); // return; } QString lastLine = QString(p->readAllStandardOutput()); @@ -121,7 +122,15 @@ void getStreamQualities(const QString &channelURL, for (int i = split.length() - 1; i >= 0; i--) { QString option = split.at(i); - if (option.endsWith(" (worst)")) { + if (option == "best)") { + // As it turns out, sometimes, one quality option can + // be the best and worst quality at the same time. + // Since we start loop from the end, we can check + // that and act accordingly + option = split.at(--i); + // "900p60 (worst" + options << option.left(option.length() - 7); + } else if (option.endsWith(" (worst)")) { options << option.left(option.length() - 8); } else if (option.endsWith(" (best)")) { options << option.left(option.length() - 7);