Warning: session_start(): open(/var/lib/php/sessions/sess_ej24qg2grt43i8d6nvjqo3p942, 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
import java.util.*;
import java.util.zip.*;
import java.util.List;
import java.util.regex.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
import java.util.concurrent.locks.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.table.*;
import java.io.*;
import java.net.*;
import java.lang.reflect.*;
import java.lang.ref.*;
import java.lang.management.*;
import java.security.*;
import java.security.spec.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import javax.imageio.*;
import java.math.*;
import static iiPkg.ii.IntegralImage;
import x30_pkg.x30_util;
import static x30_pkg.x30_util.VF1;
import static x30_pkg.x30_util.l;
import static x30_pkg.x30_util.fail;
import static x30_pkg.x30_util.indexOf;
import static x30_pkg.x30_util.getOpt;
import static x30_pkg.x30_util.setOpt;
import static x30_pkg.x30_util.callOpt;
import static x30_pkg.x30_util.newWeakHashMap;
import static x30_pkg.x30_util.newDangerousWeakHashMap;
import static x30_pkg.x30_util.get;
import static x30_pkg.x30_util.get_raw;
import static x30_pkg.x30_util.assertTrue;
import static x30_pkg.x30_util.isHeadless;
import static x30_pkg.x30_util.isAndroid;
import static x30_pkg.x30_util.isTrue;
import static x30_pkg.x30_util.asList;
import x30_pkg.x30_util.DynamicObject;
import loadableUtils.utils;
import static loadableUtils.utils._threadInfo;
import static loadableUtils.utils._threadInheritInfo;
import static loadableUtils.utils._threadInfo_addMakerAndRetriever;
import static loadableUtils.utils.dm_currentModule;
import static loadableUtils.utils.dm_current_mandatory;
import static loadableUtils.utils.match;
import static loadableUtils.utils.getOpt_raw;
import static loadableUtils.utils.setOpt_raw;
import static loadableUtils.utils.getField;
import static loadableUtils.utils.fieldType;
import static loadableUtils.utils.format3;
import static loadableUtils.utils.vm_generalIdentityHashSet;
import static loadableUtils.utils.vm_generalHashMap;
import static loadableUtils.utils.vm_generalWeakSubMap;
import static loadableUtils.utils.bindToComponent;
import static loadableUtils.utils.struct;
import static loadableUtils.utils.structure;
import static loadableUtils.utils.loadPage;
import static loadableUtils.utils.loadPage_utf8;
import static loadableUtils.utils.loadPageSilentlyWithTimeout;
import static loadableUtils.utils.loadPageSilently;
import static loadableUtils.utils.loadSnippet;
import static loadableUtils.utils.loadSnippetQuietly;
import static loadableUtils.utils.sendToLocalBot;
import static loadableUtils.utils.componentPopupMenu;
import static loadableUtils.utils.componentPopupMenu_top;
import static loadableUtils.utils.componentPopupMenu_initForComponent;
import static loadableUtils.utils.componentPopupMenu_getEvent;
import static loadableUtils.utils.listPopupMenu;
import static loadableUtils.utils.tablePopupMenu;
import static loadableUtils.utils.rowSorter_setComparators;
import static loadableUtils.utils.sexyTableWithoutDrag;
import static loadableUtils.utils.dm_current_generic;
import static loadableUtils.utils.dm_current_mandatory_generic;
import static loadableUtils.utils.cset;
import static loadableUtils.utils.DynamicObject_loading;
import static loadableUtils.utils.concepts_unlisted;
import static loadableUtils.utils.makePopupMenuConditional;
import static loadableUtils.utils.makeConceptsTable_idWidth;
import static loadableUtils.utils.showConceptsTable_afterUpdate;
import static loadableUtils.utils.dynamicObjectIsLoading;
import loadableUtils.utils.F0;
import loadableUtils.utils.F1;
import loadableUtils.utils.IF1;
import loadableUtils.utils.Matches;
import loadableUtils.utils.BetterLabel;
import loadableUtils.utils.SingleComponentPanel;
import loadableUtils.utils.Snippet;
import loadableUtils.utils.Q;
import loadableUtils.utils.ImageSurface;
import loadableUtils.utils.structure_Data;
import loadableUtils.utils.RGBImage;
import loadableUtils.utils.RGB;
import loadableUtils.utils.BWImage;
import loadableUtils.utils.MakesBufferedImage;
import loadableUtils.utils.MultiSet;
import loadableUtils.utils.Concept;
import loadableUtils.utils.Concepts;
import loadableUtils.utils.IConceptIndex;
import loadableUtils.utils.IFieldIndex;
import loadableUtils.utils.Derefable;
import loadableUtils.utils.ImageSurfaceSelector;
import loadableUtils.utils.SimpleCRUD;
import loadableUtils.utils.PersistableThrowable;
import loadableUtils.utils.DynModule;
import loadableUtils.utils.DynPrintLog;
import loadableUtils.utils.DynObjectTable;
import loadableUtils.utils.DynImageSurface;
import loadableUtils.utils.DynCalculatedList;
import loadableUtils.utils.Rect;
import loadableUtils.utils.Pt;
import javax.swing.undo.UndoManager;
import java.text.NumberFormat;
import java.awt.datatransfer.StringSelection;
import java.awt.geom.*;
import org.jnativehook.GlobalScreen;
import org.jnativehook.keyboard.NativeKeyEvent;
import org.jnativehook.keyboard.NativeKeyAdapter;
class main {
public static class SegmentScreenshotStream extends DynPrintLogAndEnabled {
public IF1> segMainVideo, segThumbnails, segSearchBar, segVideoControls;
public Rect mainVideo, searchBar;
public List thumbnails, videoControls;
public String searchQuery;
public transient BufferedImage screenshot;
public transient ReliableSingleThread rstAnalyzeScreen = dm_rst(this, new Runnable() {
public void run() {
try {
analyzeScreen();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "analyzeScreen();";
}
});
public JComponent visualize() {
return centerAndSouthWithMargin(withCenteredButtons(super.visualize(), "Play/Pause", runnableThread(new Runnable() {
public void run() {
try {
playOrPause();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "playOrPause();";
}
}), jPopDownButton_noText("Move mouse to main video", runnableThread(new Runnable() {
public void run() {
try {
moveMouseToMainVideo();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "moveMouseToMainVideo();";
}
}), "Click on a thumbnail", runnableThread(new Runnable() {
public void run() {
try {
clickOnRandomThumbnail();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "clickOnRandomThumbnail();";
}
}), "Click in search bar", runnableThread(new Runnable() {
public void run() {
try {
clickInSearchBar();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "clickInSearchBar();";
}
}))), withMargin(dm_textFieldAndButton("searchQuery", "youTubeSearch", "Search")));
}
public void start() {
super.start();
startThread("Start", new Runnable() {
public void run() {
try {
AutoCloseable __8 = enter();
try {
dm_watchField("enabled", new Runnable() {
public void run() {
try {
if (enabled)
dm_enableStreamOfScreenshots();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "if (enabled) dm_enableStreamOfScreenshots()";
}
});
if (segMainVideo == null)
segMainVideo = mandatorySegmenterFromAGIBlue("Find main YT video #1");
if (segThumbnails == null)
segThumbnails = mandatorySegmenterFromAGIBlue("Find YT thumbnails #1");
if (segSearchBar == null)
segSearchBar = mandatorySegmenterFromAGIBlue("Find YT search bar #1");
if (segVideoControls == null)
segVideoControls = mandatorySegmenterFromAGIBlue("YT video controls #1");
dm_onScreenshot_q(ss -> {
if (!enabled)
return;
screenshot = (BufferedImage) get("image", ss);
rstAnalyzeScreen.trigger();
});
} finally {
_close(__8);
}
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "AutoCloseable __8 = enter(); try { \r\n dm_watchField enabled(new Runnable()...";
}
});
}
public void analyzeScreen() {
BufferedImage img = screenshot;
if (img == null)
return;
dm_setFieldAndPrintIfChanged("mainVideo", first_warnIfMultiple(segMainVideo.get(img)));
if (mainVideo == null) {
print("No main video found");
return;
}
dm_setFieldAndPrintIfChanged("thumbnails", segThumbnails.get(img));
dm_setFieldAndPrintIfChanged("searchBar", first_warnIfMultiple(segSearchBar.get(img)));
dm_setFieldAndPrintIfChanged("videoControls", sortRectsByMiddleX(segVideoControls.get(img)));
}
public void moveMouseToMainVideo() {
AutoCloseable __9 = enter();
try {
if (mainVideo == null) {
infoBox("No main video found");
return;
}
dm_unblockAutomation();
dm_moveMouse("mainVideo", mainVideo);
} finally {
_close(__9);
}
}
public void clickOnRandomThumbnail() {
AutoCloseable __10 = enter();
try {
Rect thumbnail = random(thumbnails);
if (thumbnail == null) {
infoBox("No thumbnails found");
return;
}
dm_unblockAutomation();
dm_moveMouseAndClick("thumbnail", thumbnail);
} finally {
_close(__10);
}
}
public void clickInSearchBar() {
AutoCloseable __11 = enter();
try {
dm_unblockAutomation();
dm_moveMouseAndClick("searchBar", searchBar);
} finally {
_close(__11);
}
}
public void youTubeSearch(String query) {
AutoCloseable __12 = enter();
try {
clickInSearchBar();
if (dm_hasAutomationInterference()) {
print("interference");
return;
}
automate_ctrlA();
automate_typeString(query);
automate_enter();
} finally {
_close(__12);
}
}
public void youTubeSearch() {
AutoCloseable __13 = enter();
try {
youTubeSearch(searchQuery);
} finally {
_close(__13);
}
}
public void playOrPause() {
AutoCloseable __14 = enter();
try {
dm_unblockAutomation();
int safety = 0;
while (l(videoControls) < 5 && safety++ < 5) {
moveMouseToMainVideo();
sleepSeconds(1);
}
dm_moveMouseAndClick("Play/pause button", first(videoControls));
} finally {
_close(__14);
}
}
}
public static boolean _moduleClass_SegmentScreenshotStream = false;
public static Object callF(Object f, Object... args) {
try {
if (f instanceof String)
return callMC((String) f, args);
return x30_util.callF(f, args);
} catch (Exception __e) {
throw rethrow(__e);
}
}
public static A callF(F0 f) {
return f == null ? null : f.get();
}
public static A callF(IF0 f) {
return f == null ? null : f.get();
}
public static B callF(F1 f, A a) {
return f == null ? null : f.get(a);
}
public static B callF(IF1 f, A a) {
return f == null ? null : f.get(a);
}
public static void callF(VF1 f, A a) {
if (f != null)
f.get(a);
}
public static Object callMC(String method, Object... args) {
return call(mc(), method, args);
}
public static Object call(Object o) {
return callF(o);
}
public static Object call(Object o, String method, Object... args) {
return call_withVarargs(o, method, args);
}
public static void _onLoad_initUtils() {
utils.__javax = javax();
}
public static void _onLoad_defaultClassFinder() {
setDefaultClassFinder(new F1() {
public Class get(String name) {
try {
Class c = findClass_fullName(name);
if (c != null)
return c;
if (startsWith(name, "main$"))
return loadableUtils.utils.findClass_fullName("loadableUtils.utils" + substring(name, 4));
return null;
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "Class c = findClass_fullName(name);\r\n if (c != null) ret c;\r\n if (start...";
}
});
}
public static String programID() {
return getProgramID();
}
public static String programID(Object o) {
return getProgramID(o);
}
public static volatile StringBuffer local_log = new StringBuffer();
public static volatile Appendable print_log = local_log;
public static volatile int print_log_max = 1024 * 1024;
public static volatile int local_log_max = 100 * 1024;
public static boolean print_silent = false;
public static Object print_byThread_lock = new Object();
public static volatile ThreadLocal