Added checks for CGF search
This commit is contained in:
parent
b746f52f67
commit
367cbd659e
|
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue