/** \fn PreviewGenerator::RunReal(void) * \brief This call creates a preview without starting a new thread. */ bool PreviewGenerator::RunReal(void) { bool ok = false; bool is_local = IsLocal(); if (is_local && LocalPreviewRun()) { ok = true; } else if (!localOnly) { if (is_local) { VERBOSE(VB_IMPORTANT, LOC_WARN + "Failed to save preview." "\n\t\t\tYou may need to check user and group ownership on" "\n\t\t\tyour frontend and backend for quicker previews.\n" "\n\t\t\tAttempting to regenerate preview on backend.\n"); } ok = RemotePreviewRun(); } else { VERBOSE(VB_IMPORTANT, LOC_ERR + QString("Run() file not local: '%1'") .arg(pathname)); } return ok; }
/** \fn PreviewGenerator::RunReal(void) * \brief This call creates a preview without starting a new thread. */ bool PreviewGenerator::RunReal(void) { QString msg; QTime tm = QTime::currentTime(); bool ok = false; bool is_local = IsLocal(); if (!is_local && !!(mode & kRemote)) { LOG(VB_GENERAL, LOG_ERR, LOC + QString("Run() file not local: '%1'") .arg(pathname)); } else if (!(mode & kLocal) && !(mode & kRemote)) { LOG(VB_GENERAL, LOG_ERR, LOC + QString("Run() Preview of '%1' failed " "because mode was invalid 0x%2") .arg(pathname).arg((int)mode,0,16)); } else if (is_local && !!(mode & kLocal) && LocalPreviewRun()) { ok = true; msg = QString("Generated on %1 in %2 seconds, starting at %3") .arg(gCoreContext->GetHostName()) .arg(tm.elapsed()*0.001) .arg(tm.toString(Qt::ISODate)); } else if (!!(mode & kRemote)) { if (is_local && (mode & kLocal)) { LOG(VB_GENERAL, LOG_WARNING, LOC + "Failed to save preview." "\n\t\t\tYou may need to check user and group ownership on" "\n\t\t\tyour frontend and backend for quicker previews.\n" "\n\t\t\tAttempting to regenerate preview on backend.\n"); } ok = RemotePreviewRun(); if (ok) { msg = QString("Generated remotely in %1 seconds, starting at %2") .arg(tm.elapsed()*0.001) .arg(tm.toString(Qt::ISODate)); } else { msg = "Remote preview failed"; } } else { msg = "Could not access recording"; } QMutexLocker locker(&previewLock); if (listener) { QString output_fn = outFileName.isEmpty() ? (programInfo.GetPathname()+".png") : outFileName; QDateTime dt; if (ok) { QFileInfo fi(output_fn); if (fi.exists()) dt = fi.lastModified(); } QString message = (ok) ? "PREVIEW_SUCCESS" : "PREVIEW_FAILED"; QStringList list; list.push_back(programInfo.MakeUniqueKey()); list.push_back(output_fn); list.push_back(msg); list.push_back(dt.isValid()?dt.toString(Qt::ISODate):""); list.push_back(token); QCoreApplication::postEvent(listener, new MythEvent(message, list)); } return ok; }