From 8fa1f81ff9699914d95a2e4200d0c44151e6072c Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Fri, 4 Nov 2022 17:17:38 +0800 Subject: [PATCH] add JellyfinTv update Apk --- .../nas/Controllers/JellyfinController.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/main/java/com/yutou/nas/Controllers/JellyfinController.java b/src/main/java/com/yutou/nas/Controllers/JellyfinController.java index 0e2fe8c..01ce537 100644 --- a/src/main/java/com/yutou/nas/Controllers/JellyfinController.java +++ b/src/main/java/com/yutou/nas/Controllers/JellyfinController.java @@ -35,6 +35,12 @@ public class JellyfinController { return ""; } @ResponseBody + @RequestMapping("/jellyfin/setTvAppVersion") + public String setTvAppVersion(String version){ + RedisTools.set("jellyfin_tv_version",version); + return ""; + } + @ResponseBody @RequestMapping("/jellyfin/updateApp.do") public JSONObject updateApp(String version){ JSONObject json=new JSONObject(); @@ -60,4 +66,30 @@ public class JellyfinController { } return json; } + @ResponseBody + @RequestMapping("/jellyfin/updateTvApp.do") + public JSONObject updateTvApp(String version){ + JSONObject json=new JSONObject(); + String appVersion=RedisTools.get("jellyfin_tv_version"); + if(appVersion==null){ + json.put("code",0); + }else{ + File dir=new File("web"+File.separator+"apk"+File.separator+"jellyfinTv"+File.separator); + json.put("code",0); + if(dir.exists()){ + for (File file : dir.listFiles()) { + if(file.getName().endsWith(".apk")){ + json.put("code",1); + JSONObject data=new JSONObject(); + data.put("version",appVersion); + data.put("url","http://nas.cnmglz.com:9999/apk"+file.getAbsolutePath().replace(new File("web"+File.separator+"apk"+File.separator).getAbsolutePath(),"")); + json.put("data",data); + break; + } + } + } + + } + return json; + } }