Misc commenting unused

This commit is contained in:
jafea7 2025-04-08 22:40:44 +10:00
parent ba8209a587
commit 6718dd394c
17 changed files with 147 additions and 147 deletions

View File

@ -3,7 +3,7 @@ package ctbrec.ui.settings;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.time.LocalTime;
import java.util.Arrays;
// import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
@ -362,18 +362,18 @@ public class CtbrecPreferencesStorage implements PreferencesStorage {
return false;
}
private boolean setUnchecked(String key, Object n) throws IllegalAccessException, NoSuchFieldException, InvocationTargetException {
var field = BoundField.of(settings, key);
var o = field.get();
if (n instanceof List && o instanceof List) {
var list = (List<String>)o;
list.clear();
list.addAll((List<String>)n);
} else {
field.set(n); // NOSONAR
}
return true;
}
// private boolean setUnchecked(String key, Object n) throws IllegalAccessException, NoSuchFieldException, InvocationTargetException {
// var field = BoundField.of(settings, key);
// var o = field.get();
// if (n instanceof List && o instanceof List) {
// var list = (List<String>)o;
// list.clear();
// list.addAll((List<String>)n);
// } else {
// field.set(n); // NOSONAR
// }
// return true;
// }
private void saveValue(Exec exe) {
try {

View File

@ -1,7 +1,7 @@
package ctbrec.ui.settings.api;
import javafx.beans.binding.Bindings;
import javafx.beans.property.SimpleListProperty;
// import javafx.beans.binding.Bindings;
// import javafx.beans.property.SimpleListProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;

View File

@ -22,7 +22,7 @@ import org.slf4j.LoggerFactory;
public class DreamcamUpdateService extends PaginatedScheduledService {
private static final Logger LOG = LoggerFactory.getLogger(DreamcamUpdateService.class);
private static final String API_URL = "https://api.dreamcam.co.kr/v1/live";
// private static final String API_URL = "https://api.dreamcam.co.kr/v1/live";
private static final int modelsPerPage = 64;
private Dreamcam site;
private String url;

View File

@ -12,7 +12,7 @@ import javafx.scene.layout.BorderPane;
import javafx.scene.layout.VBox;
import lombok.extern.slf4j.Slf4j;
import java.awt.Desktop;
// import java.awt.Desktop;
import java.io.File;
import java.io.IOException;

View File

@ -42,7 +42,7 @@ import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Polygon;
// import javafx.scene.shape.Polygon;
import javafx.scene.shape.Rectangle;
import javafx.scene.shape.Shape;
import javafx.scene.text.Text;
@ -97,7 +97,7 @@ public class ThumbCell extends StackPane {
private final Recorder recorder;
private final RecordingIndicator recordingIndicator;
private final Tooltip recordingIndicatorTooltip;
private StackPane previewTrigger;
// private StackPane previewTrigger;
private final StackPane groupIndicator;
private final Label groupIndicatorTooltipTrigger;
private int index = 0;
@ -116,7 +116,7 @@ public class ThumbCell extends StackPane {
.maximumSize(10000)
.build(CacheLoader.from(ThumbCell::getStreamResolution));
private final ThumbOverviewTab parent;
private CompletableFuture<Boolean> startPreview;
// private CompletableFuture<Boolean> startPreview;
public ThumbCell(ThumbOverviewTab parent, Model model, Recorder recorder, double aspectRatio) {
this.parent = parent;
@ -268,73 +268,73 @@ public class ThumbCell extends StackPane {
.thenAccept(r -> update());
}
private Node createPreviewTrigger() {
var s = 24;
previewTrigger = new StackPane();
previewTrigger.setStyle("-fx-background-color: white;");
previewTrigger.setOpacity(.8);
previewTrigger.setMaxSize(s, s);
// private Node createPreviewTrigger() {
// var s = 24;
// previewTrigger = new StackPane();
// previewTrigger.setStyle("-fx-background-color: white;");
// previewTrigger.setOpacity(.8);
// previewTrigger.setMaxSize(s, s);
var play = new Polygon(16, 8, 26, 15, 16, 22);
StackPane.setMargin(play, new Insets(0, 0, 0, 3));
play.setStyle("-fx-background-color: black;");
previewTrigger.getChildren().add(play);
// var play = new Polygon(16, 8, 26, 15, 16, 22);
// StackPane.setMargin(play, new Insets(0, 0, 0, 3));
// play.setStyle("-fx-background-color: black;");
// previewTrigger.getChildren().add(play);
var clip = new Circle(s / 2.0);
clip.setTranslateX(clip.getRadius());
clip.setTranslateY(clip.getRadius());
previewTrigger.setClip(clip);
StackPane.setAlignment(previewTrigger, Pos.BOTTOM_LEFT);
StackPane.setMargin(previewTrigger, new Insets(0, 0, 24, 4));
previewTrigger.setOnMouseEntered(evt -> startPreview());
previewTrigger.setOnMouseExited(evt -> stopPreview());
return previewTrigger;
}
// var clip = new Circle(s / 2.0);
// clip.setTranslateX(clip.getRadius());
// clip.setTranslateY(clip.getRadius());
// previewTrigger.setClip(clip);
// StackPane.setAlignment(previewTrigger, Pos.BOTTOM_LEFT);
// StackPane.setMargin(previewTrigger, new Insets(0, 0, 24, 4));
// previewTrigger.setOnMouseEntered(evt -> startPreview());
// previewTrigger.setOnMouseExited(evt -> stopPreview());
// return previewTrigger;
// }
private void stopPreview() {
if (startPreview != null) {
startPreview.cancel(true);
}
setPreviewVisible(previewTrigger, false);
}
// private void stopPreview() {
// if (startPreview != null) {
// startPreview.cancel(true);
// }
// setPreviewVisible(previewTrigger, false);
// }
private void startPreview() {
previewTrigger.setCursor(Cursor.HAND);
startPreview = CompletableFuture.supplyAsync(() -> {
try {
Thread.sleep(500);
return true;
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return false;
}
}, GlobalThreadPool.get()).whenComplete((result, exception) -> {
startPreview = null;
if (Boolean.TRUE.equals(result)) {
setPreviewVisible(previewTrigger, true);
}
});
}
// private void startPreview() {
// previewTrigger.setCursor(Cursor.HAND);
// startPreview = CompletableFuture.supplyAsync(() -> {
// try {
// Thread.sleep(500);
// return true;
// } catch (InterruptedException e) {
// Thread.currentThread().interrupt();
// return false;
// }
// }, GlobalThreadPool.get()).whenComplete((result, exception) -> {
// startPreview = null;
// if (Boolean.TRUE.equals(result)) {
// setPreviewVisible(previewTrigger, true);
// }
// });
// }
private void setPreviewVisible(Node previewTrigger, boolean visible) {
parent.suspendUpdates(visible);
iv.setVisible(!visible);
topic.setVisible(!visible);
topicBackground.setVisible(!visible);
name.setVisible(!visible);
nameBackground.setVisible(!visible);
streamPreview.setVisible(visible);
if (visible) {
streamPreview.startStream(model);
} else {
streamPreview.stop();
}
recordingIndicator.setVisible(!visible);
if (!visible) {
updateRecordingIndicator();
}
previewTrigger.setCursor(visible ? Cursor.HAND : Cursor.DEFAULT);
}
// private void setPreviewVisible(Node previewTrigger, boolean visible) {
// parent.suspendUpdates(visible);
// iv.setVisible(!visible);
// topic.setVisible(!visible);
// topicBackground.setVisible(!visible);
// name.setVisible(!visible);
// nameBackground.setVisible(!visible);
// streamPreview.setVisible(visible);
// if (visible) {
// streamPreview.startStream(model);
// } else {
// streamPreview.stop();
// }
// recordingIndicator.setVisible(!visible);
// if (!visible) {
// updateRecordingIndicator();
// }
// previewTrigger.setCursor(visible ? Cursor.HAND : Cursor.DEFAULT);
// }
public void setSelected(boolean selected) {
selectionProperty.set(selected);

View File

@ -33,7 +33,7 @@ import ctbrec.ui.tabs.TabSelectionListener;
import ctbrec.ui.tabs.recorded.ModelImportExport.ExportOptions;
import javafx.application.Platform;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
// import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringPropertyBase;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;

View File

@ -12,7 +12,7 @@ import javafx.event.ActionEvent;
import java.util.List;
import java.util.Objects;
import java.util.function.Predicate;
import java.util.stream.Collectors;
// import java.util.stream.Collectors;
public class RecordedModelsPerSiteTab extends RecordedModelsTab implements TabSelectionListener {

View File

@ -1,27 +1,27 @@
package ctbrec.io;
import ctbrec.io.FlaresolverrResponse;
import ctbrec.io.FlaresolverrSolutionResponse;
// import ctbrec.io.FlaresolverrResponse;
// import ctbrec.io.FlaresolverrSolutionResponse;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import lombok.Getter;
import lombok.Setter;
import okhttp3.Call;
import okhttp3.Callback;
// import lombok.Setter;
// import okhttp3.Call;
// import okhttp3.Callback;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
// import okhttp3.Response;
import okhttp3.ResponseBody;
import okhttp3.Cookie;
// import okhttp3.Cookie;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
// import java.util.ArrayList;
// import java.util.List;
import java.util.concurrent.*;

View File

@ -3,7 +3,7 @@ package ctbrec.io;
import com.fasterxml.jackson.databind.JsonNode;
import lombok.Getter;
import lombok.ToString;
// import lombok.ToString;
public class FlaresolverrResponse {
@Getter

View File

@ -2,7 +2,7 @@ package ctbrec.io;
import com.fasterxml.jackson.databind.JsonNode;
import ctbrec.StringUtil;
// import ctbrec.StringUtil;
import lombok.Getter;
import okhttp3.Cookie;

View File

@ -8,7 +8,7 @@ import ctbrec.recorder.download.RecordingProcess;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.Comparators;
// import com.google.common.collect.Comparators;
import java.io.IOException;
import java.security.InvalidKeyException;
@ -173,23 +173,23 @@ public class RecordingPreconditions {
return concurrentRecordings == 0 || concurrentRecordings > 0 && recorder.getRecordingProcesses().size() < concurrentRecordings;
}
private void ensureAllModelsFromGroupAreOnlineChecked(Model model) throws IOException, ExecutionException {
Optional<ModelGroup> modelGroup = recorder.getModelGroup(model);
if (modelGroup.isEmpty()) {
return;
}
// private void ensureAllModelsFromGroupAreOnlineChecked(Model model) throws IOException, ExecutionException {
// Optional<ModelGroup> modelGroup = recorder.getModelGroup(model);
// if (modelGroup.isEmpty()) {
// return;
// }
for (String modelUrl : modelGroup.get().getModelUrls()) {
Optional<Model> otherModel = getModelForUrl(modelUrl);
if (otherModel.isPresent()) {
if (otherModel.get().getOnlineState(true) == Model.State.UNCHECKED) {
throw new PreconditionNotMetException(otherModel.get() + "'s online state has not been checked yet");
}
} else {
LOG.warn("Model for url {} was not found", modelUrl);
}
}
}
// for (String modelUrl : modelGroup.get().getModelUrls()) {
// Optional<Model> otherModel = getModelForUrl(modelUrl);
// if (otherModel.isPresent()) {
// if (otherModel.get().getOnlineState(true) == Model.State.UNCHECKED) {
// throw new PreconditionNotMetException(otherModel.get() + "'s online state has not been checked yet");
// }
// } else {
// LOG.warn("Model for url {} was not found", modelUrl);
// }
// }
// }
private void ensureNoOtherFromModelGroupIsRecording(Model model) throws InvalidKeyException, NoSuchAlgorithmException, IOException {
Optional<ModelGroup> modelGroup = recorder.getModelGroup(model);

View File

@ -31,15 +31,15 @@ import java.util.concurrent.*;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
import com.google.common.collect.Ordering;
// import com.google.common.collect.Ordering;
import static ctbrec.Recording.State.WAITING;
import static ctbrec.SubsequentAction.*;
import static ctbrec.event.Event.Type.MODEL_ONLINE;
import static java.lang.Thread.MAX_PRIORITY;
// import static java.lang.Thread.MAX_PRIORITY;
import static java.lang.Thread.MIN_PRIORITY;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.SECONDS;
// import static java.util.concurrent.TimeUnit.MILLISECONDS;
// import static java.util.concurrent.TimeUnit.SECONDS;
@Slf4j
public class SimplifiedLocalRecorder implements Recorder {

View File

@ -5,27 +5,27 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.lang.ProcessBuilder.Redirect;
// import java.lang.ProcessBuilder.Redirect;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
// import java.util.concurrent.Executors;
// import java.util.concurrent.ScheduledExecutorService;
// import java.util.concurrent.ThreadFactory;
import java.util.function.Consumer;
import org.json.JSONObject;
// import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
// import com.fasterxml.jackson.core.JsonParseException;
// import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import ctbrec.io.BandwidthMeter;
import ctbrec.io.DevNull;
import ctbrec.io.ProcessStreamRedirector;
// import ctbrec.io.ProcessStreamRedirector;
import ctbrec.io.json.ObjectMapperFactory;
import ctbrec.recorder.download.ProcessExitedUncleanException;
import lombok.Data;
@ -50,15 +50,15 @@ public class Hlsdl {
private Hlsdl() {}
private static ThreadFactory createThreadFactory(String name) {
return r -> {
Thread t = new Thread(r);
t.setName(name);
t.setDaemon(true);
t.setPriority(Thread.MIN_PRIORITY);
return t;
};
}
// private static ThreadFactory createThreadFactory(String name) {
// return r -> {
// Thread t = new Thread(r);
// t.setName(name);
// t.setDaemon(true);
// t.setPriority(Thread.MIN_PRIORITY);
// return t;
// };
// }
public void exec(String[] cmdline, String[] env, File executionDir) throws IOException {
LOG.debug("hlsdl command line: {}", Arrays.toString(cmdline));

View File

@ -12,7 +12,7 @@ import okhttp3.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.datatype.jsr310.deser.DurationDeserializer;
// import com.fasterxml.jackson.datatype.jsr310.deser.DurationDeserializer;
import javax.crypto.NoSuchPaddingException;
import java.io.*;

View File

@ -240,5 +240,5 @@ public class StripchatHttpClient extends HttpClient {
return false;
}
}
}

View File

@ -6,10 +6,10 @@ import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.time.LocalTime;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.*;
// import java.util.Arrays;
// import java.util.Collections;
// import java.util.Enumeration;
// import java.util.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;

View File

@ -1,22 +1,22 @@
package ctbrec.recorder.server;
import ctbrec.Config;
// import ctbrec.Config;
import ctbrec.io.HttpClient;
import ctbrec.recorder.Recorder;
import ctbrec.recorder.SimplifiedLocalRecorder;
import lombok.RequiredArgsConstructor;
// import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.json.JSONObject;
// import org.json.JSONObject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.io.StringWriter;
// import java.io.PrintWriter;
// import java.io.StringWriter;
import java.net.URLDecoder;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.text.MessageFormat;
// import java.text.MessageFormat;
import static java.nio.charset.StandardCharsets.UTF_8;
import static javax.servlet.http.HttpServletResponse.*;
@ -53,8 +53,8 @@ public class DebugServlet extends AbstractCtbrecServlet {
var stacks = Thread.getAllStackTraces();
var box = new Object() { String text = ""; };//stacks.toString();
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
// StringWriter sw = new StringWriter();
// PrintWriter pw = new PrintWriter(sw);
// e.printStackTrace(pw);
stacks.forEach((thread, stack) -> {