新增设置动画meta接口

This commit is contained in:
Yutousama 2022-04-02 22:03:27 +08:00
parent d01cda4d50
commit 0da3b9f0d0
3 changed files with 43 additions and 48 deletions

View File

@ -4,9 +4,11 @@ import com.alibaba.fastjson.JSONArray;
import com.yutou.nas.utils.*; import com.yutou.nas.utils.*;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException; import java.io.IOException;
@Controller @Controller
@ -44,4 +46,10 @@ public class ToolsController {
public JSONArray getAnimItems(){ public JSONArray getAnimItems(){
return new JellyfinAPIManager().getAnimPaths(); return new JellyfinAPIManager().getAnimPaths();
} }
@ResponseBody
@RequestMapping(value = "/tools/anim/set.do",method = RequestMethod.POST)
public String setAnimMeta(String path,String id){
new JellyfinAPIManager().init(new File(path),id);
return "1";
}
} }

View File

@ -12,7 +12,7 @@ import org.springframework.context.annotation.Import;
@Import(BTDownloadManager.class) @Import(BTDownloadManager.class)
@SpringBootApplication @SpringBootApplication
public class NasApplication { public class NasApplication {
public static final String version="1.2.9"; public static final String version="1.2.10";
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(NasApplication.class, args); SpringApplication.run(NasApplication.class, args);
AppData.defaultMusicPath = (String) ConfigTools.load(ConfigTools.CONFIG, "musicDir"); AppData.defaultMusicPath = (String) ConfigTools.load(ConfigTools.CONFIG, "musicDir");

View File

@ -278,18 +278,7 @@ public class JellyfinAPIManager {
return array; return array;
} }
public void init(File path) { public void init(File path,String id) {
if (path.isDirectory()) {
File file = new File(path.getAbsolutePath() + File.separator + "info.ini");
if (!file.exists()) {
try {
file.createNewFile();
System.out.println("创建:" + file.getAbsolutePath());
} catch (IOException e) {
e.printStackTrace();
}
} else {
String id = ConfigTools.loadIni(file, "id");
if (id != null) { if (id != null) {
for (LibsItem item : mediaItem) { for (LibsItem item : mediaItem) {
List<LibsItem> _temp = getLibsItems(item.getId()); List<LibsItem> _temp = getLibsItems(item.getId());
@ -326,25 +315,23 @@ public class JellyfinAPIManager {
} }
} }
} }
} /*for (File file : path.listFiles()) {
}
for (File file : path.listFiles()) {
if (file.isDirectory()) { if (file.isDirectory()) {
// System.out.println("搜索目录:"+file.getAbsolutePath()); // System.out.println("搜索目录:"+file.getAbsolutePath());
init(file); init(file);
} }
} }*/
} }
public static String mainPath = "Z:\\download\\anim\\"; public static String mainPath = "Z:\\download\\anim\\";
public static void main(String[] args) { public static void main(String[] args) {
File file = new File("Z:\\download\\anim\\Bangdream☆pico"); File file = new File("Z:\\download\\anim\\白沙的水族馆");
//new JellyfinAPIManager().search(file.getName(), file); //new JellyfinAPIManager().search(file.getName(), file);
JellyfinAPIManager manager = new JellyfinAPIManager(); JellyfinAPIManager manager = new JellyfinAPIManager();
// manager.init(file); manager.init(file,"325281");
JSONArray search = manager.getAnimPaths(); //JSONArray search = manager.getAnimPaths();
System.out.println(search); //System.out.println(search);
} }
} }