MCPcopy Create free account
hub / github.com/QNapi/qnapi / run

Method run

gui/src/forms/frmprogress.cpp:257–423  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

255 }
256
257void GetThread::run() {
258 abort = false;
259 criticalMessage.clear();
260 if (queue.size() <= 0) return;
261
262 napiSuccess = napiFail = 0;
263 subStatusList.clear();
264
265 QNapi napi(config, specificEngine);
266
267 emit progressChange(0, queue.size(), 0.0f);
268
269 QString language = !lang.isEmpty() ? lang : config.generalConfig().language();
270 QString languageBackup =
271 langBackupPassed ? langBackup : config.generalConfig().backupLanguage();
272
273 for (int i = 0; i < queue.size(); i++) {
274 ABORT_POINT
275
276 QFileInfo fi(queue[i]);
277 emit fileNameChange(fi.fileName());
278
279 napi.setMoviePath(queue[i]);
280
281 emit progressChange(i, queue.size(), 0.1f);
282 emit actionChange(tr("Checking permissions of the video directory..."));
283
284 if (!napi.checkWritePermissions()) {
285 emit criticalError(tr("No permission to write to the directory '%1'!")
286 .arg(QFileInfo(queue[i]).path()));
287 return;
288 }
289
290 napi.clearSubtitlesList();
291
292 emit progressChange(i, queue.size(), 0.3f);
293 emit actionChange(tr("Calculating checksum of the file..."));
294
295 napi.checksum();
296
297 ABORT_POINT
298
299 bool found = false;
300 SearchPolicy sp = config.generalConfig().searchPolicy();
301
302 if (sp == SP_SEARCH_ALL_WITH_BACKUP_LANG) {
303 foreach (QString e, napi.listLoadedEngines()) {
304 emit progressChange(i, queue.size(), 0.4f);
305 emit actionChange(
306 tr("Searching for subtitles [%1] (%2)...").arg(language, e));
307 found = napi.lookForSubtitles(language, e) || found;
308
309 ABORT_POINT
310
311 emit actionChange(
312 tr("Searching for subtitles in alternative language [%1] (%2)...")
313 .arg(languageBackup, e));
314 found = napi.lookForSubtitles(languageBackup, e) || found;

Callers

nothing calls this directly

Calls 15

languageMethod · 0.80
generalConfigMethod · 0.80
backupLanguageMethod · 0.80
checkWritePermissionsMethod · 0.80
searchPolicyMethod · 0.80
needToShowListMethod · 0.80
bestIdxMethod · 0.80
ppEnabledMethod · 0.80
postProcessSubtitlesMethod · 0.80
setMoviePathMethod · 0.45
clearSubtitlesListMethod · 0.45
checksumMethod · 0.45

Tested by

no test coverage detected