Warning: session_start(): open(/var/lib/php/sessions/sess_hsv953hn5nugqr1k2oa4288ulc, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
!include once #1025225 // Shared IntegralImage
cmodule SegmentScreenshotStream > DynPrintLogAndEnabled {
ISegmenter segMainVideo, segThumbnails;
Rect mainVideo;
transient BufferedImage screenshot;
transient ReliableSingleThread rstAnalyzeScreen = dm_rst(this, r analyzeScreen);
visual
withCenteredButtons(super,
"Move mouse to main video", rThread moveMouseToMainVideo);
start-thread {
segMainVideo ifNull = mandatorySegmenterFromAGIBlue("Find main YT video #1");
segThumbnails ifNull = mandatorySegmenterFromAGIBlue("Find YT thumbnails #1");
dm_onScreenshot_q(ss -> {
if (!enabled) ret;
screenshot = (BufferedImage) get image(ss);
rstAnalyzeScreen.trigger();
});
}
void analyzeScreen {
BufferedImage img = screenshot;
if (img == null) ret;
dm_setFieldAndPrintIfChanged(mainVideo := first_warnIfMultiple(segMainVideo.get(img)));
if (mainVideo == null) ret with print("No main video found");
dm_setFieldAndPrintIfChanged(thumbnails := segThumbnails.get(img));
}
// API
void moveMouseToMainVideo enter {
if (mainVideo == null) ret with infoBox("No main video found");
dm_unblockAutomation();
dm_moveMouse(+mainVideo); // move to the middle
}
void clickOnRandomThumbnail enter {
Rect r = random(thumbnails);
if (r == null) infoBox("No thumbnails found");
else dm_moveMouseAndClick(+thumbnail);
}
}