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; + } }