X-Git-Url: https://git.sur5r.net/?p=minitube;a=blobdiff_plain;f=src%2Fyt%2Finvidious%2Fivvideosource.cpp;fp=src%2Fyt%2Finvidious%2Fivvideosource.cpp;h=3057859bfdcfc1c8d6c97d1d670a6b5622c70e2e;hp=0000000000000000000000000000000000000000;hb=b4e0b70c51f05c19b9095a381cb73bfb79f128dd;hpb=b76332aa9817cd134abf7e7e89e62456c1116668 diff --git a/src/yt/invidious/ivvideosource.cpp b/src/yt/invidious/ivvideosource.cpp new file mode 100644 index 0000000..3057859 --- /dev/null +++ b/src/yt/invidious/ivvideosource.cpp @@ -0,0 +1,31 @@ +#include "ivvideosource.h" + +void IVVideoSource::loadVideos(int max, int startIndex) { + aborted = false; + retryCount = 0; + this->max = max; + this->startIndex = startIndex; + reallyLoadVideos(max, startIndex); +} + +void IVVideoSource::abort() { + aborted = true; + retryCount = 0; + max = 0; + startIndex = 0; +} + +void IVVideoSource::handleError(QString message) { + qDebug() << message; + if (retryCount < 4) { + qDebug() << "Retrying..."; + Invidious::instance().shuffleServers(); + reallyLoadVideos(max, startIndex); + retryCount++; + } else { + retryCount = 0; + Invidious::instance().initServers(); + qWarning() << message; + emit error("Error loading videos"); + } +}