Fix build

This commit is contained in:
FongMi 2023-01-03 14:11:49 +08:00
parent 0d61a541ee
commit c523ab990f
8 changed files with 78 additions and 100 deletions

View File

@ -15,3 +15,4 @@ dependencyResolutionManagement {
} }
rootProject.name = "CatVodSpider" rootProject.name = "CatVodSpider"
include ':app' include ':app'
include ':tools'

View File

@ -1,18 +1,10 @@
plugins { plugins {
id 'java' id 'java-library'
} }
java { java {
sourceCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_1_8
}
repositories {
mavenCentral()
}
compileJava {
options.encoding = 'UTF-8'
} }
dependencies { dependencies {

View File

@ -1,4 +0,0 @@
data.json 為對應表,可依據需求新增修改 epg、name、logo。
1. 執行 run.bat
2. 輸入直播文本網址或檔名
3. 自動產出 live.json

View File

@ -1 +0,0 @@
java -jar run.jar

Binary file not shown.

View File

@ -1 +0,0 @@
rootProject.name = 'tools'

View File

@ -1,2 +0,0 @@
Manifest-Version: 1.0
Main-Class: com.fongmi.tools.Run

View File

@ -12,7 +12,6 @@ import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Scanner;
public class Run { public class Run {
@ -21,24 +20,18 @@ public class Run {
private final Gson gson; private final Gson gson;
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
if (args.length > 0) { new Run().start("http://home.jundie.top:81/Cat/tv/live.txt");
new Run().start(args[0]);
} else {
System.out.print("請輸入網址或檔名:");
new Run().start(new Scanner(System.in).nextLine());
}
} }
public Run() { public Run() {
groups = new ArrayList<>(); groups = new ArrayList<>();
data = Data.arrayFrom(Util.getFile("data.json")); data = Data.arrayFrom(Util.getFile(getClass(), "data.json"));
gson = new Gson().newBuilder().disableHtmlEscaping().setPrettyPrinting().create(); gson = new Gson().newBuilder().disableHtmlEscaping().setPrettyPrinting().create();
} }
private void start(String text) throws IOException { private void start(String text) throws IOException {
if (text.startsWith("http")) parse(Util.call(text));
else parse(Util.getFile(text));
//parseTxt(Util.getFile(getClass(), "live.txt")); //parseTxt(Util.getFile(getClass(), "live.txt"));
parse(Util.call(text));
writeFile(); writeFile();
} }
@ -96,7 +89,7 @@ public class Run {
private void writeFile() { private void writeFile() {
try { try {
File file = new File("live.json"); File file = new File("json", "live.json");
PrintWriter writer = new PrintWriter(file, String.valueOf(StandardCharsets.UTF_8)); PrintWriter writer = new PrintWriter(file, String.valueOf(StandardCharsets.UTF_8));
writer.println(gson.toJson(groups)); writer.println(gson.toJson(groups));
writer.close(); writer.close();