From fa839a8ea6f1c015fc67f03a52b1170f66cb9ed0 Mon Sep 17 00:00:00 2001 From: Color_yr <402067010@qq.com> Date: Sun, 8 Jan 2023 14:31:20 +0800 Subject: [PATCH] 2.17.5 ktv mode --- build.gradle | 2 +- src/main/java/coloryr/allmusic/AllMusic.java | 6 +- .../coloryr/allmusic/command/CommandEX.java | 16 ++- .../java/coloryr/allmusic/hud/HudUtils.java | 17 ++- .../coloryr/allmusic/music/api/APIMain.java | 15 ++- .../coloryr/allmusic/music/play/LyricDo.java | 112 +++++++++++++++--- .../coloryr/allmusic/music/play/PlayGo.java | 33 ++++-- .../java/coloryr/allmusic/objs/ConfigOBJ.java | 6 + .../objs/api/music/lyric/WLyricOBJ.java | 16 +++ .../coloryr/allmusic/objs/message/HudOBJ.java | 5 + .../allmusic/objs/music/LyricItemObj.java | 58 ++++++++- .../allmusic/objs/music/TopLyricItemObj.java | 16 ++- .../java/coloryr/allmusic/side/bc/SideBC.java | 15 ++- .../allmusic/side/bukkit/PluginMessage.java | 6 + .../side/bukkit/hooks/AllMusicPAPI.java | 8 ++ .../allmusic/side/velocity/SideVelocity.java | 15 ++- src/main/resources/config.json | 3 +- src/main/resources/message.json | 3 +- src/test/java/RunTest.java | 42 +++++++ 19 files changed, 339 insertions(+), 55 deletions(-) create mode 100644 src/test/java/RunTest.java diff --git a/build.gradle b/build.gradle index 6735e61f..56ca90f6 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ plugins { id 'maven-publish' id 'com.github.johnrengelman.shadow' version '6.1.0' } -version = "2.17.4" +version = "2.17.5" repositories { mavenCentral() diff --git a/src/main/java/coloryr/allmusic/AllMusic.java b/src/main/java/coloryr/allmusic/AllMusic.java index 719c08c9..f700c204 100644 --- a/src/main/java/coloryr/allmusic/AllMusic.java +++ b/src/main/java/coloryr/allmusic/AllMusic.java @@ -39,15 +39,15 @@ public class AllMusic { /** * 插件版本号 */ - public static final String version = "2.17.4"; + public static final String version = "2.17.5"; /** * 配置文件版本号 */ - public static final String configVersion = "101"; + public static final String configVersion = "102"; /** * 语言文件配置版本号 */ - public static final String messageVersion = "101"; + public static final String messageVersion = "102"; /** * 搜歌结果 diff --git a/src/main/java/coloryr/allmusic/command/CommandEX.java b/src/main/java/coloryr/allmusic/command/CommandEX.java index 518eed8b..2db9e3ab 100644 --- a/src/main/java/coloryr/allmusic/command/CommandEX.java +++ b/src/main/java/coloryr/allmusic/command/CommandEX.java @@ -43,11 +43,13 @@ public class CommandEX { * @return 结果 */ private static boolean checkMoney(Object sender, String name, int cost) { - if (AllMusic.getConfig().UseCost && AllMusic.economy != null) { - if (!AllMusic.economy.check(name, cost)) { - AllMusic.side.sendMessage(sender, AllMusic.getMessage().Cost.NoMoney); - return true; - } + if (!AllMusic.getConfig().UseCost || AllMusic.economy == null) { + return false; + } + + if (!AllMusic.economy.check(name, cost)) { + AllMusic.side.sendMessage(sender, AllMusic.getMessage().Cost.NoMoney); + return true; } return false; } @@ -61,6 +63,10 @@ public class CommandEX { * @return 结果 */ private static boolean cost(Object sender, String name, int cost, String message) { + if (!AllMusic.getConfig().UseCost || AllMusic.economy == null){ + return false; + } + if (AllMusic.economy.cost(name, cost)) { AllMusic.side.sendMessage(sender, message .replace("%Cost%", "" + cost)); diff --git a/src/main/java/coloryr/allmusic/hud/HudUtils.java b/src/main/java/coloryr/allmusic/hud/HudUtils.java index fcaebac5..c2823e8a 100644 --- a/src/main/java/coloryr/allmusic/hud/HudUtils.java +++ b/src/main/java/coloryr/allmusic/hud/HudUtils.java @@ -151,10 +151,19 @@ public class HudUtils { if (showobj == null) { info = AllMusic.getMessage().Hud.NoLyric; } else { - info = AllMusic.getMessage().Hud.Lyric - .replace("%Lyric%", showobj.getLyric() == null ? "" : showobj.getLyric()) - .replace("%Tlyric%", (showobj.isHaveT() && showobj.getTlyric() != null) ? - showobj.getTlyric() : ""); + String lyric = showobj.getLyric(); + String tLyric = showobj.getTlyric(); + String kLyric = showobj.getKly(); + if (!AllMusic.getConfig().KtvMode || !showobj.isHaveK()) { + info = AllMusic.getMessage().Hud.Lyric + .replace("%Lyric%", lyric == null ? "" : lyric) + .replace("%Tlyric%", tLyric != null ? tLyric : ""); + } else { + info = AllMusic.getMessage().Hud.Ktv + .replace("%Lyric%", lyric != null ? lyric : "") + .replace("%KLyric%", kLyric != null ? kLyric : "") + .replace("%Tlyric%", tLyric != null ? tLyric : ""); + } } AllMusic.side.sendHudLyric(info); diff --git a/src/main/java/coloryr/allmusic/music/api/APIMain.java b/src/main/java/coloryr/allmusic/music/api/APIMain.java index d5758940..4c89009f 100644 --- a/src/main/java/coloryr/allmusic/music/api/APIMain.java +++ b/src/main/java/coloryr/allmusic/music/api/APIMain.java @@ -230,11 +230,16 @@ public class APIMain { LyricSaveObj Lyric = new LyricSaveObj(); JsonObject params = new JsonObject(); params.addProperty("id", id); - params.addProperty("lv", -1); - params.addProperty("kv", -1); - params.addProperty("tv", -1); - params.addProperty("rv", -1); - HttpResObj res = HttpClientUtil.post("https://music.163.com/api/song/lyric?_nmclfl=1", params, EncryptType.API, null); + params.addProperty("cp", false); + params.addProperty("tv", 0); + params.addProperty("lv", 0); + params.addProperty("rv", 0); + params.addProperty("kv", 0); + params.addProperty("yv", 0); + params.addProperty("ytv", 0); + params.addProperty("rtv", 0); + HttpResObj res = HttpClientUtil.post("https://interface3.music.163.com/eapi/song/lyric/v1", + params, EncryptType.EAPI, "/api/song/lyric/v1"); if (res != null && res.ok) { try { WLyricOBJ obj = AllMusic.gson.fromJson(res.data, WLyricOBJ.class); diff --git a/src/main/java/coloryr/allmusic/music/play/LyricDo.java b/src/main/java/coloryr/allmusic/music/play/LyricDo.java index e16fc398..2f30448b 100644 --- a/src/main/java/coloryr/allmusic/music/play/LyricDo.java +++ b/src/main/java/coloryr/allmusic/music/play/LyricDo.java @@ -8,6 +8,20 @@ import coloryr.allmusic.utils.Function; import java.util.*; public class LyricDo { + private static class KL { + public char k; + public Map v; + + public KL(char k, Map v) { + this.k = k; + this.v = v; + } + + @Override + public String toString() { + return String.valueOf(k); + } + } private final Map temp = new HashMap<>(); public boolean isHave = false; @@ -18,6 +32,7 @@ public class LyricDo { /** * 检查歌词 + * * @param obj 歌词 * @return 结果 */ @@ -25,47 +40,82 @@ public class LyricDo { String[] lyric; boolean haveT = false; + boolean haveK = false; if (!obj.isOk()) return true; else if (obj.isNone()) return false; lyric = obj.getLyric().split("\n"); - List Tlyric = new ArrayList<>(); - if (obj.getTlyric() != null) { - Tlyric = Arrays.asList(obj.getTlyric().split("\n")); - haveT = true; - } + + List temp2 = new ArrayList<>(); Map temp = getTime(Arrays.asList(lyric)); - if (haveT) { - Map temp1 = getTime(Tlyric); - for (Map.Entry item : temp.entrySet()) { - this.temp.put(item.getKey(), new LyricItemObj(haveT, - item.getValue(), temp1.get(item.getKey()))); - } - } else { - for (Map.Entry item : temp.entrySet()) { - this.temp.put(item.getKey(), new LyricItemObj(haveT, - item.getValue(), null)); - } + Map temp1 = new HashMap<>(); + + if (obj.getTlyric() != null) { + List tlyric = Arrays.asList(obj.getTlyric().split("\n")); + haveT = true; + temp1 = getTime(tlyric); } + + if (obj.getKlyric() != null && !obj.getKlyric().isEmpty()) { + String[] klyric = obj.getKlyric().split("\n"); + char[] temp3 = new char[1]; + for (String item : klyric) { + Map temp4 = getKTime(item, temp3); + if (temp4 != null) { + temp2.add(new KL(temp3[0], temp4)); + } + } + haveK = true; + } + + int index = 0; + for (Map.Entry item : temp.entrySet()) { + Map temp6 = null; + if (haveK) { + char temp7 = item.getValue().charAt(0); + if (index == temp2.size()) { + index = 0; + } + while (index < temp2.size()) { + KL temp5 = temp2.get(index); + if (temp5.k == temp7) { + temp6 = temp5.v; + index++; + break; + } + index++; + } + } + + this.temp.put(item.getKey(), new LyricItemObj(item.getKey(), haveT, + item.getValue(), temp1.get(item.getKey()), temp6, temp6 != null)); + } + isHave = true; return false; } /** * 将歌词转换成时间 字 + * * @param lyric 歌词 * @return 结果 */ private Map getTime(List lyric) { - Map res = new HashMap<>(); + Map res = new LinkedHashMap<>(); String min; String sec; String mil; int time; int milt; for (String s : lyric) { - if (Function.countChar(Function.getString(s, "[", "]"), ':') > 1) { + if (!s.startsWith("[")) + continue; + String temp = Function.getString(s, "[", "]"); + if (!temp.contains(".") || !temp.contains(":")) + continue; + if (Function.countChar(temp, ':') > 1) { String[] a = s.split(":"); min = a[0].substring(1); sec = a[1]; @@ -94,4 +144,30 @@ public class LyricDo { } return res; } + + private Map getKTime(String lyric, char[] time1) { + Map res = new HashMap<>(); + if (!lyric.startsWith("[") || !lyric.contains("](")) + return null; + + String[] temp1 = lyric.split("\\("); + if (temp1.length == 1) + return null; + + int now = 0; + for (int a = 1; a < temp1.length; a++) { + String time = temp1[a]; + int temp2 = time.indexOf(')'); + String temp3 = time.substring(2, temp2); + int temp5 = Integer.parseInt(temp3) / 10 * 10; + char temp6 = time.charAt(temp2 + 1); + if (a == 1) { + time1[0] = temp6; + } + res.put(now, temp6); + now += temp5; + } + + return res; + } } diff --git a/src/main/java/coloryr/allmusic/music/play/PlayGo.java b/src/main/java/coloryr/allmusic/music/play/PlayGo.java index eefbada6..5c069f8e 100644 --- a/src/main/java/coloryr/allmusic/music/play/PlayGo.java +++ b/src/main/java/coloryr/allmusic/music/play/PlayGo.java @@ -6,6 +6,7 @@ import coloryr.allmusic.objs.music.LyricItemObj; import coloryr.allmusic.objs.music.LyricSaveObj; import coloryr.allmusic.objs.music.MusicObj; +import java.util.Map; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; @@ -99,19 +100,31 @@ public class PlayGo { } private static void time2() { - LyricItemObj show = PlayMusic.lyric.checkTime(PlayMusic.musicNowTime); - if (show != null) { - PlayMusic.lyricItem = show; - times = 0; - HudUtils.sendHudLyricData(show); - AllMusic.side.updateLyric(); - } else { - times++; - if (times == 500 && PlayMusic.lyricItem != null) { + try { + LyricItemObj show = PlayMusic.lyric.checkTime(PlayMusic.musicNowTime); + if (show != null) { + PlayMusic.lyricItem = show; times = 0; - HudUtils.sendHudLyricData(PlayMusic.lyricItem); + HudUtils.sendHudLyricData(show); AllMusic.side.updateLyric(); + } else { + if (PlayMusic.lyricItem != null && + AllMusic.getConfig().KtvMode && PlayMusic.lyricItem.isHaveK()) { + if (PlayMusic.lyricItem.ktv(PlayMusic.musicNowTime)) { + HudUtils.sendHudLyricData(PlayMusic.lyricItem); + AllMusic.side.updateLyric(); + } + } else { + times++; + if (times == 500 && PlayMusic.lyricItem != null) { + times = 0; + HudUtils.sendHudLyricData(PlayMusic.lyricItem); + AllMusic.side.updateLyric(); + } + } } + } catch (Exception e) { + e.printStackTrace(); } } diff --git a/src/main/java/coloryr/allmusic/objs/ConfigOBJ.java b/src/main/java/coloryr/allmusic/objs/ConfigOBJ.java index 7a8a524a..f0704568 100644 --- a/src/main/java/coloryr/allmusic/objs/ConfigOBJ.java +++ b/src/main/java/coloryr/allmusic/objs/ConfigOBJ.java @@ -105,6 +105,10 @@ public class ConfigOBJ { * 将信息限制在bar处 */ public boolean ShowInBar; + /** + * K歌歌词 + */ + public boolean KtvMode; /** * 登录的用户 @@ -165,6 +169,8 @@ public class ConfigOBJ { Economy = new EconomyObj(); + KtvMode = true; + Version = AllMusic.version; } diff --git a/src/main/java/coloryr/allmusic/objs/api/music/lyric/WLyricOBJ.java b/src/main/java/coloryr/allmusic/objs/api/music/lyric/WLyricOBJ.java index 570cac05..e3c1339d 100644 --- a/src/main/java/coloryr/allmusic/objs/api/music/lyric/WLyricOBJ.java +++ b/src/main/java/coloryr/allmusic/objs/api/music/lyric/WLyricOBJ.java @@ -3,6 +3,7 @@ package coloryr.allmusic.objs.api.music.lyric; public class WLyricOBJ { private lrc lrc; private tlyric tlyric; + private klyric klyric; private boolean nolyric; private boolean uncollected; @@ -20,6 +21,12 @@ public class WLyricOBJ { return tlyric.getLyric(); } + public String getKlyric() { + if (klyric == null) + return null; + return klyric.getLyric(); + } + public boolean isNone() { return nolyric || uncollected; } @@ -39,4 +46,13 @@ class tlyric { public String getLyric() { return lyric; } +} + +class klyric +{ + private String lyric; + + public String getLyric() { + return lyric == null ? "" : lyric; + } } \ No newline at end of file diff --git a/src/main/java/coloryr/allmusic/objs/message/HudOBJ.java b/src/main/java/coloryr/allmusic/objs/message/HudOBJ.java index 3595ea21..fa079800 100644 --- a/src/main/java/coloryr/allmusic/objs/message/HudOBJ.java +++ b/src/main/java/coloryr/allmusic/objs/message/HudOBJ.java @@ -11,6 +11,7 @@ public class HudOBJ { public String Music; public String Lyric; public String List; + public String Ktv; public HudOBJ() { State = "§d[ALLMusic]§2设置信息位置:%Hud%,状态:%State%"; @@ -22,6 +23,7 @@ public class HudOBJ { PicSize = "§d[ALLMusic]§2设置图片尺寸为%Size%"; Music = "%Name% %AllTime%/%NowTime%\n%Author%\n%Alia%\n%Al%\nby: %Player%"; Lyric = "%Lyric%\n%Tlyric%"; + Ktv = "§e%KLyric%§f%Lyric%§r\n%Tlyric%"; List = "播放列表里面有%Size%首歌\n%List%"; } @@ -46,6 +48,9 @@ public class HudOBJ { return true; if (List == null) return true; + if (Ktv == null) + return true; + return false; } diff --git a/src/main/java/coloryr/allmusic/objs/music/LyricItemObj.java b/src/main/java/coloryr/allmusic/objs/music/LyricItemObj.java index 4033a1e4..cb0d218f 100644 --- a/src/main/java/coloryr/allmusic/objs/music/LyricItemObj.java +++ b/src/main/java/coloryr/allmusic/objs/music/LyricItemObj.java @@ -2,19 +2,69 @@ package coloryr.allmusic.objs.music; import coloryr.allmusic.AllMusic; +import java.util.Map; + public class LyricItemObj { protected boolean haveT; + protected boolean haveK; protected String lyric; protected String tlyric; + protected Map klyric; + protected int start; + protected int last; + protected String kly; + protected String lly; + protected int lastIndex = 0; - public LyricItemObj(boolean haveT, String lyric, String tlyric) { + public LyricItemObj(int start, boolean haveT, String lyric, String tlyric, + Map klyric, boolean haveK) { + this.start = start; this.haveT = haveT; this.lyric = lyric; this.tlyric = tlyric; + this.klyric = klyric; + this.haveK = haveK; + this.lly = lyric; + if (haveK) { + kly = ""; + } } - public boolean isHaveT() { - return haveT; + public boolean ktv(int time) { + if (last == time || klyric == null) + return false; + + Character temp = klyric.get(time - start); + if (temp != null) { + if (lastIndex >= lyric.length()) { + kly = lyric; + lly = ""; + } else { + int index = lyric.indexOf(temp, lastIndex); + if (index == lyric.length() - 1) { + kly = lyric; + lly = ""; + lastIndex = lyric.length(); + } else if (index != -1) { + lastIndex = index + 1; + + kly = lyric.substring(0, index + 1); + lly = lyric.substring(index + 1); + } + } + last = time; + return true; + } + + return false; + } + + public String getKly() { + return kly; + } + + public boolean isHaveK() { + return haveK; } public String getTlyric() { @@ -22,7 +72,7 @@ public class LyricItemObj { } public String getLyric() { - return lyric; + return lly; } public String getString() { diff --git a/src/main/java/coloryr/allmusic/objs/music/TopLyricItemObj.java b/src/main/java/coloryr/allmusic/objs/music/TopLyricItemObj.java index 6d938581..8de64c10 100644 --- a/src/main/java/coloryr/allmusic/objs/music/TopLyricItemObj.java +++ b/src/main/java/coloryr/allmusic/objs/music/TopLyricItemObj.java @@ -4,7 +4,7 @@ import coloryr.allmusic.objs.music.LyricItemObj; public class TopLyricItemObj extends LyricItemObj { public TopLyricItemObj() { - super(false, null, null); + super(0, false, null, null, null, false); } public void setTlyric(String data) { @@ -15,7 +15,21 @@ public class TopLyricItemObj extends LyricItemObj { lyric = data; } + public void setKly(String data) { + kly = data; + } + + public void setHaveK(boolean data) { + haveK = data; + if (!haveK) { + kly = null; + } + } + public void setHaveT(boolean data) { haveT = data; + if (!haveT) { + tlyric = null; + } } } diff --git a/src/main/java/coloryr/allmusic/side/bc/SideBC.java b/src/main/java/coloryr/allmusic/side/bc/SideBC.java index f190ec77..4b6f3293 100644 --- a/src/main/java/coloryr/allmusic/side/bc/SideBC.java +++ b/src/main/java/coloryr/allmusic/side/bc/SideBC.java @@ -356,7 +356,20 @@ public class SideBC implements ISide { out = ByteStreams.newDataOutput(); out.writeInt(9); - out.writeBoolean(PlayMusic.lyricItem != null && PlayMusic.lyricItem.isHaveT()); + out.writeBoolean(PlayMusic.lyricItem != null && PlayMusic.lyricItem.getTlyric() != null); + server.sendData(AllMusic.channelBC, out.toByteArray()); + + out = ByteStreams.newDataOutput(); + out.writeInt(10); + if (PlayMusic.lyricItem == null || PlayMusic.lyricItem.getKly() == null) + out.writeUTF(""); + else + out.writeUTF(PlayMusic.lyricItem.getTlyric()); + server.sendData(AllMusic.channelBC, out.toByteArray()); + + out = ByteStreams.newDataOutput(); + out.writeInt(11); + out.writeBoolean(PlayMusic.lyricItem != null && PlayMusic.lyricItem.getKly() != null); server.sendData(AllMusic.channelBC, out.toByteArray()); } diff --git a/src/main/java/coloryr/allmusic/side/bukkit/PluginMessage.java b/src/main/java/coloryr/allmusic/side/bukkit/PluginMessage.java index 20aa35b9..21966eec 100644 --- a/src/main/java/coloryr/allmusic/side/bukkit/PluginMessage.java +++ b/src/main/java/coloryr/allmusic/side/bukkit/PluginMessage.java @@ -91,6 +91,12 @@ public class PluginMessage implements PluginMessageListener { case 9: lyric.setHaveT(in.readBoolean()); break; + case 10: + lyric.setKly(in.readUTF()); + break; + case 11: + lyric.setHaveK(in.readBoolean()); + break; } } } diff --git a/src/main/java/coloryr/allmusic/side/bukkit/hooks/AllMusicPAPI.java b/src/main/java/coloryr/allmusic/side/bukkit/hooks/AllMusicPAPI.java index b025e425..5845762c 100644 --- a/src/main/java/coloryr/allmusic/side/bukkit/hooks/AllMusicPAPI.java +++ b/src/main/java/coloryr/allmusic/side/bukkit/hooks/AllMusicPAPI.java @@ -91,6 +91,9 @@ public class AllMusicPAPI extends PlaceholderExpansion { case "tlyric": { return PlayMusic.lyricItem.getTlyric(); } + case "klyric": { + return PlayMusic.lyricItem.getKly(); + } } } else { switch (identifier) { @@ -140,6 +143,11 @@ public class AllMusicPAPI extends PlaceholderExpansion { return ""; return PlayMusic.lyricItem.getTlyric(); } + case "klyric": { + if (PlayMusic.lyricItem == null) + return ""; + return PlayMusic.lyricItem.getKly(); + } } } return null; diff --git a/src/main/java/coloryr/allmusic/side/velocity/SideVelocity.java b/src/main/java/coloryr/allmusic/side/velocity/SideVelocity.java index 3f69ced8..0110bc1f 100644 --- a/src/main/java/coloryr/allmusic/side/velocity/SideVelocity.java +++ b/src/main/java/coloryr/allmusic/side/velocity/SideVelocity.java @@ -359,7 +359,20 @@ public class SideVelocity implements ISide { out = ByteStreams.newDataOutput(); out.writeInt(9); - out.writeBoolean(PlayMusic.lyricItem != null && PlayMusic.lyricItem.isHaveT()); + out.writeBoolean(PlayMusic.lyricItem != null && PlayMusic.lyricItem.getTlyric() != null); + server.sendPluginMessage(AllMusicVelocity.channelBC, out.toByteArray()); + + out = ByteStreams.newDataOutput(); + out.writeInt(10); + if (PlayMusic.lyricItem == null || PlayMusic.lyricItem.getKly() == null) + out.writeUTF(""); + else + out.writeUTF(PlayMusic.lyricItem.getTlyric()); + server.sendPluginMessage(AllMusicVelocity.channelBC, out.toByteArray()); + + out = ByteStreams.newDataOutput(); + out.writeInt(11); + out.writeBoolean(PlayMusic.lyricItem != null && PlayMusic.lyricItem.getKly() != null); server.sendPluginMessage(AllMusicVelocity.channelBC, out.toByteArray()); } diff --git a/src/main/resources/config.json b/src/main/resources/config.json index c115ca18..5123d587 100644 --- a/src/main/resources/config.json +++ b/src/main/resources/config.json @@ -49,6 +49,7 @@ "SearchCost": 20, "AddMusicCost": 10, "MaxMusicTime": 600, + "KtvMode": true, "MusicBR": "320000", - "Version": "101" + "Version": "102" } \ No newline at end of file diff --git a/src/main/resources/message.json b/src/main/resources/message.json index 2287e9d6..384efc03 100644 --- a/src/main/resources/message.json +++ b/src/main/resources/message.json @@ -68,6 +68,7 @@ "PicSize": "§d[ALLMusic]§e设置图片尺寸为%Size%", "Music": "%Name% %AllTime%/%NowTime%\n%Author%\n%Alia%\n%Al%\nby: %Player%", "Lyric": "%Lyric%\n%Tlyric%", + "Ktv": "§e%KLyric%§f%Lyric%§r\n%Tlyric%", "List": "播放列表里面有%Size%首歌\n%List%" }, "Command": { @@ -122,5 +123,5 @@ "Login": "§d[AllMusic]§e使用/music login 重新登录账户" } }, - "Version": "101" + "Version": "102" } \ No newline at end of file diff --git a/src/test/java/RunTest.java b/src/test/java/RunTest.java new file mode 100644 index 00000000..a944636e --- /dev/null +++ b/src/test/java/RunTest.java @@ -0,0 +1,42 @@ +import coloryr.allmusic.AllMusic; +import coloryr.allmusic.objs.CookieObj; +import coloryr.allmusic.objs.music.LyricItemObj; +import coloryr.allmusic.objs.music.LyricSaveObj; +import coloryr.allmusic.side.IMyLogger; + +import java.util.Map; + +public class RunTest implements IMyLogger { + public static void main(String[] arg) { + AllMusic.cookie = new CookieObj(); + AllMusic.log = new RunTest(); +// LyricSaveObj obj = AllMusic.getMusicApi().getLyric("2003496380"); +// if(obj.isHaveLyric()) +// { +// +// } + LyricSaveObj obj = AllMusic.getMusicApi().getLyric("28151022"); + if (obj.isHaveLyric()) { + LyricItemObj item = obj.checkTime(15970); + int time = 0; + while (true) { + boolean res = item.ktv(time); + if (res) { + String temp = item.getKly(); + System.out.println(temp); + } + time += 10; + } + } + } + + @Override + public void warning(String data) { + + } + + @Override + public void info(String data) { + + } +}