void BackgroundJobs::SearchForVideosWithoutVideoThumbnailsJob::execute() { const DB::FileNameList images = DB::ImageDB::instance()->images(); for( const DB::FileName& image : images ) { const DB::ImageInfoPtr info = image.info(); if ( !info->isVideo() ) continue; // silently ignore videos not (currently) on disk: if ( ! info->fileName().exists() ) continue; const DB::FileName thumbnailName = BackgroundJobs::HandleVideoThumbnailRequestJob::frameName(info->fileName(),9); if ( thumbnailName.exists() ) continue; BackgroundJobs::ReadVideoLengthJob* readVideoLengthJob = new BackgroundJobs::ReadVideoLengthJob(info->fileName(), BackgroundTaskManager::BackgroundVideoPreviewRequest); for (int i=0; i<10; ++i) { ExtractOneThumbnailJob* extractJob = new ExtractOneThumbnailJob( info->fileName(), i, BackgroundTaskManager::BackgroundVideoPreviewRequest ); extractJob->addDependency(readVideoLengthJob); } BackgroundTaskManager::JobManager::instance()->addJob( readVideoLengthJob); } emit completed(); }
bool ImageInfo::imageOnDisk( const DB::FileName& fileName ) { return fileName.exists(); }