完善vip 解析 2023年2月17日16:45:39
parent
ae0f4779e3
commit
11e0676082
|
|
@ -1,21 +1,40 @@
|
|||
package com.zhangmeng.tools.controller;
|
||||
|
||||
import com.zhangmeng.tools.utils.AlertUtils;
|
||||
import com.zhangmeng.tools.utils.ResourcesUtils;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.web.WebEngine;
|
||||
import javafx.scene.web.WebView;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.WindowEvent;
|
||||
import javafx.util.StringConverter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author : 芊芊墨客
|
||||
* @version : 1.0
|
||||
* @date : 2023-02-16 09:19
|
||||
*/
|
||||
@Slf4j
|
||||
public class VipParserController {
|
||||
|
||||
@FXML
|
||||
private ComboBox<URLS> comboBox;
|
||||
|
||||
@FXML
|
||||
private TextField input_text;
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
|
||||
|
|
@ -26,7 +45,7 @@ public class VipParserController {
|
|||
comboBox.setConverter(new StringConverter<URLS>() {
|
||||
@Override
|
||||
public String toString(URLS object) {
|
||||
if (object == null){
|
||||
if (object == null) {
|
||||
return "";
|
||||
}
|
||||
return object.getName();
|
||||
|
|
@ -43,8 +62,43 @@ public class VipParserController {
|
|||
}
|
||||
|
||||
@FXML
|
||||
public void player(){
|
||||
public void player() {
|
||||
log.info("点击解析:{}", comboBox.getSelectionModel().getSelectedItem().name);
|
||||
|
||||
if (input_text.getText().length() == 0){
|
||||
AlertUtils.alert_warning("请输入解析地址!");
|
||||
return;
|
||||
}
|
||||
|
||||
String url = comboBox.getSelectionModel().getSelectedItem().url;
|
||||
String path = url + input_text.getText();
|
||||
|
||||
AnchorPane root = null;
|
||||
try {
|
||||
root = FXMLLoader.load(ResourcesUtils.getResource("vip-parser-player"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
WebView webView = (WebView) root.lookup("#webView");
|
||||
WebEngine engine = webView.getEngine();
|
||||
engine.load(path);
|
||||
|
||||
Stage stage = (Stage) this.comboBox.getScene().getWindow();
|
||||
stage.hide();
|
||||
|
||||
Scene scene = new Scene(root);
|
||||
Stage player_stage = new Stage();
|
||||
player_stage.setScene(scene);
|
||||
player_stage.setTitle("播放");
|
||||
player_stage.setWidth(1600);
|
||||
player_stage.setHeight(800);
|
||||
player_stage.setFullScreen(true);
|
||||
player_stage.setOnCloseRequest(windowEvent -> {
|
||||
log.info("播放关闭");
|
||||
stage.show();
|
||||
});
|
||||
player_stage.show();
|
||||
}
|
||||
|
||||
public enum URLS {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package com.zhangmeng.tools.controller;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.web.WebView;
|
||||
|
||||
/**
|
||||
* @author : 芊芊墨客
|
||||
* @version : 1.0
|
||||
* @date : 2023-02-17 16:29
|
||||
*/
|
||||
public class VipParserPlayerController {
|
||||
|
||||
@FXML
|
||||
private WebView webView;
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.web.WebView?>
|
||||
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="649.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zhangmeng.tools.controller.VipParserPlayerController">
|
||||
<children>
|
||||
<WebView id="webView" fx:id="webView" layoutX="1.0" layoutY="76.0" prefHeight="200.0" prefWidth="1133.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
<AnchorPane fx:controller="com.zhangmeng.tools.controller.VipParserController" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="649.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<Label layoutX="165.0" layoutY="273.0" text="将要解析的视频地址" AnchorPane.leftAnchor="165.0" />
|
||||
<TextField layoutX="315.0" layoutY="269.0" prefHeight="25.0" prefWidth="457.0" />
|
||||
<TextField layoutX="315.0" layoutY="269.0" prefHeight="25.0" prefWidth="457.0" fx:id="input_text" />
|
||||
<ComboBox layoutX="781.0" layoutY="269.0" prefHeight="25.0" prefWidth="246.0" fx:id="comboBox" />
|
||||
<Button layoutX="1043.0" layoutY="269.0" mnemonicParsing="false" text="解析" AnchorPane.rightAnchor="117.0" onAction="#player"/>
|
||||
</children>
|
||||
|
|
|
|||
Loading…
Reference in New Issue