Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
wushuo894 committed Jun 7, 2024
1 parent a97736c commit a491830
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/com/emby/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import cn.hutool.extra.pinyin.PinyinUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import cn.hutool.log.Log;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
Expand All @@ -23,6 +24,8 @@ public class Main {
public static String itemStr = "";
public static Integer port = 9198;

public static final Log log = Log.get(Main.class);

public static void main(String[] args) {
HashMap<String, String> map = new HashMap<>();

Expand Down Expand Up @@ -53,14 +56,15 @@ public static void main(String[] args) {

HttpUtil.createServer(port)
.addAction("/", (req, res) -> {
JsonObject jsonObject = gson.fromJson(req.getBody(), JsonObject.class);
JsonObject item = jsonObject.get("Item").getAsJsonObject();
log.info("Webhooks = {}", req.getBody());
try {
JsonObject jsonObject = gson.fromJson(req.getBody(), JsonObject.class);
JsonObject item = jsonObject.get("Item").getAsJsonObject();
if (Objects.nonNull(item)) {
ThreadUtil.execute(() -> pinyin(item));
}
} catch (Exception e) {
e.printStackTrace();
log.error(e);
}
res.sendOk();
}).start();
Expand Down

0 comments on commit a491830

Please sign in to comment.