Skip to content

Commit

Permalink
启动前后事件添加关闭开关;修正了几个小bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jiashuaizhang committed Dec 19, 2021
1 parent d4d089d commit fae69af
Show file tree
Hide file tree
Showing 14 changed files with 338 additions and 209 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# yyets-snapshot
> 人人影视历史镜像,致敬曾经的辉煌。
> 人人影视历史镜像
##### 几点说明

Expand All @@ -9,10 +9,20 @@
##### 效果展示

1. 剧目检索
![yyets-1](./static/yyets-1.png)
![yyets-1](./static/yyets-1.png)

2. 复制链接
![yyets-2](./static/yyets-2.png)
![yyets-2](./static/yyets-2.png)

3. 查看链接
![yyets-3](./static/yyets-3.png)
![yyets-3](./static/yyets-3.png)

##### 配置说明

| 配置项 | 类型 | 作用 | 缺省值 | 说明 |
| ----------------------------------- | -------- | -------------------- | --------- | ------------------------------------------------------------ |
| `yyets-history.link-way-filter` | string[] | 保留的链接类型 | 电驴,磁力 | 所有支持的链接类型:[电驴, 腾讯, 百度云, 磁力, Bilibili, 优酷, 诚通网盘, 微云, 网盘, 搜狐, 乐视, Acfun] |
| `yyets-history.host` | string | 域名 | localhost | 启动前后事件中使用 |
| `yyets-history.start-prepare-event` | boolean | 是否开启启动前置事件 | true | 前置事件: 检查程序是否已在另一进程启动。支持命令行--参数、jvm -D参数、系统环境变量,不支持yml配置 |
| `yyets-history.start-finish-event` | boolean | 是否开启启动后置事件 | true | 后置事件: 自动弹出浏览器,失败则弹框给出访问地址 |

2 changes: 1 addition & 1 deletion yyets-history/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.zhangjiashuai</groupId>
<artifactId>yyets-history</artifactId>
<version>2.2</version>
<version>2.3</version>
<name>yyets-history</name>
<description>a yyets history snapshot</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.concurrent.atomic.AtomicBoolean;

import static com.zhangjiashuai.yyetshistory.util.NativeOperationUtils.onStartFinish;
import static com.zhangjiashuai.yyetshistory.util.NativeOperationUtils.onStartPrepare;

@SpringBootApplication
Expand All @@ -11,6 +14,7 @@ public class YyetsHistoryApplication {
public static void main(String[] args) {
onStartPrepare(args);
SpringApplication.run(YyetsHistoryApplication.class, args);
onStartFinish(args);
}

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.zhangjiashuai.yyetshistory.config;

import cn.hutool.core.collection.CollectionUtil;
import lombok.Data;

import java.util.LinkedHashSet;
import java.util.Collections;
import java.util.Set;

@Data
public class YyetsHistoryProperties {
Expand All @@ -15,20 +17,28 @@ public class YyetsHistoryProperties {
public static final String PID_KEY = "pid";
public static final long UNKNOWN_PID = -1L;

public static final String DEFAULT_HOST = "localhost";
public static final Set<String> DEFAULT_LINK_WAY_FILTER =
Collections.unmodifiableSet(CollectionUtil.newHashSet("电驴", "磁力"));

/**
* 保留的链接类型
*/
private LinkedHashSet<String> linkWayFilter;
private Set<String> linkWayFilter = DEFAULT_LINK_WAY_FILTER;

/**
* 域名
*/
private String host = DEFAULT_HOST;

/**
* 默认每页大小
* 是否触发启动前置事件
*/
private int defaultPageSize;
private boolean startPrepareEvent = true;

/**
* 域名
* 是否触发启动成功事件
*/
private String host;
private boolean startFinishEvent = true;

public int getDefaultPageSize() {
return defaultPageSize < 1 ? DEFAULT_PAGE_SIZE : defaultPageSize;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.zhangjiashuai.yyetshistory.entity;

import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil;
import lombok.Data;

import java.util.Collections;
Expand Down Expand Up @@ -48,7 +48,7 @@ public static class Group implements Comparable<Group> {

@Override
public int compareTo(Group that) {
return StrUtil.compareIgnoreCase(this.name, that.name,false);
return CharSequenceUtil.compareIgnoreCase(this.name, that.name, false);
}
}

Expand All @@ -72,7 +72,7 @@ public static class Link implements Comparable<Link> {

@Override
public int compareTo(Link that) {
return StrUtil.compareIgnoreCase(this.way, that.way,false);
return CharSequenceUtil.compareIgnoreCase(this.way, that.way, false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import java.util.List;

import static com.zhangjiashuai.yyetshistory.config.YyetsHistoryProperties.DEFAULT_PAGE_SIZE;

public interface ResourceService {

List<ResourceDO> findByNameLike(String name);
Expand All @@ -16,6 +18,8 @@ public interface ResourceService {

PageInfo<Resource> selectPage(String name, int pageNo, int pageSize);

PageInfo<Resource> selectPage(String name, int pageNo);
default PageInfo<Resource> selectPage(String name, int pageNo) {
return selectPage(name, pageNo, DEFAULT_PAGE_SIZE);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public Resource parseResource(ResourceDO resourceDO) {
for (int k = 0; k < filesArray.size(); k++) {
JSONObject fileJson = filesArray.getJSONObject(k);
String way = fileJson.getString("way_cn");
LinkedHashSet<String> linkWayFilter = config.getLinkWayFilter();
Set<String> linkWayFilter = config.getLinkWayFilter();
if(!linkWayFilter.contains(way)) {
continue;
}
Expand Down Expand Up @@ -141,9 +141,4 @@ public PageInfo<Resource> selectPage(String name, int pageNo, int pageSize) {
return page.toPageInfo(this::parseResource);
}

@Override
public PageInfo<Resource> selectPage(String name, int pageNo) {
return selectPage(name, pageNo, config.getDefaultPageSize());
}

}
Loading

0 comments on commit fae69af

Please sign in to comment.