Added checks for CGF search
This commit is contained in:
parent
2e668844cd
commit
42e1d12e0a
|
@ -1,5 +1,6 @@
|
||||||
package ctbrec.ui.menu;
|
package ctbrec.ui.menu;
|
||||||
|
|
||||||
|
import ctbrec.AbstractModel;
|
||||||
import ctbrec.Config;
|
import ctbrec.Config;
|
||||||
import ctbrec.Model;
|
import ctbrec.Model;
|
||||||
import ctbrec.ModelGroup;
|
import ctbrec.ModelGroup;
|
||||||
|
@ -21,7 +22,9 @@ import javafx.scene.input.Clipboard;
|
||||||
import javafx.scene.input.ClipboardContent;
|
import javafx.scene.input.ClipboardContent;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
@ -167,13 +170,22 @@ public class ModelMenuContributor {
|
||||||
var openOnCamGirlFinder = new MenuItem("CamGirlFinder");
|
var openOnCamGirlFinder = new MenuItem("CamGirlFinder");
|
||||||
openOnCamGirlFinder.setOnAction(e -> {
|
openOnCamGirlFinder.setOnAction(e -> {
|
||||||
for (Model model : selectedModels) {
|
for (Model model : selectedModels) {
|
||||||
String preview = model.getPreview();
|
try {
|
||||||
if (preview != null && !preview.isEmpty()) {
|
String query;
|
||||||
String query = URLEncoder.encode(preview, UTF_8);
|
String preview = model.getPreview();
|
||||||
DesktopIntegration.open("https://camgirlfinder.net/search?url=" + query);
|
if (preview != null && !preview.isEmpty() && model.isOnline(true) && !preview.toLowerCase().contains("dreamcam")) {
|
||||||
} else {
|
query = URLEncoder.encode(preview, UTF_8);
|
||||||
String query = URLEncoder.encode(model.getName(), UTF_8);
|
DesktopIntegration.open("https://camgirlfinder.net/search?url=" + query);
|
||||||
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