Skip to content

Commit

Permalink
修复部分情况下判断为非NLyric创建歌词的错误
Browse files Browse the repository at this point in the history
Batch Step改为100
  • Loading branch information
wwh1004 committed Aug 4, 2020
1 parent 043b4f0 commit 5ee5faa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions NLyric/NLyric.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<Title>NLyric</Title>
<Product>NLyric</Product>
<Copyright>Copyright © 2019-2020 Wwh</Copyright>
<AssemblyVersion>2.6.0.0</AssemblyVersion>
<FileVersion>2.6.0.0</FileVersion>
<AssemblyVersion>2.6.0.1</AssemblyVersion>
<FileVersion>2.6.0.1</FileVersion>
<OutputPath>..\bin\$(Configuration)</OutputPath>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
Expand Down
12 changes: 9 additions & 3 deletions NLyric/NLyricImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,19 @@ private static AudioInfo[] LoadAllAudioInfos(string directory) {
finally {
audioFile?.Dispose();
}
var trackInfo = _database.TrackInfos.Match(audioInfo.Album, audioInfo.Track);
TrackInfo trackInfo;
lock (_database.TrackInfos)
trackInfo = _database.TrackInfos.Match(audioInfo.Album, audioInfo.Track);
if (!(trackInfo is null)) {
audioInfo.TrackInfo = trackInfo;
return audioInfo;
}
// 尝试从数据库获取歌曲
if (The163KeyHelper.TryGetTrackId(tag, out int trackId)) {
audioInfo.TrackInfo = new TrackInfo(audioInfo.Track, audioInfo.Album, trackId);
trackInfo = new TrackInfo(audioInfo.Track, audioInfo.Album, trackId);
lock (_database.TrackInfos)
_database.TrackInfos.Add(trackInfo);
audioInfo.TrackInfo = trackInfo;
return audioInfo;
}
// 尝试从163Key获取ID
Expand All @@ -145,6 +150,7 @@ private static async Task LoadAllAudioInfoCandidates(AudioInfo[] audioInfoCandid
else {
FastConsole.WriteInfo($"已获取文件\"{Path.GetFileName(candidate.Path)}\"的网易云音乐ID: {trackInfo.Id}。");
candidate.TrackInfo = new TrackInfo(candidate.Track, candidate.Album, trackInfo.Id);
_database.TrackInfos.Add(candidate.TrackInfo);
}
callback?.Invoke(candidate);
FastConsole.WriteNewLine();
Expand Down Expand Up @@ -696,7 +702,7 @@ private static Task AccelerateAllTracksAsync(AudioInfo[] audioInfos) {
}

private static async Task AccelerateAllLyricsAsync(AudioInfo[] audioInfos) {
const int STEP = 50;
const int STEP = 100;

int[] trackIds = audioInfos.Select(t => t.TrackInfo.Id).ToArray();
for (int i = 0; i < trackIds.Length; i += STEP) {
Expand Down

0 comments on commit 5ee5faa

Please sign in to comment.