Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove duplicate id in inputs #37

Merged
merged 1 commit into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions WindowsFormsApp1/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ private void InitInputSongIds(out string errorMsg)
var songIds = RequestSongIdInAlbum(id, out errorMsg);
if (errorMsg == ErrorMsg.SUCCESS)
{
_globalSearchInfo.SONG_IDS.AddRange(songIds);
foreach (var songId in songIds)
{
_globalSearchInfo.SONG_IDS.Add(songId);
}
}
}
else
Expand Down Expand Up @@ -204,7 +207,7 @@ private void SingleSearch(long songId)
/**
* 批量歌曲搜索
*/
private void BatchSearch(List<long> ids)
private void BatchSearch(IEnumerable<long> ids)
{
SearchBySongId(ids, out var resultMaps);

Expand Down Expand Up @@ -252,7 +255,11 @@ private void searchBtn_Click(object sender, EventArgs e)
}
else
{
SingleSearch(songIds[0]);
// just loop once
foreach (var songId in songIds)
{
SingleSearch(songId);
}
}
}

Expand Down
8 changes: 2 additions & 6 deletions WindowsFormsApp1/NetEaseMusicVO.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;

namespace 网易云歌词提取
{
Expand Down Expand Up @@ -118,7 +114,7 @@ public class SearchInfo

public string[] InputIds { get; set; }

public readonly List<long> SONG_IDS = new List<long>();
public readonly HashSet<long> SONG_IDS = new HashSet<long>();

public OUTPUT_ENCODING_ENUM Encoding { get; set; }

Expand Down