void VideoConverter::parseOutput(QString output) { if (videoLength == 0) { outputAll += output; if (outputAll.indexOf("Duration: ") > -1) { setVideoDuration(copyBetween(outputAll, "Duration: ", ", start")); // we have the durtion? if yes, then capture the first step if (videoLength != 0) getCurrentTimeConversion(copyBetween(outputAll, "time=", " bitrate")); } } else // get the current frame getCurrentTimeConversion(copyBetween(output, "time=", " bitrate")); }
void NewLanguagesController::updateNewLanguages() { emit beforeUpdateNewLanguages(); // remove prev. new languages clearAllNewLanguages(); // fill with new languages parseBlock(copyBetween(newLanguagesFile, "#COMMON{", "}")); }
void NewLanguagesController::parseBlock(QString block) { if (!block.isEmpty()) { int n = 0; QString fileBlock = ""; // get file blocks do { // get current update file fileBlock = copyBetween(block, QString("#FILE:%1").arg(n), QString("#END:%1").arg(n)); // have something to analayze? if (!fileBlock.isEmpty()) { Update *update = new Update; // assign info update->setCaption(copyBetween(fileBlock, "caption=\"", "\"")); update->setVersion(copyBetween(fileBlock, "version=\"", "\"")); update->setSize(copyBetween(fileBlock, "size=\"", "\"").toInt()); update->setInstallTo(copyBetween(fileBlock, "installTo=\"", "\"")); update->setUrl(copyBetween(fileBlock, "url=\"", "\"")); update->setPacked(copyBetween(fileBlock, "packed=\"", "\"").toLower() == "true"); update->setObligatory(copyBetween(fileBlock, "obligatory=\"", "\"").toLower() == "true"); update->setChecked(true); // if this language is not installed, add it into the list if (!languageManager->isLanguageInstalled(update->getCaption())) { newLanguages->append(update); emit toInstallLanguageAdded(update); } else // destroy it delete update; } // next update file n++; // continue? } while (!fileBlock.isEmpty()); } }
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); }