void PluginTester::run() { stopFlag = false; failed = 0; emit workingStarted(); for (int n = 0; n < tests->count(); n++) { PluginTest *test = tests->at(n); // if ((onlyFailed && test->isTestOk()) || (onlySelected != -1 && n != onlySelected)) continue; // emit pluginTestRunning(test); // get video information emit workingProgress(n * 2, tests->count() * 2, QString("Getting <b>%1</b> video information... [1/2]").arg(test->getPluginTitle())); VideoInformationPlugin *plugin = new VideoInformationPlugin(NULL, pluginsDir + test->getPluginFile()); VideoDefinition vd = plugin->getVideoInformation(test->getUrl()); // try to download video emit workingProgress(n * 2 + 1, tests->count() * 2, QString("Testing <b>%1</b> video download... [2/2]").arg(test->getPluginTitle())); Http *http = new Http(); if (!vd.cookies.isEmpty()) http->addCookies(vd.cookies); if (!vd.headers.isEmpty()) http->addHeaderParameters(vd.headers); int contentLength = copyBetween(http->head(QUrl(vd.URL)), "Content-Length: ", "\n").toInt(); delete http; // update test info test->setCaption(vd.title); test->setFlvUrl(vd.URL); test->setSize(contentLength); // increase failed tests if (!test->isTestOk()) failed++; // destroy plugin delete plugin; // finished emit pluginTestFinished(test); // small pause, prevent 100% cpu if (stopFlag) n = tests->count(); else sleep(1); } emit workingFinished(tests->count() - failed, failed); }