Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
758ac48627 | ||
|
|
4af5166003 | ||
|
|
793ce9a20d | ||
|
|
82df0d274c | ||
|
|
2a09fb46af | ||
|
|
d74a4198d6 | ||
|
|
1de2605158 |
+27
@@ -0,0 +1,27 @@
|
|||||||
|
# 使用支持Maven打包的Java 11环境的基础镜像
|
||||||
|
FROM maven:3.8.4-openjdk-11 AS build
|
||||||
|
|
||||||
|
# 设置工作目录
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# 拉取项目代码
|
||||||
|
COPY src/ ./src/
|
||||||
|
COPY pom.xml .
|
||||||
|
|
||||||
|
# 使用Maven进行构建和打包
|
||||||
|
RUN mvn clean package
|
||||||
|
|
||||||
|
# 使用一个仅包含JRE 17的运行时镜像
|
||||||
|
FROM openjdk:11-jre-slim
|
||||||
|
|
||||||
|
# 设置工作目录
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# 从构建镜像中复制打包好的jar文件到运行镜像中
|
||||||
|
COPY --from=build /app/target/tvbox-mv-0.0.1-SNAPSHOT.jar /app/tvbox-mv-0.0.1-SNAPSHOT.jar
|
||||||
|
|
||||||
|
# 暴露端口
|
||||||
|
EXPOSE 7777
|
||||||
|
|
||||||
|
# 运行应用程序
|
||||||
|
CMD ["java", "-jar", "tvbox-mv-0.0.1-SNAPSHOT.jar"]
|
||||||
@@ -99,6 +99,7 @@ maxCount:最大返回值,返回结果里面 list 最大数量。 最大值10
|
|||||||
|
|
||||||
# TvBox配置
|
# TvBox配置
|
||||||
~~~ json
|
~~~ json
|
||||||
|
// 示例
|
||||||
{
|
{
|
||||||
"sites": [
|
"sites": [
|
||||||
{
|
{
|
||||||
@@ -119,6 +120,84 @@ maxCount:最大返回值,返回结果里面 list 最大数量。 最大值10
|
|||||||
"filterable": 1
|
"filterable": 1
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 已有接口-任选其一即可
|
||||||
|
{
|
||||||
|
"sites": [
|
||||||
|
{
|
||||||
|
"key": "MV_vod",
|
||||||
|
"name": "🎸┃明星-接口1┃MV",
|
||||||
|
"type": 1,
|
||||||
|
"api": "https://tvbox-mv--leosam2048.repl.co/mv/vod",
|
||||||
|
"searchable": 1,
|
||||||
|
"quickSearch": 1,
|
||||||
|
"filterable": 1
|
||||||
|
}, {
|
||||||
|
"key": "MV_vod",
|
||||||
|
"name": "🎸┃明星-接口2┃MV",
|
||||||
|
"type": 1,
|
||||||
|
"api": "https://mv.饭太硬.ml/mv/vod",
|
||||||
|
"searchable": 1,
|
||||||
|
"quickSearch": 1,
|
||||||
|
"filterable": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
~~~
|
||||||
|
|
||||||
|
|
||||||
|
# 安装和启动
|
||||||
|
|
||||||
|
## 使用docker进行启动
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### 镜像获取(二选一)
|
||||||
|
|
||||||
|
docker中央仓库拉取
|
||||||
|
|
||||||
|
|
||||||
|
~~~sh
|
||||||
|
# 注:需要自行安装docker环境
|
||||||
|
|
||||||
|
# 拉取git仓库
|
||||||
|
docker pull leosam1024/tvbox-mv:latest
|
||||||
|
~~~
|
||||||
|
|
||||||
|
本地构建docker镜像
|
||||||
|
|
||||||
|
~~~sh
|
||||||
|
# 注:需要自行安装git和docker环境
|
||||||
|
|
||||||
|
# 拉取git仓库
|
||||||
|
git clone https://github.com/leosam1024/tvbox-mv.git
|
||||||
|
|
||||||
|
# 进入仓库
|
||||||
|
cd tvbox-mv
|
||||||
|
|
||||||
|
# 构建docker镜像
|
||||||
|
docker build ./ -t leosam1024/tvbox-mv:latest
|
||||||
|
~~~
|
||||||
|
|
||||||
|
### 启动
|
||||||
|
|
||||||
|
~~~sh
|
||||||
|
# 运行docker镜像(前台运行)
|
||||||
|
docker run -p 7777:7777 leosam1024/tvbox-mv:latest
|
||||||
|
|
||||||
|
# 运行docker镜像(后台运行)
|
||||||
|
docker run -dit --restart always -p 8898:7777 leosam1024/tvbox-mv:latest
|
||||||
|
|
||||||
|
# 运行docker镜像(后台运行+指定容器名称) -- 推荐
|
||||||
|
docker run -dit --name tvbox-mv --hostname tvbox-mv --restart always -p 7777:7777 leosam1024/tvbox-mv:latest
|
||||||
|
|
||||||
|
# 运行docker镜像(后台运行+指定容器名称+自定义数据)
|
||||||
|
docker run -dit --name tvbox-mv --hostname tvbox-mv --restart always -p 7777:7777 -v /opt/mv/data:/app/data leosam1024/tvbox-mv:latest
|
||||||
|
|
||||||
|
# 如果再次构建运行的时候,出现说container冲突的话,删除container对应的的ID就行
|
||||||
|
docker rm container对应的的ID
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
docker build -t tvbox-mv:latest .
|
||||||
|
|
||||||
|
# docker login
|
||||||
|
# docker images
|
||||||
|
# docker tag d4c90f23cb5f leosam1024/tvbox-mv:latest
|
||||||
|
# docker push leosam1024/tvbox-mv:latest
|
||||||
@@ -9,7 +9,9 @@
|
|||||||
|
|
||||||
<description>Demo project for Spring Boot</description>
|
<description>Demo project for Spring Boot</description>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>17</java.version>
|
<java.version>11</java.version>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
|
||||||
<project.encoding>UTF-8</project.encoding>
|
<project.encoding>UTF-8</project.encoding>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
@@ -116,9 +118,6 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>${maven-compiler-plugin.version}</version>
|
<version>${maven-compiler-plugin.version}</version>
|
||||||
<configuration>
|
|
||||||
<release>17</release>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ public class MainVerticle extends AbstractVerticle {
|
|||||||
String wd = VertxUtils.queryParam(req, "wd");
|
String wd = VertxUtils.queryParam(req, "wd");
|
||||||
String ids = VertxUtils.queryParam(req, "ids");
|
String ids = VertxUtils.queryParam(req, "ids");
|
||||||
String query = StringUtils.trimToEmpty(StringUtils.defaultIfEmpty(wd, ids));
|
String query = StringUtils.trimToEmpty(StringUtils.defaultIfEmpty(wd, ids));
|
||||||
|
query = StringUtils.cleanString(query);
|
||||||
String ac = VertxUtils.queryParam(req, "ac");
|
String ac = VertxUtils.queryParam(req, "ac");
|
||||||
String type = VertxUtils.queryParam(req, "t");
|
String type = VertxUtils.queryParam(req, "t");
|
||||||
String maxCount = VertxUtils.queryParam(req, "maxCount");
|
String maxCount = VertxUtils.queryParam(req, "maxCount");
|
||||||
@@ -114,13 +115,13 @@ public class MainVerticle extends AbstractVerticle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
logger.error("searchVod fail, index={}, query={}, page={} ", index, query, page, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 返回数据
|
// 返回数据
|
||||||
String jsonString = Json.encode(vodResult);
|
String jsonString = Json.encode(vodResult);
|
||||||
req.response()
|
req.response()
|
||||||
.putHeader("content-type", "application/json")
|
.putHeader("content-type", "application/json;charset=utf-8")
|
||||||
.end(jsonString);
|
.end(jsonString);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,6 +130,7 @@ public class MainVerticle extends AbstractVerticle {
|
|||||||
String query = VertxUtils.queryParam(req, "query");
|
String query = VertxUtils.queryParam(req, "query");
|
||||||
String wd = VertxUtils.queryParam(req, "wd");
|
String wd = VertxUtils.queryParam(req, "wd");
|
||||||
query = StringUtils.isNotEmpty(query) ? query : wd;
|
query = StringUtils.isNotEmpty(query) ? query : wd;
|
||||||
|
query = StringUtils.cleanString(query);
|
||||||
String maxCount = VertxUtils.queryParam(req, "maxCount");
|
String maxCount = VertxUtils.queryParam(req, "maxCount");
|
||||||
int max = Math.min(Math.max(NumberUtils.toInt(maxCount, 200), 10), 1000);
|
int max = Math.min(Math.max(NumberUtils.toInt(maxCount, 200), 10), 1000);
|
||||||
|
|
||||||
@@ -139,13 +141,13 @@ public class MainVerticle extends AbstractVerticle {
|
|||||||
search = mvService.search(null, query, max);
|
search = mvService.search(null, query, max);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
logger.error("searchMv fail, query={}, maxCount={} ", query, maxCount, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 返回数据
|
// 返回数据
|
||||||
String jsonString = Json.encode(search);
|
String jsonString = Json.encode(search);
|
||||||
req.response()
|
req.response()
|
||||||
.putHeader("content-type", "application/json")
|
.putHeader("content-type", "application/json;charset=utf-8")
|
||||||
.end(jsonString);
|
.end(jsonString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ public class ClassPathReaderUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String extractFileNameWithoutExtension(String filePath) {
|
public static String extractFileNameWithoutExtension(String filePath) {
|
||||||
|
filePath = filePath.replace(CLASS_PATH_PREFIX, "");
|
||||||
Path path = Paths.get(filePath);
|
Path path = Paths.get(filePath);
|
||||||
String fileNameWithExtension = path.getFileName().toString();
|
String fileNameWithExtension = path.getFileName().toString();
|
||||||
int lastDotIndex = fileNameWithExtension.lastIndexOf(".");
|
int lastDotIndex = fileNameWithExtension.lastIndexOf(".");
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.leosam.tvbox.mv.utils;
|
package com.leosam.tvbox.mv.utils;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -44,4 +45,31 @@ public class StringUtils {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String cleanString(String s) {
|
||||||
|
// 去除乱码 以ISO8859-1方式读取UTF-8编码的中文
|
||||||
|
if (s.contains("ç") ||
|
||||||
|
s.contains("å") ||
|
||||||
|
s.contains("ğ") ||
|
||||||
|
s.contains("è") ||
|
||||||
|
s.contains("â") ||
|
||||||
|
s.contains("Š") ||
|
||||||
|
s.contains("ã") ||
|
||||||
|
s.contains("é") ||
|
||||||
|
s.contains("æ") ||
|
||||||
|
s.contains("§") ||
|
||||||
|
s.contains("ï")) {
|
||||||
|
s = new String(s.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
s = s
|
||||||
|
.replace('(', ' ')
|
||||||
|
.replace(')', ' ')
|
||||||
|
.replace('(', ' ')
|
||||||
|
.replace(')', ' ')
|
||||||
|
.replace('/', ' ')
|
||||||
|
.replace('[', ' ')
|
||||||
|
.replace(']', ' ')
|
||||||
|
.trim();
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user