Added checks for CGF search

This commit is contained in:
Jafea7 2025-09-27 16:04:15 +10:00
parent b746f52f67
commit 367cbd659e
1 changed files with 19 additions and 7 deletions

View File

@ -2,6 +2,7 @@ package ctbrec.ui.menu;
import lombok.extern.slf4j.Slf4j;
import ctbrec.AbstractModel;
import ctbrec.Config;
import ctbrec.Model;
import ctbrec.ModelGroup;
@ -21,7 +22,9 @@ import javafx.scene.control.SeparatorMenuItem;
import javafx.scene.control.TabPane;
import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.concurrent.ExecutionException;
import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;
@ -162,13 +165,22 @@ public class ModelMenuContributor {
var openOnCamGirlFinder = new MenuItem("CamGirlFinder");
openOnCamGirlFinder.setOnAction(e -> {
for (Model model : selectedModels) {
try {
String query;
String preview = model.getPreview();
if (preview != null && !preview.isEmpty()) {
String query = URLEncoder.encode(preview, UTF_8);
if (preview != null && !preview.isEmpty() && model.isOnline(true) && !preview.toLowerCase().contains("dreamcam")) {
query = URLEncoder.encode(preview, UTF_8);
DesktopIntegration.open("https://camgirlfinder.net/search?url=" + query);
} else {
String query = URLEncoder.encode(model.getName(), UTF_8);
DesktopIntegration.open("https://camgirlfinder.net/models?m=" + query + "&p=a&g=a");
continue;
}
query = URLEncoder.encode(model.getName(), UTF_8);
DesktopIntegration.open("https://camgirlfinder.net/models?model=" + query + "&platform=&gender=");
} catch (IOException | ExecutionException | InterruptedException ex) {
// Handle the exception (e.g., log it or show an error dialog)
Dialogs.showError(menu.getParentPopup().getScene(),
"Error encoding URL",
"Failed to encode the model name or preview URL: " + ex.getMessage(),
null);
}
}
});