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 javax.imageio.metadata.*;
import javax.imageio.stream.*;
import javax.net.ssl.*;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import javax.swing.undo.UndoManager;
import java.text.NumberFormat;
import java.awt.datatransfer.StringSelection;
import java.awt.geom.*;
import java.text.SimpleDateFormat;
class main {
public static void main(final String[] args) throws Exception {
showAnimationInTopRightCorner_on = false;
final Q q = startQ();
for (File dir : ll(userDesktopDir(), userDesktopDir("Screenshots"),
userDesktopDir("screenshots")))
for (final File f : listFilesWithExtension(dir, ".png"))
if (swic(f.getName(), "Screenshot_")) q.add(new Runnable() { public void run() { try {
jpegify(f);
print("Queue length: " + l(q));
} catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "jpegify(f);\r\n print(\"Queue length: \" + l(q));"; }});
}
static Q startQ() {
return new Q();
}
static Q startQ(String name) {
return new Q(name);
}
static List ll(A... a) {
ArrayList l = new ArrayList(a.length);
if (a != null) for (A x : a) l.add(x);
return l;
}
static File userDesktopDir() {
File f = toFileOpt(loadTextFile(userDesktopDirPointerFile()));
if (f != null) return f;
final Var v = new Var();
selectDir("Please select your desktop directory", userDir("Desktop"), new VF1() { public void get(File f) { try { v.set(f); } catch (Exception __e) { throw rethrow(__e); } }
public String toString() { return "v.set(f);"; }});
waitForVarToBeNotNull(v);
saveTextFile(userDesktopDirPointerFile(), f2s(v.get()));
return v.get();
}
static File userDesktopDir(String sub) {
return newFile(userDesktopDir(), sub);
}
static List listFilesWithExtension(File dir, String ext) {
return listFilesWithSuffix(dir, addPrefixOptIfNempty(".", ext));
}
static List listFilesWithExtension(String ext, File dir) {
return listFilesWithExtension(dir, ext);
}
static boolean swic(String a, String b) {
return startsWithIgnoreCase(a, b);
}
static boolean swic(String a, String b, Matches m) {
if (!swic(a, b)) return false;
m.m = new String[] {substring(a, l(b))};
return true;
}
static File jpegify(File imageFile) {
if (isJPEGFile(imageFile)) return imageFile;
{ AutoCloseable __1 = tempShowLoadingAnimation("JPEGify"); try {
BufferedImage img = loadImage2(imageFile);
File destFile = replaceExtension(imageFile, ".jpg");
File atticFile = newFile(javaxDataDir("JPEGified original pictures"), imageFile.getName());
atticFile = makeFileNameUnique(atticFile);
saveJPGVerbose(destFile, img);
moveFileVerbose(imageFile, atticFile);
print("Conversion done.");
return destFile;
} finally { _close(__1); }}
}
static volatile StringBuffer local_log = new StringBuffer(); // not redirected
static volatile Appendable print_log = local_log; // might be redirected, e.g. to main bot
// in bytes - will cut to half that
static volatile int print_log_max = 1024*1024;
static volatile int local_log_max = 100*1024;
static boolean print_silent = false; // total mute if set
static Object print_byThread_lock = new Object();
static volatile ThreadLocal