From 7db6bb11de51d6fb7a60013e6f450b729f0a5e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=87=E7=85=8C?= Date: Fri, 7 Feb 2020 21:30:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8D=E6=98=BE=E7=A4=BA"?= =?UTF-8?q?=E6=AD=A3=E5=9C=A8=E5=B0=9D=E8=AF=95=E4=B8=8B=E8=BD=BDxxx?= =?UTF-8?q?=E7=9A=84=E6=AD=8C=E8=AF=8D=E3=80=82"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NLyric/NLyricImpl.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/NLyric/NLyricImpl.cs b/NLyric/NLyricImpl.cs index 0bc271d..5f3f8bc 100644 --- a/NLyric/NLyricImpl.cs +++ b/NLyric/NLyricImpl.cs @@ -32,6 +32,7 @@ public static async Task ExecuteAsync(Arguments arguments) { string databasePath; AudioInfo[] audioInfos; + FastConsole.WriteLine("程序会自动过滤相似度为0的结果与歌词未被收集的结果!!!", ConsoleColor.Green); loginTask = LoginIfNeedAsync(arguments); databasePath = Path.Combine(arguments.Directory, ".nlyric"); LoadDatabase(databasePath); @@ -60,6 +61,8 @@ public static async Task ExecuteAsync(Arguments arguments) { SaveDatabaseCore(databasePath); FastConsole.WriteNewLine(); } + if (arguments.UseBatch) + PrepareAllLyrics(audioInfos); foreach (AudioInfo audioInfo in audioInfos) if (!(audioInfo.TrackInfo is null)) await TryDownloadLyricAsync(audioInfo); @@ -253,6 +256,15 @@ private static async Task GetAlbumTracksAsync(AlbumInfo albumInfo) { return ncmTracks; } + private static void PrepareAllLyrics(AudioInfo[] audioInfos) { + int[] trackIds; + + trackIds = audioInfos.Where(t => !(t.TrackInfo is null)).Select(t => t.TrackInfo.Id).ToArray(); + for (int i = 0; i < trackIds.Length; i += 50) { + // TODO + } + } + private static async Task TryDownloadLyricAsync(AudioInfo audioInfo) { string lrcPath; bool hasLrcFile; @@ -272,12 +284,12 @@ private static async Task TryDownloadLyricAsync(AudioInfo audioInfo) { FastConsole.WriteException(ex); return false; } + FastConsole.WriteInfo($"正在尝试下载\"{Path.GetFileName(audioInfo.Path)} ({audioInfo.Track})\"的歌词。"); if (hasLrcFile) { // 如果歌词存在,判断是否需要覆盖或更新 LyricInfo lyricInfo; lyricInfo = trackInfo.Lyric; - FastConsole.WriteInfo($"正在尝试下载\"{Path.GetFileName(audioInfo.Path)} ({audioInfo.Track})\"的歌词。"); if (!(lyricInfo is null) && lyricInfo.CheckSum == lyricCheckSum) { // 歌词由NLyric创建 if (ncmLyric.RawVersion <= lyricInfo.RawVersion && ncmLyric.TranslatedVersion <= lyricInfo.TranslatedVersion) {